summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-01-23 10:21:09 -0800
committerEric Anholt <[email protected]>2014-01-27 09:37:10 -0800
commit7bd95ec437a5b1052fa17780a9d66677ec1fdc35 (patch)
treecc659c769fac23973a824df761852516f54f2807
parentbe7a6976a8335a2e1a177769e96f7310ca6770d1 (diff)
dri2: Trust our own driver name lookup over the server's.
This allows Mesa to choose to rename driver .sos (or split drivers), without needing a flag day with the corresponding 2D driver. v2: Undo the loader-only-for-dri3 change. Reviewed-by: Keith Packard <[email protected]> [v1] Reviewed-by: Kristian Høgsberg <[email protected]> [v1]
-rw-r--r--src/glx/Makefile.am2
-rw-r--r--src/glx/dri2_glx.c12
2 files changed, 12 insertions, 2 deletions
diff --git a/src/glx/Makefile.am b/src/glx/Makefile.am
index 69a6bf93da3..54a0cc027da 100644
--- a/src/glx/Makefile.am
+++ b/src/glx/Makefile.am
@@ -100,9 +100,9 @@ libglx_la_SOURCES = \
if HAVE_DRI3
libglx_la_SOURCES += \
dri3_glx.c
+endif
libglx_la_LIBADD = $(top_builddir)/src/loader/libloader.la
-endif
GL_LIBS = \
libglx.la \
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 4e2c16adf22..0a0dac98646 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -51,6 +51,7 @@
#include "dri2.h"
#include "dri_common.h"
#include "dri2_priv.h"
+#include "loader.h"
/* From xmlpool/options.h, user exposed so should be stable */
#define DRI_CONF_VBLANK_NEVER 0
@@ -1156,7 +1157,7 @@ dri2CreateScreen(int screen, struct glx_display * priv)
struct dri2_screen *psc;
__GLXDRIscreen *psp;
struct glx_config *configs = NULL, *visuals = NULL;
- char *driverName, *deviceName, *tmp;
+ char *driverName = NULL, *loader_driverName, *deviceName, *tmp;
drm_magic_t magic;
int i;
@@ -1193,6 +1194,15 @@ dri2CreateScreen(int screen, struct glx_display * priv)
goto handle_error;
}
+ /* If Mesa knows about the appropriate driver for this fd, then trust it.
+ * Otherwise, default to the server's value.
+ */
+ loader_driverName = loader_get_driver_for_fd(psc->fd, 0);
+ if (loader_driverName) {
+ free(driverName);
+ driverName = loader_driverName;
+ }
+
psc->driver = driOpenDriver(driverName);
if (psc->driver == NULL) {
ErrorMessageF("driver pointer missing\n");