radeonsi: update pipe_screen::num_contexts

This allows skipping mutex locking. Don't take the aux context into account.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9356>
This commit is contained in:
Marek Olšák 2021-02-11 15:00:01 -05:00 committed by Marge Bot
parent 981e55d530
commit e6a0f243ea
2 changed files with 18 additions and 5 deletions

View File

@ -330,6 +330,10 @@ static void si_destroy_context(struct pipe_context *context)
util_dynarray_fini(&sctx->resident_tex_needs_color_decompress);
util_dynarray_fini(&sctx->resident_img_needs_color_decompress);
util_dynarray_fini(&sctx->resident_tex_needs_depth_decompress);
if (!(sctx->context_flags & SI_CONTEXT_FLAG_AUX))
p_atomic_dec(&context->screen->num_contexts);
FREE(sctx);
}
@ -466,6 +470,7 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, unsign
sctx->b.destroy = si_destroy_context;
sctx->screen = sscreen; /* Easy accessing of screen/winsys. */
sctx->is_debug = (flags & PIPE_CONTEXT_DEBUG) != 0;
sctx->context_flags = flags;
slab_create_child(&sctx->pool_transfers, &sscreen->pool_transfers);
slab_create_child(&sctx->pool_transfers_unsync, &sscreen->pool_transfers);
@ -603,9 +608,7 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, unsign
si_init_draw_functions(sctx);
/* If aux_context == NULL, we are initializing aux_context right now. */
bool is_aux_context = !sscreen->aux_context;
si_initialize_prim_discard_tunables(sscreen, is_aux_context,
si_initialize_prim_discard_tunables(sscreen, flags & SI_CONTEXT_FLAG_AUX,
&sctx->prim_discard_vertex_count_threshold,
&sctx->index_ring_size_per_ib);
} else {
@ -736,6 +739,9 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, unsign
&clear_value, 4, SI_COHERENCY_SHADER, SI_CP_DMA_CLEAR_METHOD);
}
if (!(flags & SI_CONTEXT_FLAG_AUX))
p_atomic_inc(&screen->num_contexts);
sctx->initial_gfx_cs_size = sctx->gfx_cs.current.cdw;
return &sctx->b;
fail:
@ -1320,8 +1326,11 @@ static struct pipe_screen *radeonsi_screen_create_impl(struct radeon_winsys *ws,
/* Create the auxiliary context. This must be done last. */
sscreen->aux_context = si_create_context(
&sscreen->b, (sscreen->options.aux_debug ? PIPE_CONTEXT_DEBUG : 0) |
(sscreen->info.has_graphics ? 0 : PIPE_CONTEXT_COMPUTE_ONLY));
&sscreen->b,
SI_CONTEXT_FLAG_AUX |
(sscreen->options.aux_debug ? PIPE_CONTEXT_DEBUG : 0) |
(sscreen->info.has_graphics ? 0 : PIPE_CONTEXT_COMPUTE_ONLY));
if (sscreen->options.aux_debug) {
struct u_log_context *log = CALLOC_STRUCT(u_log_context);
u_log_context_init(log);

View File

@ -112,6 +112,8 @@ extern "C" {
#define SI_MAP_BUFFER_ALIGNMENT 64
#define SI_MAX_VARIABLE_THREADS_PER_BLOCK 1024
#define SI_CONTEXT_FLAG_AUX (1u << 31)
#define SI_RESOURCE_FLAG_FORCE_LINEAR (PIPE_RESOURCE_FLAG_DRV_PRIV << 0)
#define SI_RESOURCE_FLAG_FLUSHED_DEPTH (PIPE_RESOURCE_FLAG_DRV_PRIV << 1)
#define SI_RESOURCE_FLAG_FORCE_MSAA_TILING (PIPE_RESOURCE_FLAG_DRV_PRIV << 2)
@ -1304,6 +1306,8 @@ struct si_context {
struct pipe_fence_handle *last_sqtt_fence;
enum rgp_sqtt_marker_event_type sqtt_next_event;
bool thread_trace_enabled;
unsigned context_flags;
};
/* si_blit.c */