mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 06:30:10 +01:00
radeonsi: execute clears at resource allocation using compute instead of gfx
This adds an additional aux_context, so that the gfx queue isn't stalled due to clearing buffers or initializing DCC. This aux context will only be used by resource_create, which will allow us to remove all barriers around the clears because there are no others users of those buffers on that context. Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31291>
This commit is contained in:
parent
c99b55092f
commit
58b512ddd6
4 changed files with 9 additions and 5 deletions
|
|
@ -191,13 +191,13 @@ bool si_alloc_resource(struct si_screen *sscreen, struct si_resource *res)
|
|||
}
|
||||
|
||||
if (res->b.b.flags & SI_RESOURCE_FLAG_CLEAR) {
|
||||
struct si_context *ctx = si_get_aux_context(&sscreen->aux_context.general);
|
||||
struct si_context *ctx = si_get_aux_context(&sscreen->aux_context.compute_resource_init);
|
||||
uint32_t value = 0;
|
||||
|
||||
si_clear_buffer(ctx, &res->b.b, 0, res->bo_size, &value, 4, SI_AUTO_SELECT_CLEAR_METHOD,
|
||||
false);
|
||||
si_barrier_after_simple_buffer_op(ctx, 0, &res->b.b, NULL);
|
||||
si_put_aux_context_flush(&sscreen->aux_context.general);
|
||||
si_put_aux_context_flush(&sscreen->aux_context.compute_resource_init);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -1472,6 +1472,7 @@ static struct pipe_screen *radeonsi_screen_create_impl(struct radeon_winsys *ws,
|
|||
(void)mtx_init(&sscreen->aux_contexts[i].lock, mtx_plain | mtx_recursive);
|
||||
|
||||
bool compute = !sscreen->info.has_graphics ||
|
||||
&sscreen->aux_contexts[i] == &sscreen->aux_context.compute_resource_init ||
|
||||
&sscreen->aux_contexts[i] == &sscreen->aux_context.shader_upload;
|
||||
sscreen->aux_contexts[i].ctx =
|
||||
si_create_context(&sscreen->b,
|
||||
|
|
|
|||
|
|
@ -559,13 +559,16 @@ struct si_screen {
|
|||
struct {
|
||||
struct si_aux_context general;
|
||||
|
||||
/* Used by resource_create to clear/initialize memory. */
|
||||
struct si_aux_context compute_resource_init;
|
||||
|
||||
/* Second auxiliary context for uploading shaders. When the first auxiliary context is
|
||||
* locked and wants to compile and upload shaders, we need to use a second auxiliary
|
||||
* context because the first one is locked.
|
||||
*/
|
||||
struct si_aux_context shader_upload;
|
||||
} aux_context;
|
||||
struct si_aux_context aux_contexts[2];
|
||||
struct si_aux_context aux_contexts[3];
|
||||
};
|
||||
|
||||
/* Async compute context for DRI_PRIME copies. */
|
||||
|
|
|
|||
|
|
@ -1280,12 +1280,12 @@ static struct si_texture *si_texture_create_object(struct pipe_screen *screen,
|
|||
|
||||
/* Execute the clears. */
|
||||
if (num_clears) {
|
||||
struct si_context *sctx = si_get_aux_context(&sscreen->aux_context.general);
|
||||
struct si_context *sctx = si_get_aux_context(&sscreen->aux_context.compute_resource_init);
|
||||
|
||||
si_barrier_before_image_fast_clear(sctx, 0);
|
||||
si_execute_clears(sctx, clears, num_clears, false);
|
||||
si_barrier_after_image_fast_clear(sctx);
|
||||
si_put_aux_context_flush(&sscreen->aux_context.general);
|
||||
si_put_aux_context_flush(&sscreen->aux_context.compute_resource_init);
|
||||
}
|
||||
|
||||
/* Initialize the CMASK base register value. */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue