diff options
-rw-r--r-- | src/gallium/auxiliary/vl/vl_winsys_dri3.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri3.c b/src/gallium/auxiliary/vl/vl_winsys_dri3.c index 8e3c4a0e04d..30e732e38eb 100644 --- a/src/gallium/auxiliary/vl/vl_winsys_dri3.c +++ b/src/gallium/auxiliary/vl/vl_winsys_dri3.c @@ -238,7 +238,7 @@ dri3_alloc_back_buffer(struct vl_dri3_screen *scrn) memset(&templ, 0, sizeof(templ)); templ.bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW; - templ.format = PIPE_FORMAT_B8G8R8X8_UNORM; + templ.format = vl_dri2_format_for_depth(&scrn->base, scrn->depth); templ.target = PIPE_TEXTURE_2D; templ.last_level = 0; templ.width0 = (scrn->output_texture) ? @@ -497,7 +497,7 @@ dri3_get_front_buffer(struct vl_dri3_screen *scrn) whandle.stride = bp_reply->stride; memset(&templ, 0, sizeof(templ)); templ.bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW; - templ.format = PIPE_FORMAT_B8G8R8X8_UNORM; + templ.format = vl_dri2_format_for_depth(&scrn->base, bp_reply->depth); templ.target = PIPE_TEXTURE_2D; templ.last_level = 0; templ.width0 = bp_reply->width; @@ -539,6 +539,20 @@ free_buffer: return NULL; } +static xcb_screen_t * +dri3_get_screen_for_root(xcb_connection_t *conn, xcb_window_t root) +{ + xcb_screen_iterator_t screen_iter = + xcb_setup_roots_iterator(xcb_get_setup(conn)); + + for (; screen_iter.rem; xcb_screen_next (&screen_iter)) { + if (screen_iter.data->root == root) + return screen_iter.data; + } + + return NULL; +} + static void vl_dri3_flush_frontbuffer(struct pipe_screen *screen, struct pipe_resource *resource, @@ -809,8 +823,15 @@ vl_dri3_screen_create(Display *display, int screen) geom_reply = xcb_get_geometry_reply(scrn->conn, geom_cookie, NULL); if (!geom_reply) goto close_fd; - /* TODO support depth other than 24 */ - if (geom_reply->depth != 24) { + + scrn->base.xcb_screen = dri3_get_screen_for_root(scrn->conn, geom_reply->root); + if (!scrn->base.xcb_screen) { + free(geom_reply); + goto close_fd; + } + + /* TODO support depth other than 24 or 30 */ + if (geom_reply->depth != 24 && geom_reply->depth != 30) { free(geom_reply); goto close_fd; } |