radeonsi: clean up set_log_context code for all aux contexts

Instead of allocating it and then leaking it, store the log context
in si_screen.

Also, the log context was only set for "general" instead of all aux
contexts.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30904>
This commit is contained in:
Marek Olšák 2024-09-14 10:07:20 -04:00 committed by Marge Bot
parent 2e1c278e3d
commit 1c156f7fa9
2 changed files with 6 additions and 9 deletions

View file

@ -17,7 +17,6 @@
#include "util/disk_cache.h"
#include "util/hex.h"
#include "util/u_cpu_detect.h"
#include "util/u_log.h"
#include "util/u_memory.h"
#include "util/u_suballoc.h"
#include "util/u_tests.h"
@ -841,12 +840,10 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, unsign
if (status != PIPE_NO_RESET) {
/* We lost the aux_context, create a new one */
unsigned context_flags = saux->context_flags;
struct u_log_context *aux_log = saux->log;
saux->b.set_log_context(&saux->b, NULL);
saux->b.destroy(&saux->b);
saux = (struct si_context *)si_create_context(&sscreen->b, context_flags);
saux->b.set_log_context(&saux->b, aux_log);
saux->b.set_log_context(&saux->b, &sscreen->aux_contexts[i].log);
sscreen->aux_contexts[i].ctx = &saux->b;
}
@ -1481,12 +1478,10 @@ static struct pipe_screen *radeonsi_screen_create_impl(struct radeon_winsys *ws,
(compute ? PIPE_CONTEXT_COMPUTE_ONLY : 0));
if (sscreen->options.aux_debug) {
struct u_log_context *log = CALLOC_STRUCT(u_log_context);
u_log_context_init(log);
u_log_context_init(&sscreen->aux_contexts[i].log);
struct si_context *sctx = si_get_aux_context(&sscreen->aux_context.general);
sctx->b.set_log_context(&sctx->b, log);
si_put_aux_context_flush(&sscreen->aux_context.general);
struct pipe_context *ctx = sscreen->aux_contexts[i].ctx;
ctx->set_log_context(ctx, &sscreen->aux_contexts[i].log);
}
}

View file

@ -12,6 +12,7 @@
#include "winsys/radeon_winsys.h"
#include "util/u_blitter.h"
#include "util/u_idalloc.h"
#include "util/u_log.h"
#include "util/u_suballoc.h"
#include "util/u_threaded_context.h"
#include "util/u_vertex_state_cache.h"
@ -498,6 +499,7 @@ struct radeon_saved_cs {
struct si_aux_context {
struct pipe_context *ctx;
struct u_log_context log;
mtx_t lock;
};