summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2014-08-20 00:34:18 +0200
committerMarek Olšák <[email protected]>2014-09-01 20:09:19 +0200
commitbba7d29a86862df89f43b682be674c33326fa248 (patch)
tree3c569995259e3bcfbcefc305c0ff8b0650ad76fd
parent0b56e23e7f3d5852a90e965b2958fd446270a7f8 (diff)
pipe-loader: use the correct screen index
-rw-r--r--src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
index 88056f50051..f531dbf1dab 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
@@ -63,6 +63,20 @@ struct pipe_loader_drm_device {
static struct pipe_loader_ops pipe_loader_drm_ops;
+#ifdef HAVE_PIPE_LOADER_XCB
+
+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;
+}
+
+#endif
+
static void
pipe_loader_drm_x_auth(int fd)
{
@@ -77,8 +91,9 @@ pipe_loader_drm_x_auth(int fd)
drm_magic_t magic;
xcb_dri2_authenticate_cookie_t authenticate_cookie;
xcb_dri2_authenticate_reply_t *authenticate;
+ int screen;
- xcb_conn = xcb_connect(NULL, NULL);
+ xcb_conn = xcb_connect(NULL, &screen);
if(!xcb_conn)
return;
@@ -89,7 +104,8 @@ pipe_loader_drm_x_auth(int fd)
goto disconnect;
s = xcb_setup_roots_iterator(xcb_setup);
- connect_cookie = xcb_dri2_connect_unchecked(xcb_conn, s.data->root,
+ connect_cookie = xcb_dri2_connect_unchecked(xcb_conn,
+ get_xcb_screen(s, screen)->root,
XCB_DRI2_DRIVER_TYPE_DRI);
connect = xcb_dri2_connect_reply(xcb_conn, connect_cookie, NULL);