From 8659666089c1eea363c6619f6767cefd8e45fa13 Mon Sep 17 00:00:00 2001 From: Qiang Yu Date: Thu, 17 Apr 2025 14:32:57 +0800 Subject: [PATCH] radeonsi: add si_mesh_resources_add_all_to_bo_list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák Part-of: --- src/gallium/drivers/radeonsi/si_descriptors.c | 25 +++++++++++++++++++ src/gallium/drivers/radeonsi/si_pipe.h | 1 + src/gallium/drivers/radeonsi/si_state.h | 1 + 3 files changed, 27 insertions(+) diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c index ae9fe11dbac..3e4745a749e 100644 --- a/src/gallium/drivers/radeonsi/si_descriptors.c +++ b/src/gallium/drivers/radeonsi/si_descriptors.c @@ -3103,6 +3103,30 @@ void si_compute_resources_add_all_to_bo_list(struct si_context *sctx) sctx->bo_list_add_all_compute_resources = false; } +void si_mesh_resources_add_all_to_bo_list(struct si_context *sctx) +{ + unsigned stages[] = { + MESA_SHADER_TASK, + MESA_SHADER_MESH, + MESA_SHADER_FRAGMENT, + }; + + for (unsigned i = 0; i < ARRAY_SIZE(stages); i++) { + unsigned sh = stages[i]; + si_buffer_resources_begin_new_cs(sctx, &sctx->const_and_shader_buffers[sh]); + si_sampler_views_begin_new_cs(sctx, &sctx->samplers[sh]); + si_image_views_begin_new_cs(sctx, &sctx->images[sh]); + } + + si_buffer_resources_begin_new_cs(sctx, &sctx->internal_bindings); + + if (sctx->bo_list_add_all_resident_resources) + si_resident_buffers_add_all_to_bo_list(sctx); + + assert(sctx->bo_list_add_all_mesh_resources); + sctx->bo_list_add_all_mesh_resources = false; +} + void si_add_all_descriptors_to_bo_list(struct si_context *sctx) { for (unsigned i = 0; i < SI_NUM_DESCS; ++i) @@ -3112,6 +3136,7 @@ void si_add_all_descriptors_to_bo_list(struct si_context *sctx) sctx->bo_list_add_all_resident_resources = true; si_mark_atom_dirty(sctx, &sctx->atoms.s.gfx_add_all_to_bo_list); sctx->bo_list_add_all_compute_resources = true; + sctx->bo_list_add_all_mesh_resources = true; } void si_set_active_descriptors(struct si_context *sctx, unsigned desc_idx, uint64_t new_active_mask) diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index ff2d62b8b70..b88f9c20801 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -1134,6 +1134,7 @@ struct si_context { struct si_images images[SI_NUM_SHADERS]; bool bo_list_add_all_resident_resources; bool bo_list_add_all_compute_resources; + bool bo_list_add_all_mesh_resources; /* tracked buffers for OpenCL */ int max_global_buffers; diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h index 5e0f55c52e3..3b5e98e9fde 100644 --- a/src/gallium/drivers/radeonsi/si_state.h +++ b/src/gallium/drivers/radeonsi/si_state.h @@ -600,6 +600,7 @@ void si_set_ring_buffer(struct si_context *sctx, uint slot, struct pipe_resource void si_init_all_descriptors(struct si_context *sctx); void si_release_all_descriptors(struct si_context *sctx); void si_compute_resources_add_all_to_bo_list(struct si_context *sctx); +void si_mesh_resources_add_all_to_bo_list(struct si_context *sctx); int si_gfx_resources_check_encrypted(struct si_context *sctx); bool si_compute_resources_check_encrypted(struct si_context *sctx); void si_shader_pointers_mark_dirty(struct si_context *sctx);