[PATCH xserver 5/5] glamor: Use GL_RGBA format for 8-bit depth
Olivier Fourdan
ofourdan at redhat.com
Thu Apr 20 15:35:44 UTC 2017
For some hardware, GL_RGBA is the safest option for textures to bind to
an FBO for depth 8 as GL_ALPHA might be unsupported.
This allows using glamor-xv on hardware that don't support GL_ALPHA
textures attaching to an FBO, such as nouveau on nv30.
Newer hardware use GL_RED and texture swizzle anyway, so this change is
of limited impact.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100710
---
glamor/glamor.c | 2 ++
glamor/glamor_priv.h | 1 +
glamor/glamor_utils.h | 11 ++++++-----
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/glamor/glamor.c b/glamor/glamor.c
index 2467443..f5fbed1 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -659,9 +659,11 @@ glamor_init(ScreenPtr screen, unsigned int flags)
(glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP && gl_version >= 30));
glamor_priv->one_channel_format = GL_ALPHA;
+ glamor_priv->eight_bit_channel_format = GL_RGBA;
if (epoxy_has_gl_extension("GL_ARB_texture_rg") &&
glamor_priv->has_texture_swizzle) {
glamor_priv->one_channel_format = GL_RED;
+ glamor_priv->eight_bit_channel_format = GL_RED;
}
glamor_set_debug_level(&glamor_debug_level);
diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index 66a870f..28166ea 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -205,6 +205,7 @@ typedef struct glamor_screen_private {
int max_fbo_size;
GLuint one_channel_format;
+ GLuint eight_bit_channel_format;
/* glamor point shader */
glamor_program point_prog;
diff --git a/glamor/glamor_utils.h b/glamor/glamor_utils.h
index 6b88527..1b84499 100644
--- a/glamor/glamor_utils.h
+++ b/glamor/glamor_utils.h
@@ -620,12 +620,13 @@ gl_iformat_for_pixmap(PixmapPtr pixmap)
glamor_screen_private *glamor_priv =
glamor_get_screen_private((pixmap)->drawable.pScreen);
- if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP &&
- ((pixmap)->drawable.depth == 1 || (pixmap)->drawable.depth == 8)) {
- return glamor_priv->one_channel_format;
- } else {
- return GL_RGBA;
+ if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
+ if ((pixmap)->drawable.depth == 1)
+ return glamor_priv->one_channel_format;
+ if ((pixmap)->drawable.depth == 8)
+ return glamor_priv->eight_bit_channel_format;
}
+ return GL_RGBA;
}
static inline CARD32
--
2.9.3
More information about the xorg-devel
mailing list