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 <lionel.g.landwerlin@intel.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
parent
8550be7a2f
commit
322a919a41
|
@ -309,9 +309,10 @@ anv_physical_device_free_disk_cache(struct anv_physical_device *device)
|
||||||
static VkResult
|
static VkResult
|
||||||
anv_physical_device_init(struct anv_physical_device *device,
|
anv_physical_device_init(struct anv_physical_device *device,
|
||||||
struct anv_instance *instance,
|
struct anv_instance *instance,
|
||||||
const char *primary_path,
|
drmDevicePtr drm_device)
|
||||||
const char *path)
|
|
||||||
{
|
{
|
||||||
|
const char *primary_path = drm_device->nodes[DRM_NODE_PRIMARY];
|
||||||
|
const char *path = drm_device->nodes[DRM_NODE_RENDER];
|
||||||
VkResult result;
|
VkResult result;
|
||||||
int fd;
|
int fd;
|
||||||
int master_fd = -1;
|
int master_fd = -1;
|
||||||
|
@ -342,6 +343,11 @@ anv_physical_device_init(struct anv_physical_device *device,
|
||||||
device->no_hw = true;
|
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);
|
device->name = gen_get_device_name(device->chipset_id);
|
||||||
if (!gen_get_device_info(device->chipset_id, &device->info)) {
|
if (!gen_get_device_info(device->chipset_id, &device->info)) {
|
||||||
result = vk_error(VK_ERROR_INCOMPATIBLE_DRIVER);
|
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) {
|
devices[i]->deviceinfo.pci->vendor_id == 0x8086) {
|
||||||
|
|
||||||
result = anv_physical_device_init(&instance->physicalDevice,
|
result = anv_physical_device_init(&instance->physicalDevice,
|
||||||
instance,
|
instance, devices[i]);
|
||||||
devices[i]->nodes[DRM_NODE_PRIMARY],
|
|
||||||
devices[i]->nodes[DRM_NODE_RENDER]);
|
|
||||||
if (result != VK_ERROR_INCOMPATIBLE_DRIVER)
|
if (result != VK_ERROR_INCOMPATIBLE_DRIVER)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1180,6 +1184,16 @@ void anv_GetPhysicalDeviceProperties2(
|
||||||
break;
|
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: {
|
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES: {
|
||||||
VkPhysicalDevicePointClippingProperties *properties =
|
VkPhysicalDevicePointClippingProperties *properties =
|
||||||
(VkPhysicalDevicePointClippingProperties *) ext;
|
(VkPhysicalDevicePointClippingProperties *) ext;
|
||||||
|
|
|
@ -121,6 +121,7 @@ EXTENSIONS = [
|
||||||
Extension('VK_EXT_external_memory_dma_buf', 1, True),
|
Extension('VK_EXT_external_memory_dma_buf', 1, True),
|
||||||
Extension('VK_EXT_global_priority', 1,
|
Extension('VK_EXT_global_priority', 1,
|
||||||
'device->has_context_priority'),
|
'device->has_context_priority'),
|
||||||
|
Extension('VK_EXT_pci_bus_info', 1, True),
|
||||||
Extension('VK_EXT_shader_viewport_index_layer', 1, True),
|
Extension('VK_EXT_shader_viewport_index_layer', 1, True),
|
||||||
Extension('VK_EXT_shader_stencil_export', 1, 'device->info.gen >= 9'),
|
Extension('VK_EXT_shader_stencil_export', 1, 'device->info.gen >= 9'),
|
||||||
Extension('VK_EXT_vertex_attribute_divisor', 3, True),
|
Extension('VK_EXT_vertex_attribute_divisor', 3, True),
|
||||||
|
|
|
@ -841,6 +841,12 @@ struct anv_physical_device {
|
||||||
bool no_hw;
|
bool no_hw;
|
||||||
char path[20];
|
char path[20];
|
||||||
const char * name;
|
const char * name;
|
||||||
|
struct {
|
||||||
|
uint16_t domain;
|
||||||
|
uint8_t bus;
|
||||||
|
uint8_t device;
|
||||||
|
uint8_t function;
|
||||||
|
} pci_info;
|
||||||
struct gen_device_info info;
|
struct gen_device_info info;
|
||||||
/** Amount of "GPU memory" we want to advertise
|
/** Amount of "GPU memory" we want to advertise
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue