radv: generate same device UUID as radeonsi
authorAndres Rodriguez <andresx7@gmail.com>
Wed, 12 Jul 2017 22:45:30 +0000 (18:45 -0400)
committerTimothy Arceri <tarceri@itsqueeze.com>
Sun, 6 Aug 2017 02:42:07 +0000 (12:42 +1000)
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@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/amd/vulkan/radv_device.c

index cb68b52727639942d556947b0894945ceb1f759c..fe621d23dca32b06f6c9733c4efb57c7fd0a3a8c 100644 (file)
@@ -63,12 +63,9 @@ radv_device_get_cache_uuid(enum radeon_family family, void *uuid)
 }
 
 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[] = {
@@ -338,7 +335,7 @@ 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 = 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) {