Mesa (master): egl/x11: pick the user requested screen
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jun 5 17:35:55 UTC 2019
Module: Mesa
Branch: master
Commit: 4aebd86f9a1b0db0ebcc69c30c00f0981a28e6a6
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4aebd86f9a1b0db0ebcc69c30c00f0981a28e6a6
Author: Adam Jackson <ajax at redhat.com>
Date: Thu May 16 18:01:35 2019 +0100
egl/x11: pick the user requested screen
At the moment the user will pass the screen number via attribs, yet we
would throw that away. Reason being that the int *screen passed to
xcb_connect() is output only.
v2 (Emil):
- split from a larger patch
- use xcb_connect() returned screen, as fallback
- use helper function only as needed
Reviewed-by: Mathias Fröhlich <Mathias.Froehlich at web.de>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
Signed-off-by: Marek Olšák <marek.olsak at amd.com>
---
src/egl/drivers/dri2/platform_x11.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index 1d5efc0126d..538cffd6a76 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -1277,21 +1277,34 @@ static const __DRIextension *swrast_loader_extensions[] = {
NULL,
};
+static int
+dri2_find_screen_for_display(const _EGLDisplay *disp, int fallback_screen)
+{
+ const EGLAttrib *attr;
+
+ for (attr = disp->Options.Attribs; attr; attr += 2) {
+ if (attr[0] == EGL_PLATFORM_X11_SCREEN_EXT)
+ return attr[1];
+ }
+
+ return fallback_screen;
+}
+
static EGLBoolean
dri2_get_xcb_connection(_EGLDriver *drv, _EGLDisplay *disp,
struct dri2_egl_display *dri2_dpy)
{
xcb_screen_iterator_t s;
- int screen = (uintptr_t)disp->Options.Platform;
+ int screen;
const char *msg;
disp->DriverData = (void *) dri2_dpy;
if (disp->PlatformDisplay == NULL) {
dri2_dpy->conn = xcb_connect(NULL, &screen);
dri2_dpy->own_device = true;
+ screen = dri2_find_screen_for_display(disp, screen);
} else {
Display *dpy = disp->PlatformDisplay;
-
dri2_dpy->conn = XGetXCBConnection(dpy);
screen = DefaultScreen(dpy);
}
More information about the mesa-commit
mailing list