diff --git a/docs/features.txt b/docs/features.txt index 3618738a484..4136061e3b5 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -307,7 +307,7 @@ Khronos, ARB, and OES extensions that are not part of any OpenGL or OpenGL ES ve GL_ARB_sample_locations DONE (freedreno/a6xx, nvc0, zink) GL_ARB_seamless_cubemap_per_texture DONE (etnaviv/SEAMLESS_CUBE_MAP, freedreno, nvc0, r600, radeonsi, softpipe, virgl, zink, asahi, iris, crocus) GL_ARB_shader_ballot DONE (nvc0, radeonsi, zink, iris, crocus/gen8, d3d12, asahi) - GL_ARB_shader_clock DONE (freedreno/a6xx, nv50, nvc0, r600, radeonsi, llvmpipe, virgl, zink, iris, crocus/gen7+) + GL_ARB_shader_clock DONE (freedreno/a6xx, nv50, nvc0, r600, radeonsi, llvmpipe, virgl, panfrost, zink, iris, crocus/gen7+) GL_ARB_shader_stencil_export DONE (r600, radeonsi, softpipe, llvmpipe, virgl, panfrost, zink, asahi, iris/gen9+) GL_ARB_shader_viewport_layer_array DONE (freedreno/a6xx, nvc0, radeonsi, zink, iris, crocus/gen6+, asahi) GL_ARB_shading_language_include DONE diff --git a/docs/relnotes/new_features.txt b/docs/relnotes/new_features.txt index 3d53ab347b2..24ba8462f58 100644 --- a/docs/relnotes/new_features.txt +++ b/docs/relnotes/new_features.txt @@ -28,4 +28,5 @@ KHR_partial_update on etnaviv VK_KHR_line_rasterization on panvk shaderImageGatherExtended on panvk textureCompressionBC on panvk -VK_EXT_sample_locations on RADV for GFX10+ \ No newline at end of file +VK_EXT_sample_locations on RADV for GFX10+ +GL_ARB_shader_clock on panvk diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c index a043fbe4df9..b2c5d49db69 100644 --- a/src/gallium/drivers/panfrost/pan_screen.c +++ b/src/gallium/drivers/panfrost/pan_screen.c @@ -514,7 +514,7 @@ panfrost_init_screen_caps(struct panfrost_screen *screen) * work to turn on, since CYCLE_COUNT_START needs to be issued. In * kbase, userspace requests this via BASE_JD_REQ_PERMON. There is not * yet way to request this with mainline TODO */ - caps->shader_clock = false; + caps->shader_clock = dev->arch >= 6; caps->vs_instanceid = true; caps->texture_multisample = true; diff --git a/src/panfrost/compiler/bifrost_compile.c b/src/panfrost/compiler/bifrost_compile.c index 350fd1f397c..51525433d4d 100644 --- a/src/panfrost/compiler/bifrost_compile.c +++ b/src/panfrost/compiler/bifrost_compile.c @@ -2187,6 +2187,7 @@ bi_emit_intrinsic(bi_builder *b, nir_intrinsic_instr *instr) break; case nir_intrinsic_shader_clock: + assert(nir_intrinsic_memory_scope(instr) == SCOPE_SUBGROUP); bi_ld_gclk_u64_to(b, dst, BI_SOURCE_CYCLE_COUNTER); bi_split_def(b, &instr->def); break; diff --git a/src/panfrost/compiler/valhall/ISA.xml b/src/panfrost/compiler/valhall/ISA.xml index 0047ca5f7dd..5c5c0135975 100644 --- a/src/panfrost/compiler/valhall/ISA.xml +++ b/src/panfrost/compiler/valhall/ISA.xml @@ -733,6 +733,20 @@ retrieve + + + Clock source for LD_GCLK instruction. + + + + + + + + cycle_counter + system_timestamp + + In-memory format of varyings. @@ -1018,6 +1032,13 @@ Index and table + + Load the 64-bit global clock, either a cycle counter or the system clock. + + + + + Load `vecsize` components from the texture descriptor at entry `index` diff --git a/src/panfrost/compiler/valhall/va_pack.c b/src/panfrost/compiler/valhall/va_pack.c index e241f99a375..265c24622b6 100644 --- a/src/panfrost/compiler/valhall/va_pack.c +++ b/src/panfrost/compiler/valhall/va_pack.c @@ -677,6 +677,19 @@ va_pack_byte_offset_8(const bi_instr *I) return ((uint64_t)offset) << 8; } +static uint64_t +va_pack_gclk(const bi_instr *I) +{ + switch (I->source) { + case BI_SOURCE_CYCLE_COUNTER: + return VA_SOURCE_CYCLE_COUNTER; + case BI_SOURCE_SYSTEM_TIMESTAMP: + return VA_SOURCE_SYSTEM_TIMESTAMP; + } + + invalid_instruction(I, "source"); +} + static uint64_t va_pack_load(const bi_instr *I, bool buffer_descriptor) { @@ -920,6 +933,10 @@ va_pack_instr(const bi_instr *I, unsigned arch) break; } + case BI_OPCODE_LD_GCLK_U64: + hex |= va_pack_gclk(I); + break; + case BI_OPCODE_TEX_GRADIENT: case BI_OPCODE_TEX_SINGLE: case BI_OPCODE_TEX_FETCH: