diff options
Diffstat (limited to 'recipes-graphics/xorg-xserver/xserver-xorg/0002-glamor-add-support-for-GL_RG.patch')
-rw-r--r-- | recipes-graphics/xorg-xserver/xserver-xorg/0002-glamor-add-support-for-GL_RG.patch | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/recipes-graphics/xorg-xserver/xserver-xorg/0002-glamor-add-support-for-GL_RG.patch b/recipes-graphics/xorg-xserver/xserver-xorg/0002-glamor-add-support-for-GL_RG.patch new file mode 100644 index 00000000..78988373 --- /dev/null +++ b/recipes-graphics/xorg-xserver/xserver-xorg/0002-glamor-add-support-for-GL_RG.patch | |||
@@ -0,0 +1,116 @@ | |||
1 | From 7f46b31e3d80ca769f68a4ffb201d0fc4801ea93 Mon Sep 17 00:00:00 2001 | ||
2 | From: Julien Isorce <julien.isorce@gmail.com> | ||
3 | Date: Thu, 6 Sep 2018 15:38:14 -0700 | ||
4 | Subject: [PATCH 2/8] glamor: add support for GL_RG | ||
5 | |||
6 | Allow to upload the CbCr plane of an NV12 image into a GL texture. | ||
7 | |||
8 | Upstream-Status: Backport | ||
9 | Signed-off-by: Julien Isorce <jisorce@oblong.com> | ||
10 | Tested-by: Olivier Fourdan <ofourdan@redhat.com> | ||
11 | Reviewed-by: Alex Deucher <alexander.deucher@amd.com> | ||
12 | --- | ||
13 | glamor/glamor.c | 2 ++ | ||
14 | glamor/glamor.h | 1 + | ||
15 | glamor/glamor_priv.h | 4 +++- | ||
16 | glamor/glamor_transfer.c | 10 ++++++++-- | ||
17 | glamor/glamor_utils.h | 4 ++++ | ||
18 | 5 files changed, 18 insertions(+), 3 deletions(-) | ||
19 | |||
20 | diff --git a/glamor/glamor.c b/glamor/glamor.c | ||
21 | index abefef614..3e9cf284c 100644 | ||
22 | --- a/glamor/glamor.c | ||
23 | +++ b/glamor/glamor.c | ||
24 | @@ -222,6 +222,8 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth, | ||
25 | |||
26 | pixmap_priv = glamor_get_pixmap_private(pixmap); | ||
27 | |||
28 | + pixmap_priv->is_cbcr = (usage == GLAMOR_CREATE_FORMAT_CBCR); | ||
29 | + | ||
30 | format = gl_iformat_for_pixmap(pixmap); | ||
31 | |||
32 | pitch = (((w * pixmap->drawable.bitsPerPixel + 7) / 8) + 3) & ~3; | ||
33 | diff --git a/glamor/glamor.h b/glamor/glamor.h | ||
34 | index be04bf858..e5992aa56 100644 | ||
35 | --- a/glamor/glamor.h | ||
36 | +++ b/glamor/glamor.h | ||
37 | @@ -129,6 +129,7 @@ extern _X_EXPORT Bool glamor_destroy_pixmap(PixmapPtr pixmap); | ||
38 | #define GLAMOR_CREATE_FBO_NO_FBO 0x103 | ||
39 | #define GLAMOR_CREATE_NO_LARGE 0x105 | ||
40 | #define GLAMOR_CREATE_PIXMAP_NO_TEXTURE 0x106 | ||
41 | +#define GLAMOR_CREATE_FORMAT_CBCR 0x107 | ||
42 | |||
43 | /* @glamor_egl_exchange_buffers: Exchange the underlying buffers(KHR image,fbo). | ||
44 | * | ||
45 | diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h | ||
46 | index 4353a99f1..a14aaf624 100644 | ||
47 | --- a/glamor/glamor_priv.h | ||
48 | +++ b/glamor/glamor_priv.h | ||
49 | @@ -380,6 +380,8 @@ typedef struct glamor_pixmap_private { | ||
50 | * names. | ||
51 | */ | ||
52 | glamor_pixmap_fbo **fbo_array; | ||
53 | + | ||
54 | + Bool is_cbcr; | ||
55 | } glamor_pixmap_private; | ||
56 | |||
57 | extern DevPrivateKeyRec glamor_pixmap_private_key; | ||
58 | @@ -902,7 +904,7 @@ int glamor_xv_put_image(glamor_port_private *port_priv, | ||
59 | Bool sync, | ||
60 | RegionPtr clipBoxes); | ||
61 | void glamor_xv_core_init(ScreenPtr screen); | ||
62 | -void glamor_xv_render(glamor_port_private *port_priv); | ||
63 | +void glamor_xv_render(glamor_port_private *port_priv, int id); | ||
64 | |||
65 | #include "glamor_utils.h" | ||
66 | |||
67 | diff --git a/glamor/glamor_transfer.c b/glamor/glamor_transfer.c | ||
68 | index ebb5101d1..421ed3a5f 100644 | ||
69 | --- a/glamor/glamor_transfer.c | ||
70 | +++ b/glamor/glamor_transfer.c | ||
71 | @@ -27,6 +27,7 @@ | ||
72 | void | ||
73 | glamor_format_for_pixmap(PixmapPtr pixmap, GLenum *format, GLenum *type) | ||
74 | { | ||
75 | + glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap); | ||
76 | switch (pixmap->drawable.depth) { | ||
77 | case 24: | ||
78 | case 32: | ||
79 | @@ -38,8 +39,13 @@ glamor_format_for_pixmap(PixmapPtr pixmap, GLenum *format, GLenum *type) | ||
80 | *type = GL_UNSIGNED_INT_2_10_10_10_REV; | ||
81 | break; | ||
82 | case 16: | ||
83 | - *format = GL_RGB; | ||
84 | - *type = GL_UNSIGNED_SHORT_5_6_5; | ||
85 | + if (priv->is_cbcr) { | ||
86 | + *format = priv->fbo->format; | ||
87 | + *type = GL_UNSIGNED_BYTE; | ||
88 | + } else { | ||
89 | + *format = GL_RGB; | ||
90 | + *type = GL_UNSIGNED_SHORT_5_6_5; | ||
91 | + } | ||
92 | break; | ||
93 | case 15: | ||
94 | *format = GL_BGRA; | ||
95 | diff --git a/glamor/glamor_utils.h b/glamor/glamor_utils.h | ||
96 | index 0d5674d63..1890c1fe5 100644 | ||
97 | --- a/glamor/glamor_utils.h | ||
98 | +++ b/glamor/glamor_utils.h | ||
99 | @@ -613,10 +613,14 @@ gl_iformat_for_pixmap(PixmapPtr pixmap) | ||
100 | { | ||
101 | glamor_screen_private *glamor_priv = | ||
102 | glamor_get_screen_private((pixmap)->drawable.pScreen); | ||
103 | + glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); | ||
104 | |||
105 | if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && | ||
106 | ((pixmap)->drawable.depth == 1 || (pixmap)->drawable.depth == 8)) { | ||
107 | return glamor_priv->one_channel_format; | ||
108 | + } else if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && | ||
109 | + (pixmap)->drawable.depth == 16 && pixmap_priv->is_cbcr) { | ||
110 | + return GL_RG; | ||
111 | } else if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && | ||
112 | (pixmap)->drawable.depth == 30) { | ||
113 | return GL_RGB10_A2; | ||
114 | -- | ||
115 | 2.17.1 | ||
116 | |||