summaryrefslogtreecommitdiff
path: root/src/loader/loader.c
diff options
context:
space:
mode:
authorRob Clark <robclark@freedesktop.org>2013-12-14 14:28:33 -0500
committerEmil Velikov <emil.l.velikov@gmail.com>2014-01-18 18:52:07 +0000
commitbf70c238a72021d61e1464ecc31932c47b7003cc (patch)
tree2fe2d2fa1b292b5c865683530f31f7f79de1b4fa /src/loader/loader.c
parent26458420d8802a765cf71c75ef9f3b6da6bdfd8d (diff)
loader: fallback to drmGetVersion() for non-pci devices
Use the kernel driver name are returned by drmGetVersion() for non-pci(platform) devices. Signed-off-by: Rob Clark <robclark@freedesktop.org> v2 (Emil): Rebased and weaked commit message. Reviewed-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'src/loader/loader.c')
-rw-r--r--src/loader/loader.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/loader/loader.c b/src/loader/loader.c
index 2f9cfa7c9f..108e444029 100644
--- a/src/loader/loader.c
+++ b/src/loader/loader.c
@@ -267,8 +267,20 @@ loader_get_driver_for_fd(int fd, unsigned driver_types)
driver_types = _LOADER_GALLIUM | _LOADER_DRI;
if (!loader_get_pci_id_for_fd(fd, &vendor_id, &chip_id)) {
- log(_LOADER_WARNING, "failed to get driver name for fd %d", fd);
- return NULL;
+ /* fallback to drmGetVersion(): */
+ drmVersionPtr version = drmGetVersion(fd);
+
+ if (!version) {
+ log(_LOADER_WARNING, "failed to get driver name for fd %d", fd);
+ return NULL;
+ }
+
+ driver = strndup(version->name, version->name_len);
+ log(_LOADER_INFO, "using driver %s for %d", driver, fd);
+
+ drmFreeVersion(version);
+
+ return driver;
}
for (i = 0; driver_map[i].driver; i++) {