[PATCH xserver 2/7] glamor: Fix loose ends in color depth 30 support.
Mario Kleiner
mario.kleiner.de at gmail.com
Tue Feb 20 04:06:29 UTC 2018
This makes it work properly with OpenGL based desktop
compositing, as tested with EGL and GLX based compositing
under OpenGL-2/3, and also artifact free with XRender
based 2D compositing.
Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com>
Reviewed-by: Eric Anholt <eric at anholt.net>
---
glamor/glamor.c | 6 ++++--
glamor/glamor_copy.c | 9 +++++++++
glamor/glamor_egl.c | 3 ++-
3 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/glamor/glamor.c b/glamor/glamor.c
index 4a41fe7..d61e275 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -805,7 +805,8 @@ glamor_fd_from_pixmap(ScreenPtr screen,
switch (pixmap_priv->type) {
case GLAMOR_TEXTURE_DRM:
case GLAMOR_TEXTURE_ONLY:
- if (!glamor_pixmap_ensure_fbo(pixmap, GL_RGBA, 0))
+ if (!glamor_pixmap_ensure_fbo(pixmap, pixmap->drawable.depth == 30 ?
+ GL_RGB10_A2 : GL_RGBA, 0))
return -1;
return glamor_egl_dri3_fd_name_from_tex(screen,
pixmap,
@@ -845,7 +846,8 @@ glamor_name_from_pixmap(PixmapPtr pixmap, CARD16 *stride, CARD32 *size)
switch (pixmap_priv->type) {
case GLAMOR_TEXTURE_DRM:
case GLAMOR_TEXTURE_ONLY:
- if (!glamor_pixmap_ensure_fbo(pixmap, GL_RGBA, 0))
+ if (!glamor_pixmap_ensure_fbo(pixmap, pixmap->drawable.depth == 30 ?
+ GL_RGB10_A2 : GL_RGBA, 0))
return -1;
return glamor_egl_dri3_fd_name_from_tex(pixmap->drawable.pScreen,
pixmap,
diff --git a/glamor/glamor_copy.c b/glamor/glamor_copy.c
index bd4a0e2..e050c02 100644
--- a/glamor/glamor_copy.c
+++ b/glamor/glamor_copy.c
@@ -78,6 +78,15 @@ use_copyplane(PixmapPtr dst, GCPtr gc, glamor_program *prog, void *arg)
/* XXX handle 2 10 10 10 and 1555 formats; presumably the pixmap private knows this? */
switch (args->src_pixmap->drawable.depth) {
+ case 30:
+ glUniform4ui(prog->bitplane_uniform,
+ (args->bitplane >> 20) & 0x3ff,
+ (args->bitplane >> 10) & 0x3ff,
+ (args->bitplane ) & 0x3ff,
+ 0);
+
+ glUniform4f(prog->bitmul_uniform, 0x3ff, 0x3ff, 0x3ff, 0);
+ break;
case 24:
glUniform4ui(prog->bitplane_uniform,
(args->bitplane >> 16) & 0xff,
diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index 202b83e..eb5e68b 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -270,7 +270,8 @@ glamor_make_pixmap_exportable(PixmapPtr pixmap)
}
bo = gbm_bo_create(glamor_egl->gbm, width, height,
- GBM_FORMAT_ARGB8888,
+ (pixmap->drawable.depth == 30) ?
+ GBM_FORMAT_ARGB2101010 : GBM_FORMAT_ARGB8888,
#ifdef GLAMOR_HAS_GBM_LINEAR
(pixmap->usage_hint == CREATE_PIXMAP_USAGE_SHARED ?
GBM_BO_USE_LINEAR : 0) |
--
2.7.4
More information about the xorg-devel
mailing list