aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Velikov2016-11-30 11:13:51 -0600
committerEmil Velikov2016-12-05 11:17:35 -0600
commit138d23117c6b96f57aaa0072992e0480153cfebd (patch)
treefbd5034826ad9b79636af8ace3b3dd67c750be5c /xf86drm.c
parentb40a65d44857394966b25c5587f9dc978643f9c4 (diff)
downloadexternal-libgbm-138d23117c6b96f57aaa0072992e0480153cfebd.tar.gz
external-libgbm-138d23117c6b96f57aaa0072992e0480153cfebd.tar.xz
external-libgbm-138d23117c6b96f57aaa0072992e0480153cfebd.zip
xf86drm: add plumbing to not retrieve PCI device revision
Will be used with the drmGetDevice[s]2 API. Cc: Michel Dänzer <michel@daenzer.net> Cc: Nicolai Hähnle <nhaehnle@gmail.com> Cc: Mauro Santos <registo.mailling@gmail.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98502 Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Diffstat (limited to 'xf86drm.c')
-rw-r--r--xf86drm.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/xf86drm.c b/xf86drm.c
index c788c932..ddb8f9f7 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -2947,7 +2947,8 @@ static int drmGetMaxNodeName(void)
2947} 2947}
2948 2948
2949static int drmParsePciDeviceInfo(int maj, int min, 2949static int drmParsePciDeviceInfo(int maj, int min,
2950 drmPciDeviceInfoPtr device) 2950 drmPciDeviceInfoPtr device,
2951 uint32_t flags)
2951{ 2952{
2952#ifdef __linux__ 2953#ifdef __linux__
2953 char path[PATH_MAX + 1]; 2954 char path[PATH_MAX + 1];
@@ -3000,7 +3001,8 @@ void drmFreeDevices(drmDevicePtr devices[], int count)
3000 3001
3001static int drmProcessPciDevice(drmDevicePtr *device, 3002static int drmProcessPciDevice(drmDevicePtr *device,
3002 const char *node, int node_type, 3003 const char *node, int node_type,
3003 int maj, int min, bool fetch_deviceinfo) 3004 int maj, int min, bool fetch_deviceinfo,
3005 uint32_t flags)
3004{ 3006{
3005 const int max_node_str = ALIGN(drmGetMaxNodeName(), sizeof(void *)); 3007 const int max_node_str = ALIGN(drmGetMaxNodeName(), sizeof(void *));
3006 int ret, i; 3008 int ret, i;
@@ -3039,7 +3041,7 @@ static int drmProcessPciDevice(drmDevicePtr *device,
3039 addr += sizeof(drmPciBusInfo); 3041 addr += sizeof(drmPciBusInfo);
3040 (*device)->deviceinfo.pci = (drmPciDeviceInfoPtr)addr; 3042 (*device)->deviceinfo.pci = (drmPciDeviceInfoPtr)addr;
3041 3043
3042 ret = drmParsePciDeviceInfo(maj, min, (*device)->deviceinfo.pci); 3044 ret = drmParsePciDeviceInfo(maj, min, (*device)->deviceinfo.pci, flags);
3043 if (ret) 3045 if (ret)
3044 goto free_device; 3046 goto free_device;
3045 } 3047 }
@@ -3095,6 +3097,7 @@ int drmGetDevice(int fd, drmDevicePtr *device)
3095 int ret, i, node_count; 3097 int ret, i, node_count;
3096 int max_count = 16; 3098 int max_count = 16;
3097 dev_t find_rdev; 3099 dev_t find_rdev;
3100 uint32_t flags = 0;
3098 3101
3099 if (fd == -1 || device == NULL) 3102 if (fd == -1 || device == NULL)
3100 return -EINVAL; 3103 return -EINVAL;
@@ -3142,7 +3145,7 @@ int drmGetDevice(int fd, drmDevicePtr *device)
3142 3145
3143 switch (subsystem_type) { 3146 switch (subsystem_type) {
3144 case DRM_BUS_PCI: 3147 case DRM_BUS_PCI:
3145 ret = drmProcessPciDevice(&d, node, node_type, maj, min, true); 3148 ret = drmProcessPciDevice(&d, node, node_type, maj, min, true, flags);
3146 if (ret) 3149 if (ret)
3147 goto free_devices; 3150 goto free_devices;
3148 3151
@@ -3216,6 +3219,7 @@ int drmGetDevices(drmDevicePtr devices[], int max_devices)
3216 int maj, min; 3219 int maj, min;
3217 int ret, i, node_count, device_count; 3220 int ret, i, node_count, device_count;
3218 int max_count = 16; 3221 int max_count = 16;
3222 uint32_t flags = 0;
3219 3223
3220 local_devices = calloc(max_count, sizeof(drmDevicePtr)); 3224 local_devices = calloc(max_count, sizeof(drmDevicePtr));
3221 if (local_devices == NULL) 3225 if (local_devices == NULL)
@@ -3251,7 +3255,7 @@ int drmGetDevices(drmDevicePtr devices[], int max_devices)
3251 switch (subsystem_type) { 3255 switch (subsystem_type) {
3252 case DRM_BUS_PCI: 3256 case DRM_BUS_PCI:
3253 ret = drmProcessPciDevice(&device, node, node_type, 3257 ret = drmProcessPciDevice(&device, node, node_type,
3254 maj, min, devices != NULL); 3258 maj, min, devices != NULL, flags);
3255 if (ret) 3259 if (ret)
3256 goto free_devices; 3260 goto free_devices;
3257 3261