path: root/src/loader/loader.h
diff options
authorAxel Davy <>2014-06-08 19:42:15 -0400
committerDave Airlie <>2014-07-01 13:07:30 +1000
commit7ab925a6aafca106e7682dfc21e7c9351380809e (patch)
tree01e2e62886c3612222af0bf53a546f5748537922 /src/loader/loader.h
parentda3a47d6824b63621a7d865112558a6e8026688b (diff)
loader: add gpu selection code via DRI_PRIME.
v2: Fix the leak of device_name v3: Rebased It enables to use the DRI_PRIME env var to specify which gpu to use. Two syntax are supported: If DRI_PRIME is 1 it means: take any other gpu than the default one. If DRI_PRIME is the ID_PATH_TAG of a device: choose this device if possible. The ID_PATH_TAG is a tag filled by udev. You can check it with 'udevadm info' on the device node. For example it can be "pci-0000_01_00_0". Render-nodes need to be enabled to choose another gpu, and they need to have the ID_PATH_TAG advertised. It is possible for not very recent udev that the tag is not advertised for render-nodes, then ones need to add a file containing: SUBSYSTEM=="drm", IMPORT{builtin}="path_id" in /etc/udev/rules.d/ Signed-off-by: Axel Davy <> Reviewed-by: Emil Velikov <> Signed-off-by: Dave Airlie <>
Diffstat (limited to 'src/loader/loader.h')
1 files changed, 7 insertions, 0 deletions
diff --git a/src/loader/loader.h b/src/loader/loader.h
index dfd77baad0..fa57950de2 100644
--- a/src/loader/loader.h
+++ b/src/loader/loader.h
@@ -41,6 +41,13 @@ loader_get_driver_for_fd(int fd, unsigned driver_types);
char *
loader_get_device_name_for_fd(int fd);
+/* Function to get a different device than the one we are to use by default,
+ * if the user requests so and it is possible. The initial fd will be closed
+ * if neccessary. The returned fd is potentially a render-node.
+ */
+loader_get_user_preferred_fd(int default_fd, int *different_device);
/* for logging.. keep this aligned with egllog.h so we can just use
* _eglLog directly.