From 449f1fee9e921fac4741f32d046693b536bd7563 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Tue, 18 Aug 2020 11:59:19 -0500 Subject: [PATCH] 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 Reviewed-by: Francisco Jerez Part-of: --- docs/envvars.rst | 3 +++ src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c | 6 +++++- src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c | 6 +++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/envvars.rst b/docs/envvars.rst index 08cbea2..aab4646 100644 --- a/docs/envvars.rst +++ b/docs/envvars.rst @@ -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. diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c index 92bc821..0f227c3 100644 --- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c +++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c @@ -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; diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c index 6c71447..5afca2b 100644 --- a/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c +++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c @@ -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; -- 2.7.4