diff options
author | Lionel Landwerlin <[email protected]> | 2018-10-14 13:12:50 +0100 |
---|---|---|
committer | Lionel Landwerlin <[email protected]> | 2018-10-16 12:47:55 +0100 |
commit | 322a919a41f92f65f4621e565c94aa45a737bd03 (patch) | |
tree | b98d85e6899010cb7fa30c0b21cfee2816f36da5 /src/intel/vulkan/anv_device.c | |
parent | 8550be7a2fd151e050932c9fc1349b93ab1b9992 (diff) |
anv: Implement VK_EXT_pci_bus_info
Even though the Intel GPU are always at the same PCI location, all the
info we need is already provided by libdrm. Let's be future proof.
Signed-off-by: Lionel Landwerlin <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_device.c')
-rw-r--r-- | src/intel/vulkan/anv_device.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index a2551452eb1..54d353e400f 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -309,9 +309,10 @@ anv_physical_device_free_disk_cache(struct anv_physical_device *device) static VkResult anv_physical_device_init(struct anv_physical_device *device, struct anv_instance *instance, - const char *primary_path, - const char *path) + drmDevicePtr drm_device) { + const char *primary_path = drm_device->nodes[DRM_NODE_PRIMARY]; + const char *path = drm_device->nodes[DRM_NODE_RENDER]; VkResult result; int fd; int master_fd = -1; @@ -342,6 +343,11 @@ anv_physical_device_init(struct anv_physical_device *device, device->no_hw = true; } + device->pci_info.domain = drm_device->businfo.pci->domain; + device->pci_info.bus = drm_device->businfo.pci->bus; + device->pci_info.device = drm_device->businfo.pci->dev; + device->pci_info.function = drm_device->businfo.pci->func; + device->name = gen_get_device_name(device->chipset_id); if (!gen_get_device_info(device->chipset_id, &device->info)) { result = vk_error(VK_ERROR_INCOMPATIBLE_DRIVER); @@ -729,9 +735,7 @@ anv_enumerate_devices(struct anv_instance *instance) devices[i]->deviceinfo.pci->vendor_id == 0x8086) { result = anv_physical_device_init(&instance->physicalDevice, - instance, - devices[i]->nodes[DRM_NODE_PRIMARY], - devices[i]->nodes[DRM_NODE_RENDER]); + instance, devices[i]); if (result != VK_ERROR_INCOMPATIBLE_DRIVER) break; } @@ -1180,6 +1184,16 @@ void anv_GetPhysicalDeviceProperties2( break; } + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT: { + VkPhysicalDevicePCIBusInfoPropertiesEXT *properties = + (VkPhysicalDevicePCIBusInfoPropertiesEXT *)ext; + properties->pciDomain = pdevice->pci_info.domain; + properties->pciBus = pdevice->pci_info.bus; + properties->pciDevice = pdevice->pci_info.device; + properties->pciFunction = pdevice->pci_info.function; + break; + } + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES: { VkPhysicalDevicePointClippingProperties *properties = (VkPhysicalDevicePointClippingProperties *) ext; |