gallium/pipe: Add a GALLIUM_PIPE_SEARCH_DIR override env var

This can be useful if you rsync an install between two machines and the
paths don't perfectly match up.  OpenGL drivers already work fine but
anything which uses pipe-loader has a compile-time path.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7047>
This commit is contained in:
Jason Ekstrand
2020-08-18 11:59:19 -05:00
parent 1d3600c156
commit 449f1fee9e
3 changed files with 13 additions and 2 deletions

View File

@@ -391,6 +391,9 @@ Gallium environment variables
``GALLIUM_LOG_FILE``
specifies a file for logging all errors, warnings, etc. rather than
stderr.
``GALLIUM_PIPE_SEARCH_DIR``
specifies an alternate search directory for pipe-loader which overrides
the compile-time path based on the install location.
``GALLIUM_PRINT_OPTIONS``
if non-zero, print all the Gallium environment variables which are
used, and their current values.

View File

@@ -98,7 +98,11 @@ get_driver_descriptor(const char *driver_name, struct util_dl_library **plib)
}
return &kmsro_driver_descriptor;
#else
*plib = pipe_loader_find_module(driver_name, PIPE_SEARCH_DIR);
const char *search_dir = getenv("GALLIUM_PIPE_SEARCH_DIR");
if (search_dir == NULL)
search_dir = PIPE_SEARCH_DIR;
*plib = pipe_loader_find_module(driver_name, search_dir);
if (!*plib)
return NULL;

View File

@@ -105,7 +105,11 @@ pipe_loader_sw_probe_init_common(struct pipe_loader_sw_device *sdev)
if (!sdev->dd)
return false;
#else
sdev->lib = pipe_loader_find_module("swrast", PIPE_SEARCH_DIR);
const char *search_dir = getenv("GALLIUM_PIPE_SEARCH_DIR");
if (search_dir == NULL)
search_dir = PIPE_SEARCH_DIR;
sdev->lib = pipe_loader_find_module("swrast", search_dir);
if (!sdev->lib)
return false;