summaryrefslogtreecommitdiffstats
path: root/src/amd/common/ac_gpu_info.c
diff options
context:
space:
mode:
authorAndres Rodriguez <[email protected]>2017-07-12 18:45:25 -0400
committerTimothy Arceri <[email protected]>2017-08-06 12:42:07 +1000
commit6130c8e6e769cf0361e36df0b4b5d288833adc27 (patch)
tree6dc3725c3b1c7c9c27b8256d4186491377c9f5ed /src/amd/common/ac_gpu_info.c
parentb2aaa91e8db006adbd2ca672756b3fdb23c5b589 (diff)
ac/gpu: add driver/device UUID query helpers
We need vulkan and gl to produce the same UUIDs. Therefore we should keep the mechanism to compute these in a common location to guarantee they are updated in lockstep. Signed-off-by: Andres Rodriguez <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/amd/common/ac_gpu_info.c')
-rw-r--r--src/amd/common/ac_gpu_info.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/amd/common/ac_gpu_info.c b/src/amd/common/ac_gpu_info.c
index 929dfd2946f..e55d864187d 100644
--- a/src/amd/common/ac_gpu_info.c
+++ b/src/amd/common/ac_gpu_info.c
@@ -314,3 +314,30 @@ bool ac_query_gpu_info(int fd, amdgpu_device_handle dev,
return true;
}
+void ac_compute_driver_uuid(char *uuid, size_t size)
+{
+ char amd_uuid[] = "AMD-MESA-DRV";
+
+ assert(size >= sizeof(amd_uuid));
+
+ memset(uuid, 0, size);
+ strncpy(uuid, amd_uuid, size);
+}
+
+void ac_compute_device_uuid(struct radeon_info *info, char *uuid, size_t size)
+{
+ uint32_t *uint_uuid = (uint32_t*)uuid;
+
+ assert(size >= sizeof(uint32_t)*4);
+
+ /**
+ * Use the device info directly instead of using a sha1. GL/VK UUIDs
+ * are 16 byte vs 20 byte for sha1, and the truncation that would be
+ * required would get rid of part of the little entropy we have.
+ * */
+ memset(uuid, 0, size);
+ uint_uuid[0] = info->pci_domain;
+ uint_uuid[1] = info->pci_bus;
+ uint_uuid[2] = info->pci_dev;
+ uint_uuid[3] = info->pci_func;
+}