Signed-off-by: Leo Liu <leo....@amd.com>
---
 src/gallium/auxiliary/vl/vl_winsys_dri.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri.c 
b/src/gallium/auxiliary/vl/vl_winsys_dri.c
index bb1ff50488..f3ae788f72 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_dri.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_dri.c
@@ -237,7 +237,15 @@ vl_dri2_screen_texture_from_drawable(struct vl_screen 
*vscreen, void *drawable)
 
    memset(&templ, 0, sizeof(templ));
    templ.target = PIPE_TEXTURE_2D;
-   templ.format = PIPE_FORMAT_B8G8R8X8_UNORM;
+   if (vscreen->color_depth == 24)
+      templ.format = PIPE_FORMAT_B8G8R8X8_UNORM;
+   else if (vscreen->color_depth == 30)
+      templ.format = PIPE_FORMAT_B10G10R10X2_UNORM;
+   else {
+      free(reply);
+      return NULL;
+   }
+
    templ.last_level = 0;
    templ.width0 = reply->width;
    templ.height0 = reply->height;
@@ -411,6 +419,7 @@ vl_dri2_screen_create(Display *display, int screen)
    if (!scrn->base.pscreen)
       goto release_pipe;
 
+   scrn->base.color_depth = xcb_screen->root_depth;
    scrn->base.destroy = vl_dri2_screen_destroy;
    scrn->base.texture_from_drawable = vl_dri2_screen_texture_from_drawable;
    scrn->base.get_dirty_area = vl_dri2_screen_get_dirty_area;
-- 
2.17.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to