mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-12-12 11:44:53 +08:00
radv: promote EXT_calibrated_timestamps to KHR
All functionality are similar. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26596>
This commit is contained in:
parent
c9e1758462
commit
ac20c70e9d
@ -16,3 +16,4 @@ GL_ARB_indirect_parameters on Asahi
|
||||
GL_ARB_viewport_array on Asahi
|
||||
GL_ARB_fragment_layer_viewport on Asahi
|
||||
GL_ARB_cull_distance on Asahi
|
||||
VK_KHR_calibrated_timestamps on RADV
|
||||
|
@ -2172,8 +2172,8 @@ radv_GetMemoryFdPropertiesKHR(VkDevice _device, VkExternalMemoryHandleTypeFlagBi
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
radv_GetCalibratedTimestampsEXT(VkDevice _device, uint32_t timestampCount,
|
||||
const VkCalibratedTimestampInfoEXT *pTimestampInfos, uint64_t *pTimestamps,
|
||||
radv_GetCalibratedTimestampsKHR(VkDevice _device, uint32_t timestampCount,
|
||||
const VkCalibratedTimestampInfoKHR *pTimestampInfos, uint64_t *pTimestamps,
|
||||
uint64_t *pMaxDeviation)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
@ -2191,18 +2191,18 @@ radv_GetCalibratedTimestampsEXT(VkDevice _device, uint32_t timestampCount,
|
||||
|
||||
for (d = 0; d < timestampCount; d++) {
|
||||
switch (pTimestampInfos[d].timeDomain) {
|
||||
case VK_TIME_DOMAIN_DEVICE_EXT:
|
||||
case VK_TIME_DOMAIN_DEVICE_KHR:
|
||||
pTimestamps[d] = device->ws->query_value(device->ws, RADEON_TIMESTAMP);
|
||||
uint64_t device_period = DIV_ROUND_UP(1000000, clock_crystal_freq);
|
||||
max_clock_period = MAX2(max_clock_period, device_period);
|
||||
break;
|
||||
case VK_TIME_DOMAIN_CLOCK_MONOTONIC_EXT:
|
||||
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_EXT:
|
||||
case VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_KHR:
|
||||
pTimestamps[d] = begin;
|
||||
break;
|
||||
#endif
|
||||
|
@ -83,6 +83,13 @@ radv_NV_device_generated_commands_enabled(const struct radv_physical_device *dev
|
||||
return driQueryOptionb(&device->instance->dri_options, "radv_dgc");
|
||||
}
|
||||
|
||||
static bool
|
||||
radv_calibrated_timestamps_enabled(const struct radv_physical_device *pdevice)
|
||||
{
|
||||
return RADV_SUPPORT_CALIBRATED_TIMESTAMPS &&
|
||||
!(pdevice->rad_info.family == CHIP_RAVEN || pdevice->rad_info.family == CHIP_RAVEN2);
|
||||
}
|
||||
|
||||
static bool
|
||||
radv_is_conformant(const struct radv_physical_device *pdevice)
|
||||
{
|
||||
@ -394,6 +401,7 @@ radv_physical_device_get_supported_extensions(const struct radv_physical_device
|
||||
.KHR_8bit_storage = true,
|
||||
.KHR_16bit_storage = true,
|
||||
.KHR_acceleration_structure = radv_enable_rt(device, false),
|
||||
.KHR_calibrated_timestamps = radv_calibrated_timestamps_enabled(device),
|
||||
.KHR_cooperative_matrix = device->rad_info.gfx_level >= GFX11 && !device->use_llvm,
|
||||
.KHR_bind_memory2 = true,
|
||||
.KHR_buffer_device_address = true,
|
||||
@ -482,8 +490,7 @@ radv_physical_device_get_supported_extensions(const struct radv_physical_device
|
||||
.EXT_attachment_feedback_loop_layout = true,
|
||||
.EXT_border_color_swizzle = device->rad_info.gfx_level >= GFX10,
|
||||
.EXT_buffer_device_address = true,
|
||||
.EXT_calibrated_timestamps = RADV_SUPPORT_CALIBRATED_TIMESTAMPS &&
|
||||
!(device->rad_info.family == CHIP_RAVEN || device->rad_info.family == CHIP_RAVEN2),
|
||||
.EXT_calibrated_timestamps = radv_calibrated_timestamps_enabled(device),
|
||||
.EXT_color_write_enable = true,
|
||||
.EXT_conditional_rendering = true,
|
||||
.EXT_conservative_rasterization = device->rad_info.gfx_level >= GFX9,
|
||||
@ -2341,23 +2348,23 @@ radv_GetPhysicalDeviceMemoryProperties2(VkPhysicalDevice physicalDevice,
|
||||
radv_get_memory_budget_properties(physicalDevice, memory_budget);
|
||||
}
|
||||
|
||||
static const VkTimeDomainEXT radv_time_domains[] = {
|
||||
VK_TIME_DOMAIN_DEVICE_EXT,
|
||||
VK_TIME_DOMAIN_CLOCK_MONOTONIC_EXT,
|
||||
static const VkTimeDomainKHR radv_time_domains[] = {
|
||||
VK_TIME_DOMAIN_DEVICE_KHR,
|
||||
VK_TIME_DOMAIN_CLOCK_MONOTONIC_KHR,
|
||||
#ifdef CLOCK_MONOTONIC_RAW
|
||||
VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT,
|
||||
VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_KHR,
|
||||
#endif
|
||||
};
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
radv_GetPhysicalDeviceCalibrateableTimeDomainsEXT(VkPhysicalDevice physicalDevice, uint32_t *pTimeDomainCount,
|
||||
VkTimeDomainEXT *pTimeDomains)
|
||||
radv_GetPhysicalDeviceCalibrateableTimeDomainsKHR(VkPhysicalDevice physicalDevice, uint32_t *pTimeDomainCount,
|
||||
VkTimeDomainKHR *pTimeDomains)
|
||||
{
|
||||
int d;
|
||||
VK_OUTARRAY_MAKE_TYPED(VkTimeDomainEXT, out, pTimeDomains, pTimeDomainCount);
|
||||
VK_OUTARRAY_MAKE_TYPED(VkTimeDomainKHR, out, pTimeDomains, pTimeDomainCount);
|
||||
|
||||
for (d = 0; d < ARRAY_SIZE(radv_time_domains); d++) {
|
||||
vk_outarray_append_typed(VkTimeDomainEXT, &out, i)
|
||||
vk_outarray_append_typed(VkTimeDomainKHR, &out, i)
|
||||
{
|
||||
*i = radv_time_domains[d];
|
||||
}
|
||||
|
@ -997,17 +997,17 @@ radv_get_calibrated_timestamps(struct radv_device *device, uint64_t *cpu_timesta
|
||||
uint64_t max_deviation;
|
||||
VkResult result;
|
||||
|
||||
const VkCalibratedTimestampInfoEXT timestamp_infos[2] = {{
|
||||
.sType = VK_STRUCTURE_TYPE_CALIBRATED_TIMESTAMP_INFO_EXT,
|
||||
.timeDomain = VK_TIME_DOMAIN_CLOCK_MONOTONIC_EXT,
|
||||
const VkCalibratedTimestampInfoKHR timestamp_infos[2] = {{
|
||||
.sType = VK_STRUCTURE_TYPE_CALIBRATED_TIMESTAMP_INFO_KHR,
|
||||
.timeDomain = VK_TIME_DOMAIN_CLOCK_MONOTONIC_KHR,
|
||||
},
|
||||
{
|
||||
.sType = VK_STRUCTURE_TYPE_CALIBRATED_TIMESTAMP_INFO_EXT,
|
||||
.timeDomain = VK_TIME_DOMAIN_DEVICE_EXT,
|
||||
.sType = VK_STRUCTURE_TYPE_CALIBRATED_TIMESTAMP_INFO_KHR,
|
||||
.timeDomain = VK_TIME_DOMAIN_DEVICE_KHR,
|
||||
}};
|
||||
|
||||
result =
|
||||
radv_GetCalibratedTimestampsEXT(radv_device_to_handle(device), 2, timestamp_infos, timestamps, &max_deviation);
|
||||
radv_GetCalibratedTimestampsKHR(radv_device_to_handle(device), 2, timestamp_infos, timestamps, &max_deviation);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user