Mesa (master): loader: use drmGetDevice[s]2 API

Emil Velikov evelikov at kemper.freedesktop.org
Wed Mar 15 11:42:36 UTC 2017


Module: Mesa
Branch: master
Commit: a50c4eb2a0fd42a3da0eea560876cb43afdb81f2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a50c4eb2a0fd42a3da0eea560876cb43afdb81f2

Author: Emil Velikov <emil.velikov at collabora.com>
Date:   Thu Dec  1 19:51:03 2016 +0000

loader: use drmGetDevice[s]2 API

By this allows us to fetch the device list/info w/o the revision field.
At the moment retrieving the latter wakes up the device.

Note: kernel patch to resolve that should be in 4.10.

Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>
Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>
Tested-by: Mike Lothian <mike at fireburn.co.uk>

---

 src/loader/loader.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/loader/loader.c b/src/loader/loader.c
index 9b4752d..5541ccc 100644
--- a/src/loader/loader.c
+++ b/src/loader/loader.c
@@ -145,7 +145,7 @@ static char *drm_get_id_path_tag_for_fd(int fd)
    drmDevicePtr device;
    char *tag;
 
-   if (drmGetDevice(fd, &device) != 0)
+   if (drmGetDevice2(fd, 0, &device) != 0)
        return NULL;
 
    tag = drm_construct_id_path_tag(device);
@@ -179,7 +179,7 @@ int loader_get_user_preferred_fd(int default_fd, int *different_device)
    if (default_tag == NULL)
       goto err;
 
-   num_devices = drmGetDevices(devices, MAX_DRM_DEVICES);
+   num_devices = drmGetDevices2(0, devices, MAX_DRM_DEVICES);
    if (num_devices < 0)
       goto err;
 
@@ -275,7 +275,7 @@ drm_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id)
    drmDevicePtr device;
    int ret;
 
-   if (drmGetDevice(fd, &device) == 0) {
+   if (drmGetDevice2(fd, 0, &device) == 0) {
       if (device->bustype == DRM_BUS_PCI) {
          *vendor_id = device->deviceinfo.pci->vendor_id;
          *chip_id = device->deviceinfo.pci->device_id;




More information about the mesa-commit mailing list