[Mesa-dev] [PATCH 2/2] loader: fallback to drmGetVersion() for non-pci devices
Rob Clark
robdclark at gmail.com
Sat Dec 14 11:28:33 PST 2013
From: Rob Clark <robclark at freedesktop.org>
Use the driver name from drmGetVersion() for non-pci devices.
Signed-off-by: Rob Clark <robclark at freedesktop.org>
---
src/loader/loader.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/loader/loader.c b/src/loader/loader.c
index 3e69a59..0862b8b 100644
--- a/src/loader/loader.c
+++ b/src/loader/loader.c
@@ -227,8 +227,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++) {
--
1.8.4.2
More information about the mesa-dev
mailing list