diff --git a/docs/relnotes/new_features.txt b/docs/relnotes/new_features.txt index 05c3addae39..6f6db860075 100644 --- a/docs/relnotes/new_features.txt +++ b/docs/relnotes/new_features.txt @@ -59,3 +59,4 @@ VK_KHR_shader_float8 on RADV (RDNA4+) GL_EXT_window_rectangles on r600 GL_EXT_shader_image_load_store on r600/evergreen+ CL_UNORM_INT_101010_2 and cl_ext_image_unorm_int_2_101010 +timestamps on panvk/v10+ diff --git a/src/panfrost/vulkan/panvk_physical_device.c b/src/panfrost/vulkan/panvk_physical_device.c index 4752a13b682..9bdb1161795 100644 --- a/src/panfrost/vulkan/panvk_physical_device.c +++ b/src/panfrost/vulkan/panvk_physical_device.c @@ -220,6 +220,17 @@ get_device_sync_types(struct panvk_physical_device *device, return VK_SUCCESS; } +float +panvk_get_gpu_system_timestamp_period(const struct panvk_physical_device *device) +{ + if (!device->kmod.props.gpu_can_query_timestamp || + !device->kmod.props.timestamp_frequency) + return 0; + + const float ns_per_s = 1000000000.0; + return ns_per_s / (float)device->kmod.props.timestamp_frequency; +} + void panvk_physical_device_finish(struct panvk_physical_device *device) { @@ -396,7 +407,10 @@ panvk_GetPhysicalDeviceQueueFamilyProperties2( /* On v10+ we can support up to 127 queues but this causes timeout on some CTS tests */ .queueCount = arch >= 10 ? 2 : 1, - .timestampValidBits = 0, + .timestampValidBits = + arch >= 10 && physical_device->kmod.props.gpu_can_query_timestamp + ? 64 + : 0, .minImageTransferGranularity = (VkExtent3D){1, 1, 1}, }; diff --git a/src/panfrost/vulkan/panvk_physical_device.h b/src/panfrost/vulkan/panvk_physical_device.h index a36f3def1db..747a81e6e32 100644 --- a/src/panfrost/vulkan/panvk_physical_device.h +++ b/src/panfrost/vulkan/panvk_physical_device.h @@ -77,6 +77,9 @@ to_panvk_physical_device(struct vk_physical_device *phys_dev) return container_of(phys_dev, struct panvk_physical_device, vk); } +float panvk_get_gpu_system_timestamp_period( + const struct panvk_physical_device *device); + VkResult panvk_physical_device_init(struct panvk_physical_device *device, struct panvk_instance *instance, drmDevicePtr drm_device); diff --git a/src/panfrost/vulkan/panvk_vX_physical_device.c b/src/panfrost/vulkan/panvk_vX_physical_device.c index d2b45c99521..27d1243fbb4 100644 --- a/src/panfrost/vulkan/panvk_vX_physical_device.c +++ b/src/panfrost/vulkan/panvk_vX_physical_device.c @@ -712,8 +712,8 @@ panvk_per_arch(get_physical_device_properties)( .sampledImageStencilSampleCounts = sample_counts, .storageImageSampleCounts = VK_SAMPLE_COUNT_1_BIT, .maxSampleMaskWords = 1, - .timestampComputeAndGraphics = false, - .timestampPeriod = 0, + .timestampComputeAndGraphics = PAN_ARCH >= 10 && device->kmod.props.gpu_can_query_timestamp, + .timestampPeriod = PAN_ARCH >= 10 ? panvk_get_gpu_system_timestamp_period(device) : 0, .maxClipDistances = 0, .maxCullDistances = 0, .maxCombinedClipAndCullDistances = 0,