summaryrefslogtreecommitdiffstats
path: root/recipes-graphics/xorg-xserver/xserver-xorg/0006-glamor-Plumb-the-pixmap-through-fbo-creation-instead.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-graphics/xorg-xserver/xserver-xorg/0006-glamor-Plumb-the-pixmap-through-fbo-creation-instead.patch')
-rw-r--r--recipes-graphics/xorg-xserver/xserver-xorg/0006-glamor-Plumb-the-pixmap-through-fbo-creation-instead.patch265
1 files changed, 265 insertions, 0 deletions
diff --git a/recipes-graphics/xorg-xserver/xserver-xorg/0006-glamor-Plumb-the-pixmap-through-fbo-creation-instead.patch b/recipes-graphics/xorg-xserver/xserver-xorg/0006-glamor-Plumb-the-pixmap-through-fbo-creation-instead.patch
new file mode 100644
index 00000000..66d2877c
--- /dev/null
+++ b/recipes-graphics/xorg-xserver/xserver-xorg/0006-glamor-Plumb-the-pixmap-through-fbo-creation-instead.patch
@@ -0,0 +1,265 @@
1From 3c14a16e1b4277aa00a2b23d5758d99dc20ca819 Mon Sep 17 00:00:00 2001
2From: Eric Anholt <eric@anholt.net>
3Date: Tue, 26 Mar 2019 16:57:24 -0700
4Subject: [PATCH 6/8] glamor: Plumb the pixmap through fbo creation instead of
5 a "format"
6
7For GLES, we're going to need a lot more logic for picking the
8iformat/format/type of texture setup, so we'll want the pixmap's depth
9and is_cbcr flag.
10
11Upstream-Status: Backport
12Signed-off-by: Eric Anholt <eric@anholt.net>
13---
14 glamor/glamor.c | 20 +++++++-------------
15 glamor/glamor_fbo.c | 33 +++++++++++++++++++--------------
16 glamor/glamor_picture.c | 2 +-
17 glamor/glamor_priv.h | 12 ++++++------
18 4 files changed, 33 insertions(+), 34 deletions(-)
19
20diff --git a/glamor/glamor.c b/glamor/glamor.c
21index c36b6ea74..f618c2128 100644
22--- a/glamor/glamor.c
23+++ b/glamor/glamor.c
24@@ -106,7 +106,6 @@ glamor_set_pixmap_texture(PixmapPtr pixmap, unsigned int tex)
25 glamor_pixmap_private *pixmap_priv;
26 glamor_screen_private *glamor_priv;
27 glamor_pixmap_fbo *fbo;
28- GLenum format;
29
30 glamor_priv = glamor_get_screen_private(screen);
31 pixmap_priv = glamor_get_pixmap_private(pixmap);
32@@ -116,9 +115,9 @@ glamor_set_pixmap_texture(PixmapPtr pixmap, unsigned int tex)
33 glamor_destroy_fbo(glamor_priv, fbo);
34 }
35
36- format = gl_iformat_for_pixmap(pixmap);
37- fbo = glamor_create_fbo_from_tex(glamor_priv, pixmap->drawable.width,
38- pixmap->drawable.height, format, tex, 0);
39+ fbo = glamor_create_fbo_from_tex(glamor_priv, pixmap,
40+ pixmap->drawable.width,
41+ pixmap->drawable.height, tex, 0);
42
43 if (fbo == NULL) {
44 ErrorF("XXX fail to create fbo.\n");
45@@ -204,7 +203,6 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
46 glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
47 glamor_pixmap_fbo *fbo = NULL;
48 int pitch;
49- GLenum format;
50
51 if (w > 32767 || h > 32767)
52 return NullPixmap;
53@@ -223,8 +221,6 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
54
55 pixmap_priv->is_cbcr = (usage == GLAMOR_CREATE_FORMAT_CBCR);
56
57- format = gl_iformat_for_pixmap(pixmap);
58-
59 pitch = (((w * pixmap->drawable.bitsPerPixel + 7) / 8) + 3) & ~3;
60 screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, pitch, NULL);
61
62@@ -238,12 +234,12 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
63 glamor_check_fbo_size(glamor_priv, w, h))
64 {
65 glamor_init_pixmap_private_small(pixmap, pixmap_priv);
66- fbo = glamor_create_fbo(glamor_priv, w, h, format, usage);
67+ fbo = glamor_create_fbo(glamor_priv, pixmap, w, h, usage);
68 } else {
69 int tile_size = glamor_priv->max_fbo_size;
70 DEBUGF("Create LARGE pixmap %p width %d height %d, tile size %d\n",
71 pixmap, w, h, tile_size);
72- fbo = glamor_create_fbo_array(glamor_priv, w, h, format, usage,
73+ fbo = glamor_create_fbo_array(glamor_priv, pixmap, usage,
74 tile_size, tile_size, pixmap_priv);
75 }
76
77@@ -860,8 +856,7 @@ _glamor_fds_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, int *fds,
78 switch (pixmap_priv->type) {
79 case GLAMOR_TEXTURE_DRM:
80 case GLAMOR_TEXTURE_ONLY:
81- if (!glamor_pixmap_ensure_fbo(pixmap, pixmap->drawable.depth == 30 ?
82- GL_RGB10_A2 : GL_RGBA, 0))
83+ if (!glamor_pixmap_ensure_fbo(pixmap, 0))
84 return 0;
85
86 if (modifier) {
87@@ -937,8 +932,7 @@ glamor_name_from_pixmap(PixmapPtr pixmap, CARD16 *stride, CARD32 *size)
88 switch (pixmap_priv->type) {
89 case GLAMOR_TEXTURE_DRM:
90 case GLAMOR_TEXTURE_ONLY:
91- if (!glamor_pixmap_ensure_fbo(pixmap, pixmap->drawable.depth == 30 ?
92- GL_RGB10_A2 : GL_RGBA, 0))
93+ if (!glamor_pixmap_ensure_fbo(pixmap, 0))
94 return -1;
95 return glamor_egl_fd_name_from_pixmap(pixmap->drawable.pScreen,
96 pixmap, stride, size);
97diff --git a/glamor/glamor_fbo.c b/glamor/glamor_fbo.c
98index 58eb97bf4..75f7e2baa 100644
99--- a/glamor/glamor_fbo.c
100+++ b/glamor/glamor_fbo.c
101@@ -95,8 +95,9 @@ glamor_pixmap_ensure_fb(glamor_screen_private *glamor_priv,
102
103 glamor_pixmap_fbo *
104 glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv,
105- int w, int h, Bool is_red, GLint tex, int flag)
106+ PixmapPtr pixmap, int w, int h, GLint tex, int flag)
107 {
108+ GLenum format = gl_iformat_for_pixmap(pixmap);
109 glamor_pixmap_fbo *fbo;
110
111 fbo = calloc(1, sizeof(*fbo));
112@@ -106,7 +107,7 @@ glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv,
113 fbo->tex = tex;
114 fbo->width = w;
115 fbo->height = h;
116- fbo->is_red = is_red;
117+ fbo->is_red = format == GL_RED;
118
119 if (flag != GLAMOR_CREATE_FBO_NO_FBO) {
120 if (glamor_pixmap_ensure_fb(glamor_priv, fbo) != 0) {
121@@ -120,13 +121,15 @@ glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv,
122
123 static int
124 _glamor_create_tex(glamor_screen_private *glamor_priv,
125- int w, int h, GLenum format)
126+ PixmapPtr pixmap, int w, int h)
127 {
128+ GLenum iformat = gl_iformat_for_pixmap(pixmap);
129+ GLenum format = iformat;
130 unsigned int tex;
131- GLenum iformat = format;
132
133 if (format == GL_RGB10_A2)
134 format = GL_RGBA;
135+
136 glamor_make_current(glamor_priv);
137 glGenTextures(1, &tex);
138 glBindTexture(GL_TEXTURE_2D, tex);
139@@ -156,14 +159,14 @@ _glamor_create_tex(glamor_screen_private *glamor_priv,
140
141 glamor_pixmap_fbo *
142 glamor_create_fbo(glamor_screen_private *glamor_priv,
143- int w, int h, GLenum format, int flag)
144+ PixmapPtr pixmap, int w, int h, int flag)
145 {
146- GLint tex = _glamor_create_tex(glamor_priv, w, h, format);
147+ GLint tex = _glamor_create_tex(glamor_priv, pixmap, w, h);
148
149 if (!tex) /* Texture creation failed due to GL_OUT_OF_MEMORY */
150 return NULL;
151
152- return glamor_create_fbo_from_tex(glamor_priv, w, h, format == GL_RED,
153+ return glamor_create_fbo_from_tex(glamor_priv, pixmap, w, h,
154 tex, flag);
155 }
156
157@@ -173,10 +176,12 @@ glamor_create_fbo(glamor_screen_private *glamor_priv,
158 */
159 glamor_pixmap_fbo *
160 glamor_create_fbo_array(glamor_screen_private *glamor_priv,
161- int w, int h, GLenum format, int flag,
162+ PixmapPtr pixmap, int flag,
163 int block_w, int block_h,
164 glamor_pixmap_private *priv)
165 {
166+ int w = pixmap->drawable.width;
167+ int h = pixmap->drawable.height;
168 int block_wcnt;
169 int block_hcnt;
170 glamor_pixmap_fbo **fbo_array;
171@@ -216,8 +221,8 @@ glamor_create_fbo_array(glamor_screen_private *glamor_priv,
172 box_array[i * block_wcnt + j].x2 - box_array[i * block_wcnt +
173 j].x1;
174 fbo_array[i * block_wcnt + j] = glamor_create_fbo(glamor_priv,
175+ pixmap,
176 fbo_w, fbo_h,
177- format,
178 GLAMOR_CREATE_PIXMAP_FIXUP);
179 if (fbo_array[i * block_wcnt + j] == NULL)
180 goto cleanup;
181@@ -315,7 +320,7 @@ glamor_pixmap_destroy_fbo(PixmapPtr pixmap)
182 }
183
184 Bool
185-glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag)
186+glamor_pixmap_ensure_fbo(PixmapPtr pixmap, int flag)
187 {
188 glamor_screen_private *glamor_priv;
189 glamor_pixmap_private *pixmap_priv;
190@@ -325,8 +330,8 @@ glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag)
191 pixmap_priv = glamor_get_pixmap_private(pixmap);
192 if (pixmap_priv->fbo == NULL) {
193
194- fbo = glamor_create_fbo(glamor_priv, pixmap->drawable.width,
195- pixmap->drawable.height, format, flag);
196+ fbo = glamor_create_fbo(glamor_priv, pixmap, pixmap->drawable.width,
197+ pixmap->drawable.height, flag);
198 if (fbo == NULL)
199 return FALSE;
200
201@@ -336,8 +341,8 @@ glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag)
202 /* We do have a fbo, but it may lack of fb or tex. */
203 if (!pixmap_priv->fbo->tex)
204 pixmap_priv->fbo->tex =
205- _glamor_create_tex(glamor_priv, pixmap->drawable.width,
206- pixmap->drawable.height, format);
207+ _glamor_create_tex(glamor_priv, pixmap, pixmap->drawable.width,
208+ pixmap->drawable.height);
209
210 if (flag != GLAMOR_CREATE_FBO_NO_FBO && pixmap_priv->fbo->fb == 0)
211 if (glamor_pixmap_ensure_fb(glamor_priv, pixmap_priv->fbo) != 0)
212diff --git a/glamor/glamor_picture.c b/glamor/glamor_picture.c
213index 685d8d618..e6d387d42 100644
214--- a/glamor/glamor_picture.c
215+++ b/glamor/glamor_picture.c
216@@ -340,7 +340,7 @@ glamor_upload_picture_to_texture(PicturePtr picture)
217 else
218 iformat = format;
219
220- if (!glamor_pixmap_ensure_fbo(pixmap, iformat, GLAMOR_CREATE_FBO_NO_FBO)) {
221+ if (!glamor_pixmap_ensure_fbo(pixmap, GLAMOR_CREATE_FBO_NO_FBO)) {
222 ret = FALSE;
223 goto fail;
224 }
225diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
226index e70d349da..a87caec9b 100644
227--- a/glamor/glamor_priv.h
228+++ b/glamor/glamor_priv.h
229@@ -531,11 +531,11 @@ glamor_pixmap_fbo *glamor_pixmap_detach_fbo(glamor_pixmap_private *
230 pixmap_priv);
231 void glamor_pixmap_attach_fbo(PixmapPtr pixmap, glamor_pixmap_fbo *fbo);
232 glamor_pixmap_fbo *glamor_create_fbo_from_tex(glamor_screen_private *
233- glamor_priv, int w, int h,
234- Bool is_red, GLint tex,
235+ glamor_priv, PixmapPtr pixmap,
236+ int w, int h, GLint tex,
237 int flag);
238-glamor_pixmap_fbo *glamor_create_fbo(glamor_screen_private *glamor_priv, int w,
239- int h, GLenum format, int flag);
240+glamor_pixmap_fbo *glamor_create_fbo(glamor_screen_private *glamor_priv,
241+ PixmapPtr pixmap, int w, int h, int flag);
242 void glamor_destroy_fbo(glamor_screen_private *glamor_priv,
243 glamor_pixmap_fbo *fbo);
244 void glamor_pixmap_destroy_fbo(PixmapPtr pixmap);
245@@ -563,7 +563,7 @@ void glamor_bind_texture(glamor_screen_private *glamor_priv,
246 Bool destination_red);
247
248 glamor_pixmap_fbo *glamor_create_fbo_array(glamor_screen_private *glamor_priv,
249- int w, int h, GLenum format,
250+ PixmapPtr pixmap,
251 int flag, int block_w, int block_h,
252 glamor_pixmap_private *);
253
254@@ -673,7 +673,7 @@ glamor_put_vbo_space(ScreenPtr screen);
255 * the fbo has valid texture and attach to a valid fb.
256 * If the fbo already has a valid glfbo then do nothing.
257 */
258-Bool glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag);
259+Bool glamor_pixmap_ensure_fbo(PixmapPtr pixmap, int flag);
260
261 glamor_pixmap_clipped_regions *
262 glamor_compute_clipped_regions(PixmapPtr pixmap,
263--
2642.17.1
265