Commit 319af6f4 authored by Nicolai Hähnle's avatar Nicolai Hähnle Committed by Adam Jackson
Browse files

glx: honor LIBGL_DRIVERS_PATH when loading DRI drivers

Allow switching to another driver build without a full installation.

Glamor already takes LIBGL_DRIVERS_PATH into account, so this change
makes sure that the same driver is used in both parts of the server.

Signed-off-by: default avatarNicolai Hähnle <>
Reviewed-by: Ben Crocker's avatarBen Crocker <>
Reviewed-by: Antoine Martin's avatarAntoine Martin <>
Tested-by: Ben Crocker's avatarBen Crocker <>
parent 75a869a4
......@@ -272,14 +272,44 @@ glxProbeDriver(const char *driverName,
char filename[PATH_MAX];
char *get_extensions_name;
const __DRIextension **extensions = NULL;
const char *path = NULL;
/* Search in LIBGL_DRIVERS_PATH if we're not setuid. */
if (!PrivsElevated())
path = getenv("LIBGL_DRIVERS_PATH");
if (!path)
path = dri_driver_path;
do {
const char *next;
int path_len;
next = strchr(path, ':');
if (next) {
path_len = next - path;
} else {
path_len = strlen(path);
next = NULL;
snprintf(filename, sizeof filename, "%s/",
dri_driver_path, driverName);
snprintf(filename, sizeof filename, "%.*s/", path_len, path,
driver = dlopen(filename, RTLD_LAZY | RTLD_LOCAL);
if (driver != NULL)
driver = dlopen(filename, RTLD_LAZY | RTLD_LOCAL);
if (driver == NULL) {
LogMessage(X_ERROR, "AIGLX error: dlopen of %s failed (%s)\n",
filename, dlerror());
path = next;
} while (path);
if (driver == NULL) {
LogMessage(X_ERROR, "AIGLX error: unable to load driver %s\n",
goto cleanup_failure;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment