mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 05:10:11 +01:00
kk: support VK_(KHR|EXT)_calibrated_timestamps
Use common implementation. Reviewed-by: Aitor Camacho <aitor@lunarg.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38965>
This commit is contained in:
parent
3a73a7ba29
commit
6865ff18ba
3 changed files with 14 additions and 72 deletions
|
|
@ -538,7 +538,7 @@ Khronos extensions that are not part of any Vulkan version:
|
||||||
|
|
||||||
VK_KHR_acceleration_structure DONE (anv/gfx12.5+, lvp, radv/gfx10.3+, tu/a740+, vn)
|
VK_KHR_acceleration_structure DONE (anv/gfx12.5+, lvp, radv/gfx10.3+, tu/a740+, vn)
|
||||||
VK_KHR_android_surface not started
|
VK_KHR_android_surface not started
|
||||||
VK_KHR_calibrated_timestamps DONE (anv, hk, nvk, panvk/v10+, radv, tu/a750+, vn)
|
VK_KHR_calibrated_timestamps DONE (anv, hk, kk, nvk, panvk/v10+, radv, tu/a750+, vn)
|
||||||
VK_KHR_compute_shader_derivatives DONE (anv, lvp, nvk, radv, tu/a7xx+, vn)
|
VK_KHR_compute_shader_derivatives DONE (anv, lvp, nvk, radv, tu/a7xx+, vn)
|
||||||
VK_KHR_cooperative_matrix DONE (anv, nvk/Turing+, radv/gfx11+, vn)
|
VK_KHR_cooperative_matrix DONE (anv, nvk/Turing+, radv/gfx11+, vn)
|
||||||
VK_KHR_depth_clamp_zero_one DONE (anv, nvk, panvk, radv, vn)
|
VK_KHR_depth_clamp_zero_one DONE (anv, nvk, panvk, radv, vn)
|
||||||
|
|
@ -600,7 +600,7 @@ Khronos extensions that are not part of any Vulkan version:
|
||||||
VK_EXT_blend_operation_advanced DONE (vn)
|
VK_EXT_blend_operation_advanced DONE (vn)
|
||||||
VK_EXT_border_color_swizzle DONE (anv, hasvk, hk, lvp, nvk, panvk, pvr, radv/gfx10+, tu, v3dv, vn)
|
VK_EXT_border_color_swizzle DONE (anv, hasvk, hk, lvp, nvk, panvk, pvr, radv/gfx10+, tu, v3dv, vn)
|
||||||
VK_EXT_buffer_device_address DONE (anv, dzn/sm6.6+, hasvk, hk, nvk, panvk, radv, vn)
|
VK_EXT_buffer_device_address DONE (anv, dzn/sm6.6+, hasvk, hk, nvk, panvk, radv, vn)
|
||||||
VK_EXT_calibrated_timestamps DONE (anv, hasvk, hk, nvk, panvk/v10+, lvp, radv, vn, tu/a750+)
|
VK_EXT_calibrated_timestamps DONE (anv, hasvk, hk, kk, nvk, panvk/v10+, lvp, radv, vn, tu/a750+)
|
||||||
VK_EXT_color_write_enable DONE (anv, hasvk, hk, lvp, nvk, pvr, radv, tu, v3dv, vn)
|
VK_EXT_color_write_enable DONE (anv, hasvk, hk, lvp, nvk, pvr, radv, tu, v3dv, vn)
|
||||||
VK_EXT_conditional_rendering DONE (anv, hasvk, lvp, nvk, radv, tu, vn)
|
VK_EXT_conditional_rendering DONE (anv, hasvk, lvp, nvk, radv, tu, vn)
|
||||||
VK_EXT_conservative_rasterization DONE (anv, nvk, radv, vn, tu/a7xx+)
|
VK_EXT_conservative_rasterization DONE (anv, nvk, radv, vn, tu/a7xx+)
|
||||||
|
|
|
||||||
|
|
@ -163,6 +163,15 @@ kk_parse_device_environment_options(struct kk_device *dev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VkResult
|
||||||
|
kk_get_timestamp(struct vk_device *device, uint64_t *timestamp)
|
||||||
|
{
|
||||||
|
struct kk_device *dev = container_of(device, struct kk_device, vk);
|
||||||
|
|
||||||
|
*timestamp = mtl_device_get_gpu_timestamp(dev->mtl_handle);
|
||||||
|
return VK_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
VKAPI_ATTR VkResult VKAPI_CALL
|
VKAPI_ATTR VkResult VKAPI_CALL
|
||||||
kk_CreateDevice(VkPhysicalDevice physicalDevice,
|
kk_CreateDevice(VkPhysicalDevice physicalDevice,
|
||||||
const VkDeviceCreateInfo *pCreateInfo,
|
const VkDeviceCreateInfo *pCreateInfo,
|
||||||
|
|
@ -204,6 +213,7 @@ kk_CreateDevice(VkPhysicalDevice physicalDevice,
|
||||||
dev->mtl_handle = pdev->mtl_dev_handle;
|
dev->mtl_handle = pdev->mtl_dev_handle;
|
||||||
dev->vk.command_buffer_ops = &kk_cmd_buffer_ops;
|
dev->vk.command_buffer_ops = &kk_cmd_buffer_ops;
|
||||||
dev->vk.command_dispatch_table = &dev->vk.dispatch_table;
|
dev->vk.command_dispatch_table = &dev->vk.dispatch_table;
|
||||||
|
dev->vk.get_timestamp = kk_get_timestamp;
|
||||||
|
|
||||||
/* We need to initialize the device residency set before any bo is created. */
|
/* We need to initialize the device residency set before any bo is created. */
|
||||||
simple_mtx_init(&dev->residency_set.mutex, mtx_plain);
|
simple_mtx_init(&dev->residency_set.mutex, mtx_plain);
|
||||||
|
|
@ -287,51 +297,6 @@ kk_DestroyDevice(VkDevice _device, const VkAllocationCallbacks *pAllocator)
|
||||||
vk_free(&dev->vk.alloc, dev);
|
vk_free(&dev->vk.alloc, dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
VKAPI_ATTR VkResult VKAPI_CALL
|
|
||||||
kk_GetCalibratedTimestampsKHR(
|
|
||||||
VkDevice _device, uint32_t timestampCount,
|
|
||||||
const VkCalibratedTimestampInfoKHR *pTimestampInfos, uint64_t *pTimestamps,
|
|
||||||
uint64_t *pMaxDeviation)
|
|
||||||
{
|
|
||||||
uint64_t max_clock_period = 0;
|
|
||||||
uint64_t begin, end;
|
|
||||||
int d;
|
|
||||||
|
|
||||||
#ifdef CLOCK_MONOTONIC_RAW
|
|
||||||
begin = vk_clock_gettime(CLOCK_MONOTONIC_RAW);
|
|
||||||
#else
|
|
||||||
begin = vk_clock_gettime(CLOCK_MONOTONIC);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (d = 0; d < timestampCount; d++) {
|
|
||||||
switch (pTimestampInfos[d].timeDomain) {
|
|
||||||
case VK_TIME_DOMAIN_CLOCK_MONOTONIC_KHR:
|
|
||||||
pTimestamps[d] = vk_clock_gettime(CLOCK_MONOTONIC);
|
|
||||||
max_clock_period = MAX2(max_clock_period, 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
#ifdef CLOCK_MONOTONIC_RAW
|
|
||||||
case VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_KHR:
|
|
||||||
pTimestamps[d] = begin;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
|
||||||
pTimestamps[d] = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CLOCK_MONOTONIC_RAW
|
|
||||||
end = vk_clock_gettime(CLOCK_MONOTONIC_RAW);
|
|
||||||
#else
|
|
||||||
end = vk_clock_gettime(CLOCK_MONOTONIC);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
*pMaxDeviation = vk_time_max_deviation(begin, end, max_clock_period);
|
|
||||||
|
|
||||||
return VK_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We need to implement this ourselves so we give the fake ones for vk_common_*
|
/* We need to implement this ourselves so we give the fake ones for vk_common_*
|
||||||
* to work when executing actual commands */
|
* to work when executing actual commands */
|
||||||
static PFN_vkVoidFunction
|
static PFN_vkVoidFunction
|
||||||
|
|
|
||||||
|
|
@ -122,6 +122,7 @@ kk_get_device_extensions(const struct kk_instance *instance,
|
||||||
.EXT_vertex_attribute_divisor = true,
|
.EXT_vertex_attribute_divisor = true,
|
||||||
|
|
||||||
/* Optional extensions */
|
/* Optional extensions */
|
||||||
|
.KHR_calibrated_timestamps = true,
|
||||||
.KHR_shader_maximal_reconvergence = true,
|
.KHR_shader_maximal_reconvergence = true,
|
||||||
.KHR_shader_relaxed_extended_instruction = true,
|
.KHR_shader_relaxed_extended_instruction = true,
|
||||||
.KHR_shader_subgroup_uniform_control_flow = true,
|
.KHR_shader_subgroup_uniform_control_flow = true,
|
||||||
|
|
@ -131,6 +132,7 @@ kk_get_device_extensions(const struct kk_instance *instance,
|
||||||
#endif
|
#endif
|
||||||
.KHR_workgroup_memory_explicit_layout = true,
|
.KHR_workgroup_memory_explicit_layout = true,
|
||||||
|
|
||||||
|
.EXT_calibrated_timestamps = true,
|
||||||
.EXT_external_memory_metal = true,
|
.EXT_external_memory_metal = true,
|
||||||
.EXT_load_store_op_none = true,
|
.EXT_load_store_op_none = true,
|
||||||
.EXT_mutable_descriptor_type = true,
|
.EXT_mutable_descriptor_type = true,
|
||||||
|
|
@ -1003,31 +1005,6 @@ kk_GetPhysicalDeviceQueueFamilyProperties2(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const VkTimeDomainKHR kk_time_domains[] = {
|
|
||||||
VK_TIME_DOMAIN_DEVICE_KHR,
|
|
||||||
VK_TIME_DOMAIN_CLOCK_MONOTONIC_KHR,
|
|
||||||
#ifdef CLOCK_MONOTONIC_RAW
|
|
||||||
VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_KHR,
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
VKAPI_ATTR VkResult VKAPI_CALL
|
|
||||||
kk_GetPhysicalDeviceCalibrateableTimeDomainsKHR(VkPhysicalDevice physicalDevice,
|
|
||||||
uint32_t *pTimeDomainCount,
|
|
||||||
VkTimeDomainKHR *pTimeDomains)
|
|
||||||
{
|
|
||||||
VK_OUTARRAY_MAKE_TYPED(VkTimeDomainKHR, out, pTimeDomains, pTimeDomainCount);
|
|
||||||
|
|
||||||
for (int d = 0; d < ARRAY_SIZE(kk_time_domains); d++) {
|
|
||||||
vk_outarray_append_typed(VkTimeDomainKHR, &out, i)
|
|
||||||
{
|
|
||||||
*i = kk_time_domains[d];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return vk_outarray_status(&out);
|
|
||||||
}
|
|
||||||
|
|
||||||
VKAPI_ATTR void VKAPI_CALL
|
VKAPI_ATTR void VKAPI_CALL
|
||||||
kk_GetPhysicalDeviceMultisamplePropertiesEXT(
|
kk_GetPhysicalDeviceMultisamplePropertiesEXT(
|
||||||
VkPhysicalDevice physicalDevice, VkSampleCountFlagBits samples,
|
VkPhysicalDevice physicalDevice, VkSampleCountFlagBits samples,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue