diff options
author | Emil Velikov <[email protected]> | 2016-11-21 13:46:52 +0000 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2016-11-22 15:13:41 +0000 |
commit | 29c8a4a4cec1e7eb31df4a7218f2bd09854a8374 (patch) | |
tree | a3d8f855cc7bba570ea3883bb92aed87c3d2544a /src/gallium | |
parent | 7c6babb22c83d0cde747ec57c5ceb3c9e037c626 (diff) |
auxiliary/vl/dri: call get_xcb_screen() only once
Signed-off-by: Emil Velikov <[email protected]>
Reviewed-by: Eric Engestrom <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/auxiliary/vl/vl_winsys_dri.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri.c b/src/gallium/auxiliary/vl/vl_winsys_dri.c index 9ecc216b9c5..0b2c939389a 100644 --- a/src/gallium/auxiliary/vl/vl_winsys_dri.c +++ b/src/gallium/auxiliary/vl/vl_winsys_dri.c @@ -326,6 +326,7 @@ vl_dri2_screen_create(Display *display, int screen) xcb_dri2_authenticate_cookie_t authenticate_cookie; xcb_dri2_authenticate_reply_t *authenticate = NULL; xcb_screen_iterator_t s; + xcb_screen_t *xcb_screen; xcb_generic_error_t *error = NULL; char *device_name; int fd, device_name_length; @@ -357,6 +358,9 @@ vl_dri2_screen_create(Display *display, int screen) goto free_query; s = xcb_setup_roots_iterator(xcb_get_setup(scrn->conn)); + xcb_screen = get_xcb_screen(s, screen); + if (!xcb_screen) + goto free_query; driverType = XCB_DRI2_DRIVER_TYPE_DRI; #ifdef DRI2DriverPrimeShift @@ -374,7 +378,7 @@ vl_dri2_screen_create(Display *display, int screen) #endif connect_cookie = xcb_dri2_connect_unchecked(scrn->conn, - get_xcb_screen(s, screen)->root, + xcb_screen->root, driverType); connect = xcb_dri2_connect_reply(scrn->conn, connect_cookie, NULL); if (connect == NULL || @@ -396,7 +400,7 @@ vl_dri2_screen_create(Display *display, int screen) goto close_fd; authenticate_cookie = xcb_dri2_authenticate_unchecked(scrn->conn, - get_xcb_screen(s, screen)->root, + xcb_screen->root, magic); authenticate = xcb_dri2_authenticate_reply(scrn->conn, authenticate_cookie, NULL); |