summaryrefslogtreecommitdiffstats
path: root/recipes-graphics/xorg-xserver/xserver-xorg/0005-glamor-Stop-trying-to-store-the-pixmap-s-format-in-g.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-graphics/xorg-xserver/xserver-xorg/0005-glamor-Stop-trying-to-store-the-pixmap-s-format-in-g.patch')
-rw-r--r--recipes-graphics/xorg-xserver/xserver-xorg/0005-glamor-Stop-trying-to-store-the-pixmap-s-format-in-g.patch132
1 files changed, 132 insertions, 0 deletions
diff --git a/recipes-graphics/xorg-xserver/xserver-xorg/0005-glamor-Stop-trying-to-store-the-pixmap-s-format-in-g.patch b/recipes-graphics/xorg-xserver/xserver-xorg/0005-glamor-Stop-trying-to-store-the-pixmap-s-format-in-g.patch
new file mode 100644
index 00000000..9a0aa7ab
--- /dev/null
+++ b/recipes-graphics/xorg-xserver/xserver-xorg/0005-glamor-Stop-trying-to-store-the-pixmap-s-format-in-g.patch
@@ -0,0 +1,132 @@
1From 2498f6712c3b551c4d8104628aff78246b5cd6c8 Mon Sep 17 00:00:00 2001
2From: Eric Anholt <eric@anholt.net>
3Date: Tue, 26 Mar 2019 15:58:59 -0700
4Subject: [PATCH 5/8] glamor: Stop trying to store the pixmap's "format" in
5 glamor_pixmap_fbo.
6
7"format" is a bit of a confused term (internalformat vs GL format),
8and all we really needed was "is this GL_RED?"
9
10Upstream-Status: Backport
11Signed-off-by: Eric Anholt <eric@anholt.net>
12---
13 glamor/glamor.c | 3 +--
14 glamor/glamor_fbo.c | 7 ++++---
15 glamor/glamor_priv.h | 13 ++-----------
16 glamor/glamor_render.c | 2 +-
17 glamor/glamor_transfer.c | 2 +-
18 5 files changed, 9 insertions(+), 18 deletions(-)
19
20diff --git a/glamor/glamor.c b/glamor/glamor.c
21index 3e9cf284c..c36b6ea74 100644
22--- a/glamor/glamor.c
23+++ b/glamor/glamor.c
24@@ -184,8 +184,7 @@ glamor_bind_texture(glamor_screen_private *glamor_priv, GLenum texture,
25 /* Is the operand a GL_RED fbo?
26 */
27
28- if (glamor_fbo_red_is_alpha(glamor_priv, fbo)) {
29-
30+ if (fbo->is_red) {
31 /* If destination is also GL_RED, then preserve the bits in
32 * the R channel */
33
34diff --git a/glamor/glamor_fbo.c b/glamor/glamor_fbo.c
35index f939a6c2f..58eb97bf4 100644
36--- a/glamor/glamor_fbo.c
37+++ b/glamor/glamor_fbo.c
38@@ -95,7 +95,7 @@ glamor_pixmap_ensure_fb(glamor_screen_private *glamor_priv,
39
40 glamor_pixmap_fbo *
41 glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv,
42- int w, int h, GLenum format, GLint tex, int flag)
43+ int w, int h, Bool is_red, GLint tex, int flag)
44 {
45 glamor_pixmap_fbo *fbo;
46
47@@ -106,7 +106,7 @@ glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv,
48 fbo->tex = tex;
49 fbo->width = w;
50 fbo->height = h;
51- fbo->format = format;
52+ fbo->is_red = is_red;
53
54 if (flag != GLAMOR_CREATE_FBO_NO_FBO) {
55 if (glamor_pixmap_ensure_fb(glamor_priv, fbo) != 0) {
56@@ -163,7 +163,8 @@ glamor_create_fbo(glamor_screen_private *glamor_priv,
57 if (!tex) /* Texture creation failed due to GL_OUT_OF_MEMORY */
58 return NULL;
59
60- return glamor_create_fbo_from_tex(glamor_priv, w, h, format, tex, flag);
61+ return glamor_create_fbo_from_tex(glamor_priv, w, h, format == GL_RED,
62+ tex, flag);
63 }
64
65 /**
66diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
67index a14aaf624..e70d349da 100644
68--- a/glamor/glamor_priv.h
69+++ b/glamor/glamor_priv.h
70@@ -317,8 +317,7 @@ typedef struct glamor_pixmap_fbo {
71 GLuint fb; /**< GL FBO name */
72 int width; /**< width in pixels */
73 int height; /**< height in pixels */
74- GLenum format; /**< GL format used to create the texture. */
75- GLenum type; /**< GL type used to create the texture. */
76+ Bool is_red;
77 } glamor_pixmap_fbo;
78
79 typedef struct glamor_pixmap_clipped_regions {
80@@ -533,7 +532,7 @@ glamor_pixmap_fbo *glamor_pixmap_detach_fbo(glamor_pixmap_private *
81 void glamor_pixmap_attach_fbo(PixmapPtr pixmap, glamor_pixmap_fbo *fbo);
82 glamor_pixmap_fbo *glamor_create_fbo_from_tex(glamor_screen_private *
83 glamor_priv, int w, int h,
84- GLenum format, GLint tex,
85+ Bool is_red, GLint tex,
86 int flag);
87 glamor_pixmap_fbo *glamor_create_fbo(glamor_screen_private *glamor_priv, int w,
88 int h, GLenum format, int flag);
89@@ -549,14 +548,6 @@ static inline Bool glamor_picture_is_alpha(PicturePtr picture)
90 return picture->format == PICT_a1 || picture->format == PICT_a8;
91 }
92
93-/* Return whether 'fbo' is storing alpha bits in the red channel */
94-static inline Bool
95-glamor_fbo_red_is_alpha(glamor_screen_private *glamor_priv, glamor_pixmap_fbo *fbo)
96-{
97- /* True when the format is GL_RED (that can only happen when our one channel format is GL_RED */
98- return fbo->format == GL_RED;
99-}
100-
101 /* Return whether 'picture' is storing alpha bits in the red channel */
102 static inline Bool
103 glamor_picture_red_is_alpha(PicturePtr picture)
104diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c
105index d5737018f..6db6bfbc3 100644
106--- a/glamor/glamor_render.c
107+++ b/glamor/glamor_render.c
108@@ -529,7 +529,7 @@ glamor_set_composite_texture(glamor_screen_private *glamor_priv, int unit,
109 * sometimes get zero bits in the R channel, which is harmless.
110 */
111 glamor_bind_texture(glamor_priv, GL_TEXTURE0 + unit, fbo,
112- glamor_fbo_red_is_alpha(glamor_priv, dest_priv->fbo));
113+ dest_priv->fbo->is_red);
114 repeat_type = picture->repeatType;
115 switch (picture->repeatType) {
116 case RepeatNone:
117diff --git a/glamor/glamor_transfer.c b/glamor/glamor_transfer.c
118index 421ed3a5f..215752d7b 100644
119--- a/glamor/glamor_transfer.c
120+++ b/glamor/glamor_transfer.c
121@@ -40,7 +40,7 @@ glamor_format_for_pixmap(PixmapPtr pixmap, GLenum *format, GLenum *type)
122 break;
123 case 16:
124 if (priv->is_cbcr) {
125- *format = priv->fbo->format;
126+ *format = GL_RG;
127 *type = GL_UNSIGNED_BYTE;
128 } else {
129 *format = GL_RGB;
130--
1312.17.1
132