From 5681fabdc26b742856fe3f308df76448c3a6f3ae Mon Sep 17 00:00:00 2001 From: Ashley Smith Date: Thu, 16 Oct 2025 14:22:17 +0100 Subject: [PATCH] panfrost,panvk: Enable shader_realtime_clock on panthor 1.6 shader_realtime_clock requires a newer kernel version in order to enable GLB_COUNTER_EN this change adds a check on this kernel functionality. Remove GL_EXT_shader_realtime_clock from extensions as this now depends on kernel version. Fixes: e9c2c324 ("panvk: enable VK_KHR_shader_clock") Signed-off-by: Ashley Smith Reviewed-by: Daniel Stone Part-of: --- src/gallium/drivers/panfrost/pan_screen.c | 3 ++- src/panfrost/ci/panfrost-g610-gles2-extensions.txt | 1 - src/panfrost/lib/kmod/pan_kmod.h | 3 +++ src/panfrost/lib/kmod/panfrost_kmod.c | 3 +++ src/panfrost/lib/kmod/panthor_kmod.c | 4 ++++ src/panfrost/vulkan/panvk_vX_physical_device.c | 2 +- 6 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c index 830d2c98d33..fc3f5be2900 100644 --- a/src/gallium/drivers/panfrost/pan_screen.c +++ b/src/gallium/drivers/panfrost/pan_screen.c @@ -729,7 +729,8 @@ panfrost_init_screen_caps(struct panfrost_screen *screen) caps->shader_clock = dev->arch >= 6 && dev->kmod.props.gpu_can_query_timestamp; caps->shader_realtime_clock = dev->arch >= 6 && - dev->kmod.props.gpu_can_query_timestamp; + dev->kmod.props.gpu_can_query_timestamp && + dev->kmod.props.timestamp_device_coherent; /* pixel_local_storage is initially for valhall and bifrost only */ caps->shader_pixel_local_storage_fast_size = diff --git a/src/panfrost/ci/panfrost-g610-gles2-extensions.txt b/src/panfrost/ci/panfrost-g610-gles2-extensions.txt index c684b25453f..1c86623c367 100644 --- a/src/panfrost/ci/panfrost-g610-gles2-extensions.txt +++ b/src/panfrost/ci/panfrost-g610-gles2-extensions.txt @@ -46,7 +46,6 @@ GL_EXT_shader_implicit_conversions GL_EXT_shader_integer_mix GL_EXT_shader_io_blocks GL_EXT_shader_pixel_local_storage -GL_EXT_shader_realtime_clock GL_EXT_shadow_samplers GL_EXT_sRGB GL_EXT_sRGB_write_control diff --git a/src/panfrost/lib/kmod/pan_kmod.h b/src/panfrost/lib/kmod/pan_kmod.h index 304e6f279c8..d763376ece9 100644 --- a/src/panfrost/lib/kmod/pan_kmod.h +++ b/src/panfrost/lib/kmod/pan_kmod.h @@ -205,6 +205,9 @@ struct pan_kmod_dev_props { /* Support cycle count and timestamp propagation as job requirement */ bool gpu_can_query_timestamp; + /* Cycle counter and timestamp device coherent propogation is enabled */ + bool timestamp_device_coherent; + /* GPU Timestamp frequency */ uint64_t timestamp_frequency; diff --git a/src/panfrost/lib/kmod/panfrost_kmod.c b/src/panfrost/lib/kmod/panfrost_kmod.c index df69090f319..df5382f5793 100644 --- a/src/panfrost/lib/kmod/panfrost_kmod.c +++ b/src/panfrost/lib/kmod/panfrost_kmod.c @@ -211,6 +211,9 @@ panfrost_dev_query_props(const struct pan_kmod_dev *dev, fd, DRM_PANFROST_PARAM_SYSTEM_TIMESTAMP_FREQUENCY, true, 0); } + /* Device coherent timestamps are always enabled on panfrost */ + props->timestamp_device_coherent = true; + /* Support for priorities was added in panfrost 1.5, assumes default * priority as medium if the param doesn't exist. */ uint64_t prios = diff --git a/src/panfrost/lib/kmod/panthor_kmod.c b/src/panfrost/lib/kmod/panthor_kmod.c index 17a51c492b9..ba35915a7d7 100644 --- a/src/panfrost/lib/kmod/panthor_kmod.c +++ b/src/panfrost/lib/kmod/panthor_kmod.c @@ -286,6 +286,10 @@ panthor_dev_query_props(const struct pan_kmod_dev *dev, panthor_dev->props.group_priorities.allowed_mask), }; + if (dev->driver.version.major > 1 || dev->driver.version.minor >= 6) { + props->timestamp_device_coherent = true; + } + static_assert(sizeof(props->texture_features) == sizeof(panthor_dev->props.gpu.texture_features), "Mismatch in texture_features array size"); diff --git a/src/panfrost/vulkan/panvk_vX_physical_device.c b/src/panfrost/vulkan/panvk_vX_physical_device.c index c9ddd6be137..07e4994d79c 100644 --- a/src/panfrost/vulkan/panvk_vX_physical_device.c +++ b/src/panfrost/vulkan/panvk_vX_physical_device.c @@ -493,7 +493,7 @@ panvk_per_arch(get_physical_device_features)( /* VK_KHR_shader_clock */ .shaderSubgroupClock = device->kmod.props.gpu_can_query_timestamp, - .shaderDeviceClock = device->kmod.props.gpu_can_query_timestamp, + .shaderDeviceClock = device->kmod.props.timestamp_device_coherent, /* VK_KHR_shader_quad_control */ .shaderQuadControl = true,