[Mesa-dev] [PATCH] radv: Implement VK_EXT_pci_bus_info.

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Sat Oct 13 17:21:46 UTC 2018


---
 src/amd/vulkan/radv_device.c      | 10 ++++++++++
 src/amd/vulkan/radv_extensions.py |  1 +
 src/amd/vulkan/radv_private.h     |  2 ++
 3 files changed, 13 insertions(+)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 88786c999de..c418176978e 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -389,6 +389,7 @@ radv_physical_device_init(struct radv_physical_device *device,
 	if ((device->instance->debug_flags & RADV_DEBUG_INFO))
 		ac_print_gpu_info(&device->rad_info);
 
+	device->bus_info = *drm_device->businfo.pci;
 	return VK_SUCCESS;
 
 fail:
@@ -1190,6 +1191,15 @@ void radv_GetPhysicalDeviceProperties2(
 			properties->conservativeRasterizationPostDepthCoverage = VK_FALSE;
 			break;
 		}
+		case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT: {
+			VkPhysicalDevicePCIBusInfoPropertiesEXT *properties =
+				(VkPhysicalDevicePCIBusInfoPropertiesEXT *)ext;
+			properties->pciDomain = pdevice->bus_info.domain;
+			properties->pciBus = pdevice->bus_info.bus;
+			properties->pciDevice = pdevice->bus_info.dev;
+			properties->pciFunction = pdevice->bus_info.func;
+			break;
+		}
 		default:
 			break;
 		}
diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py
index 584926df390..5dcedae1c63 100644
--- a/src/amd/vulkan/radv_extensions.py
+++ b/src/amd/vulkan/radv_extensions.py
@@ -103,6 +103,7 @@ EXTENSIONS = [
     Extension('VK_EXT_external_memory_dma_buf',           1, True),
     Extension('VK_EXT_external_memory_host',              1, 'device->rad_info.has_userptr'),
     Extension('VK_EXT_global_priority',                   1, 'device->rad_info.has_ctx_priority'),
+    Extension('VK_EXT_pci_bus_info',                      1, True),
     Extension('VK_EXT_sampler_filter_minmax',             1, 'device->rad_info.chip_class >= CIK'),
     Extension('VK_EXT_shader_viewport_index_layer',       1, True),
     Extension('VK_EXT_shader_stencil_export',             1, True),
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index 33ba8a7354b..b35aa8d818f 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -312,6 +312,8 @@ struct radv_physical_device {
 	VkPhysicalDeviceMemoryProperties memory_properties;
 	enum radv_mem_type mem_type_indices[RADV_MEM_TYPE_COUNT];
 
+	drmPciBusInfo bus_info;
+
 	struct radv_device_extension_table supported_extensions;
 };
 
-- 
2.19.1



More information about the mesa-dev mailing list