radeonsi: add an async compute context
It'll be used exclusively for DRI_PRIME copies for now. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12763>
This commit is contained in:
parent
46c95047bd
commit
f895dc04a5
|
@ -153,6 +153,20 @@ void si_init_compiler(struct si_screen *sscreen, struct ac_llvm_compiler *compil
|
|||
compiler->low_opt_passes = ac_create_llvm_passes(compiler->low_opt_tm);
|
||||
}
|
||||
|
||||
void si_init_aux_async_compute_ctx(struct si_screen *sscreen)
|
||||
{
|
||||
assert(!sscreen->async_compute_context);
|
||||
sscreen->async_compute_context = si_create_context(
|
||||
&sscreen->b,
|
||||
SI_CONTEXT_FLAG_AUX |
|
||||
(sscreen->options.aux_debug ? PIPE_CONTEXT_DEBUG : 0) |
|
||||
PIPE_CONTEXT_COMPUTE_ONLY);
|
||||
|
||||
/* Limit the numbers of waves allocated for this context. */
|
||||
if (sscreen->async_compute_context)
|
||||
((struct si_context*)sscreen->async_compute_context)->cs_max_waves_per_sh = 2;
|
||||
}
|
||||
|
||||
static void si_destroy_compiler(struct ac_llvm_compiler *compiler)
|
||||
{
|
||||
ac_destroy_llvm_compiler(compiler);
|
||||
|
@ -784,6 +798,13 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, unsign
|
|||
sscreen->aux_context->set_log_context(sscreen->aux_context, aux_log);
|
||||
}
|
||||
simple_mtx_unlock(&sscreen->aux_context_lock);
|
||||
|
||||
simple_mtx_lock(&sscreen->async_compute_context_lock);
|
||||
if (status != PIPE_NO_RESET && sscreen->async_compute_context) {
|
||||
sscreen->async_compute_context->destroy(sscreen->async_compute_context);
|
||||
sscreen->async_compute_context = NULL;
|
||||
}
|
||||
simple_mtx_unlock(&sscreen->async_compute_context_lock);
|
||||
}
|
||||
|
||||
sctx->initial_gfx_cs_size = sctx->gfx_cs.current.cdw;
|
||||
|
@ -888,6 +909,11 @@ static void si_destroy_screen(struct pipe_screen *pscreen)
|
|||
sscreen->aux_context->destroy(sscreen->aux_context);
|
||||
}
|
||||
|
||||
simple_mtx_destroy(&sscreen->async_compute_context_lock);
|
||||
if (sscreen->async_compute_context) {
|
||||
sscreen->async_compute_context->destroy(sscreen->async_compute_context);
|
||||
}
|
||||
|
||||
util_queue_destroy(&sscreen->shader_compiler_queue);
|
||||
util_queue_destroy(&sscreen->shader_compiler_queue_low_priority);
|
||||
|
||||
|
@ -1120,6 +1146,7 @@ static struct pipe_screen *radeonsi_screen_create_impl(struct radeon_winsys *ws,
|
|||
}
|
||||
|
||||
(void)simple_mtx_init(&sscreen->aux_context_lock, mtx_plain);
|
||||
(void)simple_mtx_init(&sscreen->async_compute_context_lock, mtx_plain);
|
||||
(void)simple_mtx_init(&sscreen->gpu_load_mutex, mtx_plain);
|
||||
|
||||
si_init_gs_info(sscreen);
|
||||
|
|
|
@ -566,6 +566,10 @@ struct si_screen {
|
|||
struct pipe_context *aux_context;
|
||||
simple_mtx_t aux_context_lock;
|
||||
|
||||
/* Async compute context for DRI_PRIME copies. */
|
||||
struct pipe_context *async_compute_context;
|
||||
simple_mtx_t async_compute_context_lock;
|
||||
|
||||
/* This must be in the screen, because UE4 uses one context for
|
||||
* compilation and another one for rendering.
|
||||
*/
|
||||
|
@ -1459,6 +1463,7 @@ void si_init_compute_functions(struct si_context *sctx);
|
|||
|
||||
/* si_pipe.c */
|
||||
void si_init_compiler(struct si_screen *sscreen, struct ac_llvm_compiler *compiler);
|
||||
void si_init_aux_async_compute_ctx(struct si_screen *sscreen);
|
||||
|
||||
/* si_perfcounters.c */
|
||||
void si_init_perfcounters(struct si_screen *screen);
|
||||
|
|
Loading…
Reference in New Issue