diff options
author | Leo Liu <[email protected]> | 2018-09-10 15:33:28 -0400 |
---|---|---|
committer | Leo Liu <[email protected]> | 2018-09-13 14:28:32 -0400 |
commit | cd77d49ecfd185abef4cd1c6e69193c980815901 (patch) | |
tree | 6baaebec4c9f5957839919543e6e5e7ffb9b29b3 /src/gallium/auxiliary/vl | |
parent | 902358de4b9c55f4a5acdc75924c58755274679b (diff) |
vl/dri3: add support for 10 bits format
Signed-off-by: Leo Liu <[email protected]>
Reviewed-by: Michel Dänzer <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/vl')
-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; } |