util/u_trace: Add u_trace_move()

Destructively copy trace contents to another trace, transfering
ownership of resources. This will be useful for turnip.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35751>
This commit is contained in:
Connor Abbott 2025-06-16 14:26:54 -04:00 committed by Marge Bot
parent 10ae673368
commit 7791b5286c
2 changed files with 11 additions and 0 deletions

View file

@ -793,6 +793,16 @@ u_trace_init(struct u_trace *ut, struct u_trace_context *utctx)
list_inithead(&ut->trace_chunks);
}
void
u_trace_move(struct u_trace *dst, struct u_trace *src)
{
dst->utctx = src->utctx;
list_replace(&src->trace_chunks, &dst->trace_chunks);
dst->num_traces = src->num_traces;
src->num_traces = 0;
list_delinit(&src->trace_chunks);
}
void
u_trace_fini(struct u_trace *ut)
{

View file

@ -300,6 +300,7 @@ void u_trace_context_fini(struct u_trace_context *utctx);
void u_trace_context_process(struct u_trace_context *utctx, bool eof);
void u_trace_init(struct u_trace *ut, struct u_trace_context *utctx);
void u_trace_move(struct u_trace *dst, struct u_trace *src);
void u_trace_fini(struct u_trace *ut);
void u_trace_state_init(void);