aboutsummaryrefslogtreecommitdiffstats
path: root/src/loader/loader.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2017-02-03 11:02:59 -0800
committerEric Anholt <[email protected]>2017-02-06 12:44:06 -0800
commit3f462050c29dc29139732987c9c9ef9a670133ab (patch)
tree65d8628a257ed358e2ab2750bdaa86c1d072465d /src/loader/loader.c
parent61bb1a9795e80501e9000d423d5cc5310b77e65b (diff)
loader: Add an environment variable to override driver name choice.
My vc4 simulator has been implemented so far by having an entrypoint claiming to be i965, which was a bit gross. The simulator would be a lot less special if we entered through the vc4 entrypoint like normal, so add a loader environment variable to allow the i965 fd to probe as vc4. Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/loader/loader.c')
-rw-r--r--src/loader/loader.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/loader/loader.c b/src/loader/loader.c
index 449ff54d137..4825151ad5e 100644
--- a/src/loader/loader.c
+++ b/src/loader/loader.c
@@ -345,6 +345,17 @@ loader_get_driver_for_fd(int fd)
int vendor_id, chip_id, i, j;
char *driver = NULL;
+ /* Allow an environment variable to force choosing a different driver
+ * binary. If that driver binary can't survive on this FD, that's the
+ * user's problem, but this allows vc4 simulator to run on an i965 host,
+ * and may be useful for some touch testing of i915 on an i965 host.
+ */
+ if (geteuid() == getuid()) {
+ driver = getenv("MESA_LOADER_DRIVER_OVERRIDE");
+ if (driver)
+ return strdup(driver);
+ }
+
if (!loader_get_pci_id_for_fd(fd, &vendor_id, &chip_id)) {
#if HAVE_LIBDRM