mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 15:20:10 +01:00
egl/dri2: use the correct screen index
Required for multi-GPU configuration where each GPU has its own X screen.
This commit is contained in:
parent
1a428a5256
commit
0b56e23e7f
2 changed files with 30 additions and 10 deletions
|
|
@ -184,6 +184,7 @@ struct dri2_egl_display
|
|||
|
||||
#ifdef HAVE_X11_PLATFORM
|
||||
xcb_connection_t *conn;
|
||||
int screen;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WAYLAND_PLATFORM
|
||||
|
|
|
|||
|
|
@ -178,6 +178,17 @@ swrastGetImage(__DRIdrawable * read,
|
|||
}
|
||||
|
||||
|
||||
static xcb_screen_t *
|
||||
get_xcb_screen(xcb_screen_iterator_t iter, int screen)
|
||||
{
|
||||
for (; iter.rem; --screen, xcb_screen_next(&iter))
|
||||
if (screen == 0)
|
||||
return iter.data;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface().
|
||||
*/
|
||||
|
|
@ -214,7 +225,8 @@ dri2_x11_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
|
|||
dri2_surf->drawable = xcb_generate_id(dri2_dpy->conn);
|
||||
s = xcb_setup_roots_iterator(xcb_get_setup(dri2_dpy->conn));
|
||||
xcb_create_pixmap(dri2_dpy->conn, conf->BufferSize,
|
||||
dri2_surf->drawable, s.data->root,
|
||||
dri2_surf->drawable,
|
||||
get_xcb_screen(s, dri2_dpy->screen)->root,
|
||||
dri2_surf->base.Width, dri2_surf->base.Height);
|
||||
} else {
|
||||
dri2_surf->drawable = drawable;
|
||||
|
|
@ -515,9 +527,9 @@ dri2_x11_connect(struct dri2_egl_display *dri2_dpy)
|
|||
XCB_DRI2_MINOR_VERSION);
|
||||
|
||||
s = xcb_setup_roots_iterator(xcb_get_setup(dri2_dpy->conn));
|
||||
connect_cookie = xcb_dri2_connect_unchecked (dri2_dpy->conn,
|
||||
s.data->root,
|
||||
XCB_DRI2_DRIVER_TYPE_DRI);
|
||||
connect_cookie = xcb_dri2_connect_unchecked(dri2_dpy->conn,
|
||||
get_xcb_screen(s, dri2_dpy->screen)->root,
|
||||
XCB_DRI2_DRIVER_TYPE_DRI);
|
||||
|
||||
xfixes_query =
|
||||
xcb_xfixes_query_version_reply (dri2_dpy->conn,
|
||||
|
|
@ -581,7 +593,8 @@ dri2_x11_authenticate(_EGLDisplay *disp, uint32_t id)
|
|||
|
||||
s = xcb_setup_roots_iterator(xcb_get_setup(dri2_dpy->conn));
|
||||
authenticate_cookie =
|
||||
xcb_dri2_authenticate_unchecked(dri2_dpy->conn, s.data->root, id);
|
||||
xcb_dri2_authenticate_unchecked(dri2_dpy->conn,
|
||||
get_xcb_screen(s, dri2_dpy->screen)->root, id);
|
||||
authenticate =
|
||||
xcb_dri2_authenticate_reply(dri2_dpy->conn, authenticate_cookie, NULL);
|
||||
|
||||
|
|
@ -630,7 +643,7 @@ dri2_x11_add_configs_for_visuals(struct dri2_egl_display *dri2_dpy,
|
|||
};
|
||||
|
||||
s = xcb_setup_roots_iterator(xcb_get_setup(dri2_dpy->conn));
|
||||
d = xcb_screen_allowed_depths_iterator(s.data);
|
||||
d = xcb_screen_allowed_depths_iterator(get_xcb_screen(s, dri2_dpy->screen));
|
||||
id = 1;
|
||||
|
||||
surface_type =
|
||||
|
|
@ -1065,10 +1078,13 @@ dri2_initialize_x11_swrast(_EGLDriver *drv, _EGLDisplay *disp)
|
|||
|
||||
disp->DriverData = (void *) dri2_dpy;
|
||||
if (disp->PlatformDisplay == NULL) {
|
||||
dri2_dpy->conn = xcb_connect(0, 0);
|
||||
dri2_dpy->conn = xcb_connect(0, &dri2_dpy->screen);
|
||||
dri2_dpy->own_device = true;
|
||||
} else {
|
||||
dri2_dpy->conn = XGetXCBConnection((Display *) disp->PlatformDisplay);
|
||||
Display *dpy = disp->PlatformDisplay;
|
||||
|
||||
dri2_dpy->conn = XGetXCBConnection(dpy);
|
||||
dri2_dpy->screen = DefaultScreen(dpy);
|
||||
}
|
||||
|
||||
if (xcb_connection_has_error(dri2_dpy->conn)) {
|
||||
|
|
@ -1185,10 +1201,13 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp)
|
|||
|
||||
disp->DriverData = (void *) dri2_dpy;
|
||||
if (disp->PlatformDisplay == NULL) {
|
||||
dri2_dpy->conn = xcb_connect(0, 0);
|
||||
dri2_dpy->conn = xcb_connect(0, &dri2_dpy->screen);
|
||||
dri2_dpy->own_device = true;
|
||||
} else {
|
||||
dri2_dpy->conn = XGetXCBConnection((Display *) disp->PlatformDisplay);
|
||||
Display *dpy = disp->PlatformDisplay;
|
||||
|
||||
dri2_dpy->conn = XGetXCBConnection(dpy);
|
||||
dri2_dpy->screen = DefaultScreen(dpy);
|
||||
}
|
||||
|
||||
if (xcb_connection_has_error(dri2_dpy->conn)) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue