diff options
author | Bas Nieuwenhuizen <[email protected]> | 2017-05-23 09:22:09 +0200 |
---|---|---|
committer | Bas Nieuwenhuizen <[email protected]> | 2017-06-05 02:26:43 +0200 |
commit | d515b420ddaa3b83cc565567d0c229e717aab06a (patch) | |
tree | 8769759b34545e3f64cef16aadeb2582b59e96c4 /src/amd/vulkan/radv_device.c | |
parent | d513473cc167455a255a406a5a30e92fa0445ec8 (diff) |
radv: Add VkPhysicalDeviceIDProperties support.
Signed-off-by: Bas Nieuwenhuizen <[email protected]>
Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/amd/vulkan/radv_device.c')
-rw-r--r-- | src/amd/vulkan/radv_device.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 2d89e8635e7..9a44f657a3c 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -61,6 +61,15 @@ radv_device_get_cache_uuid(enum radeon_family family, void *uuid) return 0; } +static void +radv_get_device_uuid(drmDevicePtr device, void *uuid) { + memset(uuid, 0, VK_UUID_SIZE); + memcpy((char*)uuid + 0, &device->businfo.pci->domain, 2); + memcpy((char*)uuid + 2, &device->businfo.pci->bus, 1); + memcpy((char*)uuid + 3, &device->businfo.pci->dev, 1); + memcpy((char*)uuid + 4, &device->businfo.pci->func, 1); +} + static const VkExtensionProperties instance_extensions[] = { { .extensionName = VK_KHR_SURFACE_EXTENSION_NAME, @@ -190,8 +199,9 @@ is_extension_enabled(const VkExtensionProperties *extensions, static VkResult radv_physical_device_init(struct radv_physical_device *device, struct radv_instance *instance, - const char *path) + drmDevicePtr drm_device) { + const char *path = drm_device->nodes[DRM_NODE_RENDER]; VkResult result; drmVersionPtr version; int fd; @@ -251,6 +261,8 @@ radv_physical_device_init(struct radv_physical_device *device, fprintf(stderr, "WARNING: radv is not a conformant vulkan implementation, testing use only.\n"); device->name = device->rad_info.name; + radv_get_device_uuid(drm_device, device->device_uuid); + return VK_SUCCESS; fail: @@ -413,7 +425,7 @@ radv_enumerate_devices(struct radv_instance *instance) result = radv_physical_device_init(instance->physicalDevices + instance->physicalDeviceCount, instance, - devices[i]->nodes[DRM_NODE_RENDER]); + devices[i]); if (result == VK_SUCCESS) ++instance->physicalDeviceCount; else if (result != VK_ERROR_INCOMPATIBLE_DRIVER) @@ -689,6 +701,7 @@ void radv_GetPhysicalDeviceProperties2KHR( VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2KHR *pProperties) { + RADV_FROM_HANDLE(radv_physical_device, pdevice, physicalDevice); radv_GetPhysicalDeviceProperties(physicalDevice, &pProperties->properties); vk_foreach_struct(ext, pProperties->pNext) { @@ -699,6 +712,13 @@ void radv_GetPhysicalDeviceProperties2KHR( properties->maxPushDescriptors = MAX_PUSH_DESCRIPTORS; break; } + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES_KHX: { + VkPhysicalDeviceIDPropertiesKHX *properties = (VkPhysicalDeviceIDPropertiesKHX*)ext; + radv_device_get_cache_uuid(0, properties->driverUUID); + memcpy(properties->deviceUUID, pdevice->device_uuid, VK_UUID_SIZE); + properties->deviceLUIDValid = false; + break; + } default: break; } |