diff options
author | Jason Ekstrand <[email protected]> | 2017-02-27 09:34:53 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-04-27 20:08:46 -0700 |
commit | 02767cb4ffb83a0c2c19ce182e10993a64b41fb3 (patch) | |
tree | afa77925136cd673fc70fe793f37018795f388c0 /src/intel/vulkan | |
parent | 35e626bd0e59e7ce9fd97ccef66b2468c09206a4 (diff) |
anv: Refactor device_get_cache_uuid into physical_device_init_uuids
Reviewed-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/intel/vulkan')
-rw-r--r-- | src/intel/vulkan/anv_device.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index b3dad65dd46..767f7469d19 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -97,16 +97,20 @@ anv_compute_heap_size(int fd, uint64_t *heap_size) return VK_SUCCESS; } -static bool -anv_device_get_cache_uuid(void *uuid, uint16_t pci_id) +static VkResult +anv_physical_device_init_uuids(struct anv_physical_device *device) { const struct build_id_note *note = build_id_find_nhdr("libvulkan_intel.so"); - if (!note) - return false; + if (!note) { + return vk_errorf(VK_ERROR_INITIALIZATION_FAILED, + "Failed to find build-id"); + } unsigned build_id_len = build_id_length(note); - if (build_id_len < 20) /* It should be a SHA-1 */ - return false; + if (build_id_len < 20) { + return vk_errorf(VK_ERROR_INITIALIZATION_FAILED, + "build-id too short. It needs to be a SHA"); + } struct mesa_sha1 sha1_ctx; uint8_t sha1[20]; @@ -114,11 +118,12 @@ anv_device_get_cache_uuid(void *uuid, uint16_t pci_id) _mesa_sha1_init(&sha1_ctx); _mesa_sha1_update(&sha1_ctx, build_id_data(note), build_id_len); - _mesa_sha1_update(&sha1_ctx, &pci_id, sizeof(pci_id)); + _mesa_sha1_update(&sha1_ctx, &device->chipset_id, + sizeof(device->chipset_id)); _mesa_sha1_final(&sha1_ctx, sha1); + memcpy(device->uuid, sha1, VK_UUID_SIZE); - memcpy(uuid, sha1, VK_UUID_SIZE); - return true; + return VK_SUCCESS; } static VkResult @@ -204,11 +209,10 @@ anv_physical_device_init(struct anv_physical_device *device, device->has_exec_async = anv_gem_get_param(fd, I915_PARAM_HAS_EXEC_ASYNC); - if (!anv_device_get_cache_uuid(device->uuid, device->chipset_id)) { - result = vk_errorf(VK_ERROR_INITIALIZATION_FAILED, - "cannot generate UUID"); + result = anv_physical_device_init_uuids(device); + if (result != VK_SUCCESS) goto fail; - } + bool swizzled = anv_gem_get_bit6_swizzle(fd, I915_TILING_X); /* GENs prior to 8 do not support EU/Subslice info */ |