From 6596cf08e4e9b9ef81a56bae79a6d8b3af9ef124 Mon Sep 17 00:00:00 2001 From: "Juan A. Suarez Romero" Date: Fri, 4 Jul 2025 16:30:18 +0200 Subject: [PATCH] v3d: implement robust buffer access MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is the last piece to expose KHR_robustness. The main bulk of the job is done already in the broadcom compiler through lowerings, so we only need to set the proper key in order to enable the robustness. Signed-off-by: Juan A. Suarez Romero Reviewed-by: Jose Maria Casanova Crespo Reviewed-by: Iago Toral Quiroga Reviewed-by: MaĆ­ra Canal Part-of: --- docs/features.txt | 4 ++-- docs/relnotes/new_features.txt | 1 + src/gallium/drivers/v3d/v3d_context.c | 1 + src/gallium/drivers/v3d/v3d_context.h | 4 ++++ src/gallium/drivers/v3d/v3d_program.c | 3 +++ src/gallium/drivers/v3d/v3d_screen.c | 1 + 6 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/features.txt b/docs/features.txt index dec7065c3de..470d40a75dc 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -222,7 +222,7 @@ GL 4.5, GLSL 4.50 -- all DONE: freedreno/a6xx, nvc0, r600, radeonsi, llvmpipe, v GL_ARB_shader_texture_image_samples DONE (freedreno/a3xx+, nv50, crocus/gen7+) GL_ARB_texture_barrier DONE (freedreno, nv50, v3d, vc4, lima, crocus) GL_KHR_context_flush_control DONE (all - but needs GLX/EGL extension to be useful) - GL_KHR_robustness DONE (freedreno, panfrost) + GL_KHR_robustness DONE (freedreno, panfrost, v3d) GL_EXT_shader_integer_mix DONE (all drivers that support GLSL) GL 4.6, GLSL 4.60 -- all DONE: radeonsi, virgl, zink, iris, crocus/gen7+, d3d12, asahi, r600/evergreen+ @@ -273,7 +273,7 @@ GLES3.2, GLSL ES 3.2 -- all DONE: freedreno/a6xx, radeonsi, virgl, llvmpipe, zin GL_EXT_color_buffer_float DONE (all drivers) GL_KHR_blend_equation_advanced DONE (freedreno/a6xx, nvc0, panfrost, crocus/gen4.5+, v3d) GL_KHR_debug DONE (all drivers) - GL_KHR_robustness DONE (freedreno, nvc0, panfrost, r600) + GL_KHR_robustness DONE (freedreno, nvc0, panfrost, r600, v3d) GL_KHR_texture_compression_astc_ldr DONE (freedreno, r600, v3d, vc4, panfrost, softpipe, lima, crocus/gen6+) GL_OES_copy_image DONE (all drivers) GL_OES_draw_buffers_indexed DONE (all drivers that support GL_ARB_draw_buffers_blend) diff --git a/docs/relnotes/new_features.txt b/docs/relnotes/new_features.txt index bd0041a8bc7..a53c3614ea8 100644 --- a/docs/relnotes/new_features.txt +++ b/docs/relnotes/new_features.txt @@ -1,3 +1,4 @@ EGL_EXT_create_context_robustness support on Panfrost V10+ GL_ARB_robust_buffer_access_behavior, GL_KHR_robust_buffer_access_behavior and GL_KHR_robustness support on Panfrost VK_EXT_mutable_descriptor_type on panvk/v9+ +GL_KHR_robustness on v3d diff --git a/src/gallium/drivers/v3d/v3d_context.c b/src/gallium/drivers/v3d/v3d_context.c index 49221719c21..e5debd40112 100644 --- a/src/gallium/drivers/v3d/v3d_context.c +++ b/src/gallium/drivers/v3d/v3d_context.c @@ -465,6 +465,7 @@ v3d_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags) slab_create_child(&v3d->transfer_pool, &screen->transfer_pool); + v3d->robust_buffer = flags & PIPE_CONTEXT_ROBUST_BUFFER_ACCESS; if (screen->devinfo.has_reset_counter) { pctx->get_device_reset_status = v3d_get_device_reset_status; v3d->global_reset_count = v3d_get_reset_count(v3d, false); diff --git a/src/gallium/drivers/v3d/v3d_context.h b/src/gallium/drivers/v3d/v3d_context.h index b16cdd627ac..6a7accdcbfa 100644 --- a/src/gallium/drivers/v3d/v3d_context.h +++ b/src/gallium/drivers/v3d/v3d_context.h @@ -669,6 +669,10 @@ struct v3d_context { bool active_queries; + /* Whether a context with robust buffer access should be created. + */ + bool robust_buffer; + /* How many GPU resets happened since the driver was proved, and how * many were caused by this context. */ diff --git a/src/gallium/drivers/v3d/v3d_program.c b/src/gallium/drivers/v3d/v3d_program.c index 5940b212391..c44ecb79f0d 100644 --- a/src/gallium/drivers/v3d/v3d_program.c +++ b/src/gallium/drivers/v3d/v3d_program.c @@ -579,6 +579,9 @@ v3d_setup_shared_key(struct v3d_context *v3d, struct v3d_key *key, if (return_size == 32) key->sampler_is_32b |= (1 << i); } + + key->robust_uniform_access = v3d->robust_buffer; + key->robust_storage_access = v3d->robust_buffer; } static void diff --git a/src/gallium/drivers/v3d/v3d_screen.c b/src/gallium/drivers/v3d/v3d_screen.c index 39a329a3341..da264ae66a8 100644 --- a/src/gallium/drivers/v3d/v3d_screen.c +++ b/src/gallium/drivers/v3d/v3d_screen.c @@ -390,6 +390,7 @@ v3d_init_screen_caps(struct v3d_screen *screen) caps->max_texture_lod_bias = 16.0f; caps->device_reset_status_query = screen->devinfo.has_reset_counter; + caps->robust_buffer_access_behavior = true; } static bool