[Mesa-dev] [PATCH 3/3] auxiliary/vl/dri: call get_xcb_screen() only once
Emil Velikov
emil.l.velikov at gmail.com
Fri Nov 11 16:31:17 UTC 2016
From: Emil Velikov <emil.velikov at collabora.com>
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
src/gallium/auxiliary/vl/vl_winsys_dri.c | 8 ++++++--
1 file 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 9ecc216..0b2c939 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);
--
2.10.2
More information about the mesa-dev
mailing list