The open source OpenXR runtime

xrt: Use xrt_luid_t for deviceLUID

authored by

Jakob Bornecrantz and committed by
Jakob Bornecrantz
38f68dc1 b62d8714

+19 -11
+1 -1
src/xrt/compositor/main/comp_compositor.c
··· 725 725 static_assert(ARRAY_SIZE(vk_res.selected_gpu_deviceUUID.data) == XRT_UUID_SIZE, "array size mismatch"); 726 726 static_assert(ARRAY_SIZE(vk_res.client_gpu_deviceUUID.data) == ARRAY_SIZE(c->settings.client_gpu_deviceUUID.data), "array size mismatch"); 727 727 static_assert(ARRAY_SIZE(vk_res.selected_gpu_deviceUUID.data) == ARRAY_SIZE(c->settings.selected_gpu_deviceUUID.data), "array size mismatch"); 728 - static_assert(ARRAY_SIZE(vk_res.client_gpu_deviceLUID.data) == XRT_UUID_SIZE, "array size mismatch"); 728 + static_assert(ARRAY_SIZE(vk_res.client_gpu_deviceLUID.data) == XRT_LUID_SIZE, "array size mismatch"); 729 729 static_assert(ARRAY_SIZE(vk_res.client_gpu_deviceLUID.data) == ARRAY_SIZE(c->settings.client_gpu_deviceLUID.data), "array size mismatch"); 730 730 // clang-format on 731 731
+1 -1
src/xrt/compositor/main/comp_settings.h
··· 119 119 xrt_uuid_t client_gpu_deviceUUID; 120 120 121 121 //! The Windows LUID for the GPU device suggested for D3D clients, never changes. 122 - xrt_uuid_t client_gpu_deviceLUID; 122 + xrt_luid_t client_gpu_deviceLUID; 123 123 124 124 //! Whether @ref client_d3d_deviceLUID is valid 125 125 bool client_gpu_deviceLUID_valid;
+15 -7
src/xrt/compositor/util/comp_vulkan.c
··· 29 29 #define UUID_STR_SIZE (XRT_UUID_SIZE * 3 + 1) 30 30 31 31 static void 32 + snprint_luid(char *str, size_t size, xrt_luid_t *luid) 33 + { 34 + for (size_t i = 0, offset = 0; i < ARRAY_SIZE(luid->data) && offset < size; i++, offset += 3) { 35 + snprintf(str + offset, size - offset, "%02x ", luid->data[i]); 36 + } 37 + } 38 + 39 + static void 32 40 snprint_uuid(char *str, size_t size, xrt_uuid_t *uuid) 33 41 { 34 42 for (size_t i = 0, offset = 0; i < ARRAY_SIZE(uuid->data) && offset < size; i++, offset += 3) { ··· 65 73 } 66 74 67 75 static bool 68 - get_device_luid(struct vk_bundle *vk, int gpu_index, xrt_uuid_t *uuid) 76 + get_device_luid(struct vk_bundle *vk, int gpu_index, xrt_luid_t *luid) 69 77 { 70 78 VkPhysicalDeviceIDProperties pdidp = { 71 79 .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES, ··· 90 98 if (pdidp.deviceLUIDValid != VK_TRUE) { 91 99 return false; 92 100 } 93 - memcpy(uuid->data, pdidp.deviceLUID, ARRAY_SIZE(uuid->data)); 101 + memcpy(luid->data, pdidp.deviceLUID, ARRAY_SIZE(luid->data)); 94 102 95 103 return true; 96 104 } ··· 124 132 // Store physical device UUID suggested to clients in settings 125 133 if (vk_res->client_gpu_index >= 0) { 126 134 if (get_device_uuid(vk, vk_res->client_gpu_index, &vk_res->client_gpu_deviceUUID)) { 127 - char uuid_str[UUID_STR_SIZE] = {0}; 128 - snprint_uuid(uuid_str, ARRAY_SIZE(uuid_str), &vk_res->client_gpu_deviceUUID); 135 + char buffer[UUID_STR_SIZE] = {0}; 136 + snprint_uuid(buffer, ARRAY_SIZE(buffer), &vk_res->client_gpu_deviceUUID); 129 137 130 138 // Trailing space above, means 'to' should be right next to '%s'. 131 - VK_DEBUG(vk, "Suggest %d with uuid: %sto clients", vk_res->client_gpu_index, uuid_str); 139 + VK_DEBUG(vk, "Suggest %d with uuid: %sto clients", vk_res->client_gpu_index, buffer); 132 140 133 141 if (get_device_luid(vk, vk_res->client_gpu_index, &vk_res->client_gpu_deviceLUID)) { 134 142 vk_res->client_gpu_deviceLUID_valid = true; 135 - snprint_uuid(uuid_str, ARRAY_SIZE(uuid_str), &vk_res->client_gpu_deviceLUID); 136 - VK_DEBUG(vk, " Device LUID: %s", uuid_str); 143 + snprint_luid(buffer, ARRAY_SIZE(buffer), &vk_res->client_gpu_deviceLUID); 144 + VK_DEBUG(vk, "\tDevice LUID: %s", buffer); 137 145 } 138 146 } else { 139 147 VK_ERROR(vk, "Failed to get device %d uuid", vk_res->client_gpu_index);
+1 -1
src/xrt/compositor/util/comp_vulkan.h
··· 77 77 xrt_uuid_t client_gpu_deviceUUID; 78 78 79 79 //! The (Windows) LUID for the GPU device suggested for clients. 80 - xrt_uuid_t client_gpu_deviceLUID; 80 + xrt_luid_t client_gpu_deviceLUID; 81 81 82 82 //! Whether @ref client_gpu_deviceLUID is valid (probably only on Windows) 83 83 bool client_gpu_deviceLUID_valid;
+1 -1
src/xrt/include/xrt/xrt_compositor.h
··· 1758 1758 xrt_uuid_t client_vk_deviceUUID; 1759 1759 1760 1760 //! The (Windows) LUID for the GPU device suggested for D3D clients, never changes. 1761 - xrt_uuid_t client_d3d_deviceLUID; 1761 + xrt_luid_t client_d3d_deviceLUID; 1762 1762 1763 1763 //! Whether @ref client_d3d_deviceLUID is valid 1764 1764 bool client_d3d_deviceLUID_valid;