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) ?
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;
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,
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;
}