[Mesa-dev] [PATCH 21/23] radv: generate same device UUID as radeonsi
Timothy Arceri
tarceri at itsqueeze.com
Fri Aug 4 01:54:24 UTC 2017
From: Andres Rodriguez <andresx7 at gmail.com>
This is required for interop use cases. The same device must report
identical UUIDs through the GL and Vulkan APIs so that users can
identify when it is safe to perform a memory object import.
v2: use ac helpers to calculate the uuid
Signed-off-by: Andres Rodriguez <andresx7 at gmail.com>
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
---
src/amd/vulkan/radv_device.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 13fb19cf48..8d4d67ca9f 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -56,26 +56,23 @@ radv_device_get_cache_uuid(enum radeon_family family, void *uuid)
return -1;
memcpy(uuid, &mesa_timestamp, 4);
memcpy((char*)uuid + 4, &llvm_timestamp, 4);
memcpy((char*)uuid + 8, &f, 2);
snprintf((char*)uuid + 10, VK_UUID_SIZE - 10, "radv");
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);
+radv_get_device_uuid(struct radeon_info *info, void *uuid)
+{
+ ac_compute_device_uuid(info, uuid, VK_UUID_SIZE);
}
static const VkExtensionProperties instance_extensions[] = {
{
.extensionName = VK_KHR_SURFACE_EXTENSION_NAME,
.specVersion = 25,
},
#ifdef VK_USE_PLATFORM_XCB_KHR
{
.extensionName = VK_KHR_XCB_SURFACE_EXTENSION_NAME,
@@ -331,21 +328,21 @@ radv_physical_device_init(struct radv_physical_device *device,
&device->extensions,
ext_sema_device_extensions,
ARRAY_SIZE(ext_sema_device_extensions));
if (result != VK_SUCCESS)
goto fail;
}
fprintf(stderr, "WARNING: radv is not a conformant vulkan implementation, testing use only.\n");
device->name = get_chip_name(device->rad_info.family);
- radv_get_device_uuid(drm_device, device->device_uuid);
+ radv_get_device_uuid(&device->rad_info, &device->device_uuid);
if (device->rad_info.family == CHIP_STONEY ||
device->rad_info.chip_class >= GFX9) {
device->has_rbplus = true;
device->rbplus_allowed = device->rad_info.family == CHIP_STONEY;
}
return VK_SUCCESS;
fail:
--
2.13.3
More information about the mesa-dev
mailing list