From: Emil Velikov Date: Wed, 29 Jul 2015 16:19:06 +0000 (+0100) Subject: egl/x11: trust our loader over the xserver for the drivername X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=45e110bad9d5d31eb67d7d32937aa5a752108df8;p=mesa.git egl/x11: trust our loader over the xserver for the drivername This is a port of commit 7bd95ec437a(dri2: Trust our own driver name lookup over the server's.) from glx/dri2. v2: Add newline between code and multiline comment. (Matt) Cc: Julien Isorce Reported-by: Julien Isorce Signed-off-by: Emil Velikov Acked-by: Alex Deucher Reviewed-by: Eric Anholt --- diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index 745e16a6cc1..a251694b873 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -519,7 +519,7 @@ dri2_x11_connect(struct dri2_egl_display *dri2_dpy) xcb_generic_error_t *error; xcb_screen_iterator_t s; xcb_screen_t *screen; - char *driver_name, *device_name; + char *driver_name, *loader_driver_name, *device_name; const xcb_query_extension_reply_t *extension; xcb_prefetch_extension_data (dri2_dpy->conn, &xcb_xfixes_id); @@ -596,6 +596,16 @@ dri2_x11_connect(struct dri2_egl_display *dri2_dpy) } driver_name = xcb_dri2_connect_driver_name (connect); + + /* If Mesa knows about the appropriate driver for this fd, then trust it. + * Otherwise, default to the server's value. + */ + loader_driver_name = loader_get_driver_for_fd(dri2_dpy->fd, 0); + if (loader_driver_name) { + free(driver_name); + driver_name = loader_driver_name; + } + dri2_dpy->driver_name = strndup(driver_name, xcb_dri2_connect_driver_name_length(connect));