mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 09:18:04 +02:00
vl/winsys: move dri3_get_screen_for_root to common
Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30984>
This commit is contained in:
parent
3d79e51726
commit
55341689c8
3 changed files with 18 additions and 15 deletions
|
|
@ -38,6 +38,7 @@ extern "C" {
|
|||
|
||||
#ifdef HAVE_X11_PLATFORM
|
||||
#include <X11/Xlib.h>
|
||||
#include <xcb/xcb.h>
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
|
|
@ -82,6 +83,8 @@ struct vl_screen
|
|||
};
|
||||
|
||||
#ifdef HAVE_X11_PLATFORM
|
||||
xcb_screen_t *
|
||||
vl_dri_get_screen_for_root(xcb_connection_t *conn, xcb_window_t root);
|
||||
uint32_t
|
||||
vl_dri2_format_for_depth(struct vl_screen *vscreen, int depth);
|
||||
|
||||
|
|
|
|||
|
|
@ -376,6 +376,20 @@ vl_dri2_format_for_depth(struct vl_screen *vscreen, int depth)
|
|||
}
|
||||
}
|
||||
|
||||
xcb_screen_t *
|
||||
vl_dri_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;
|
||||
}
|
||||
|
||||
#ifdef HAVE_X11_DRI2
|
||||
struct vl_screen *
|
||||
vl_dri2_screen_create(Display *display, int screen)
|
||||
|
|
|
|||
|
|
@ -552,20 +552,6 @@ 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_context *pipe,
|
||||
|
|
@ -828,7 +814,7 @@ vl_dri3_screen_create(Display *display, int screen)
|
|||
if (!geom_reply)
|
||||
goto close_fd;
|
||||
|
||||
scrn->base.xcb_screen = dri3_get_screen_for_root(scrn->conn, geom_reply->root);
|
||||
scrn->base.xcb_screen = vl_dri_get_screen_for_root(scrn->conn, geom_reply->root);
|
||||
if (!scrn->base.xcb_screen) {
|
||||
free(geom_reply);
|
||||
goto close_fd;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue