mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 04:48:08 +02:00
mesa/main: Add trace dispatch plumbing for MESA_VERBOSE=api
Reintroduce VERBOSE_API as a bit that will cause a parallel trace dispatch table to be installed at context create. The table itself is populated in a follow-up commit. This commit only wires the TLS-publish indirection via _mesa_set_dispatch(..). With Trace NULL (the common case), the helper is equivalent to a plain _mesa_glapi_set_dispatch — no behaviour change yet. Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com> Assisted-by: Claude
This commit is contained in:
parent
13950e1f5d
commit
9d70d1b2b3
8 changed files with 34 additions and 9 deletions
|
|
@ -77,6 +77,7 @@
|
|||
|
||||
|
||||
#include "util/glheader.h"
|
||||
#include "util/u_thread.h"
|
||||
|
||||
#include "accum.h"
|
||||
#include "arrayobj.h"
|
||||
|
|
@ -860,7 +861,7 @@ _mesa_alloc_dispatch_tables(gl_api api, struct gl_dispatch *d, bool glthread)
|
|||
return false;
|
||||
}
|
||||
|
||||
d->Current = d->Exec = d->OutsideBeginEnd;
|
||||
d->RealPublished = d->Current = d->Exec = d->OutsideBeginEnd;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -874,6 +875,22 @@ _mesa_free_dispatch_tables(struct gl_dispatch *d)
|
|||
free(d->ContextLost);
|
||||
}
|
||||
|
||||
void
|
||||
_mesa_set_dispatch(struct gl_context *ctx, struct _glapi_table *t)
|
||||
{
|
||||
/* On the glthread worker, the user-thread wrapper already logged the
|
||||
* call; bypass Trace and don't touch RealPublished (main-thread state).
|
||||
*/
|
||||
if (ctx->GLThread.enabled &&
|
||||
u_thread_is_self(ctx->GLThread.queue.threads[0])) {
|
||||
_mesa_glapi_set_dispatch(t);
|
||||
return;
|
||||
}
|
||||
|
||||
ctx->Dispatch.RealPublished = t;
|
||||
_mesa_glapi_set_dispatch(ctx->Dispatch.Trace ? ctx->Dispatch.Trace : t);
|
||||
}
|
||||
|
||||
bool
|
||||
_mesa_initialize_dispatch_tables(struct gl_context *ctx)
|
||||
{
|
||||
|
|
@ -1475,7 +1492,7 @@ _mesa_make_current( struct gl_context *newCtx,
|
|||
else {
|
||||
_mesa_glapi_set_context((void *) newCtx);
|
||||
assert(_mesa_get_current_context() == newCtx);
|
||||
_mesa_glapi_set_dispatch(newCtx->GLApi);
|
||||
_mesa_set_dispatch(newCtx, newCtx->GLApi);
|
||||
|
||||
if (drawBuffer && readBuffer) {
|
||||
assert(_mesa_is_winsys_fbo(drawBuffer));
|
||||
|
|
|
|||
|
|
@ -91,6 +91,9 @@ _mesa_alloc_dispatch_tables(gl_api api, struct gl_dispatch *d, bool glthread);
|
|||
extern bool
|
||||
_mesa_initialize_dispatch_tables(struct gl_context *ctx);
|
||||
|
||||
extern void
|
||||
_mesa_set_dispatch(struct gl_context *ctx, struct _glapi_table *t);
|
||||
|
||||
extern struct _glapi_table *
|
||||
_mesa_new_nop_table(bool glthread);
|
||||
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ set_verbose_flags(const char *str)
|
|||
static const struct option opts[] = {
|
||||
{ "state", VERBOSE_STATE },
|
||||
{ "list", VERBOSE_DISPLAY_LIST },
|
||||
{ "api", VERBOSE_API },
|
||||
};
|
||||
GLuint i;
|
||||
|
||||
|
|
|
|||
|
|
@ -13204,7 +13204,7 @@ _mesa_NewList(GLuint name, GLenum mode)
|
|||
vbo_save_NewList(ctx, name, mode);
|
||||
|
||||
ctx->Dispatch.Current = ctx->Dispatch.Save;
|
||||
_mesa_glapi_set_dispatch(ctx->Dispatch.Current);
|
||||
_mesa_set_dispatch(ctx, ctx->Dispatch.Current);
|
||||
if (!ctx->GLThread.enabled) {
|
||||
ctx->GLApi = ctx->Dispatch.Current;
|
||||
}
|
||||
|
|
@ -13423,7 +13423,7 @@ _mesa_EndList(void)
|
|||
ctx->CompileFlag = GL_FALSE;
|
||||
|
||||
ctx->Dispatch.Current = ctx->Dispatch.Exec;
|
||||
_mesa_glapi_set_dispatch(ctx->Dispatch.Current);
|
||||
_mesa_set_dispatch(ctx, ctx->Dispatch.Current);
|
||||
if (!ctx->GLThread.enabled) {
|
||||
ctx->GLApi = ctx->Dispatch.Current;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ void _mesa_glthread_enable(struct gl_context *ctx)
|
|||
|
||||
/* Update the dispatch only if the dispatch is current. */
|
||||
if (GET_DISPATCH() == ctx->Dispatch.Current) {
|
||||
_mesa_glapi_set_dispatch(ctx->GLApi);
|
||||
_mesa_set_dispatch(ctx, ctx->GLApi);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -323,7 +323,7 @@ void _mesa_glthread_disable(struct gl_context *ctx)
|
|||
|
||||
/* Update the dispatch only if the dispatch is current. */
|
||||
if (GET_DISPATCH() == ctx->MarshalExec) {
|
||||
_mesa_glapi_set_dispatch(ctx->GLApi);
|
||||
_mesa_set_dispatch(ctx, ctx->GLApi);
|
||||
}
|
||||
|
||||
/* Unbind VBOs in all VAOs that glthread bound for non-VBO vertex uploads
|
||||
|
|
|
|||
|
|
@ -3247,6 +3247,9 @@ struct gl_dispatch
|
|||
* - ContextLost
|
||||
*/
|
||||
struct _glapi_table *Current;
|
||||
|
||||
struct _glapi_table *Trace;
|
||||
struct _glapi_table *RealPublished;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -3672,6 +3675,7 @@ enum _verbose
|
|||
{
|
||||
VERBOSE_STATE = 0x0001,
|
||||
VERBOSE_DISPLAY_LIST = 0x0002,
|
||||
VERBOSE_API = 0x0004,
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ _mesa_set_context_lost_dispatch(struct gl_context *ctx)
|
|||
}
|
||||
|
||||
ctx->Dispatch.Current = ctx->Dispatch.ContextLost;
|
||||
_mesa_glapi_set_dispatch(ctx->Dispatch.Current);
|
||||
_mesa_set_dispatch(ctx, ctx->Dispatch.Current);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -862,7 +862,7 @@ _mesa_Begin(GLenum mode)
|
|||
ctx->Dispatch.Current = ctx->Dispatch.Exec;
|
||||
} else if (ctx->GLApi == ctx->Dispatch.OutsideBeginEnd) {
|
||||
ctx->GLApi = ctx->Dispatch.Current = ctx->Dispatch.Exec;
|
||||
_mesa_glapi_set_dispatch(ctx->GLApi);
|
||||
_mesa_set_dispatch(ctx, ctx->GLApi);
|
||||
} else {
|
||||
assert(ctx->GLApi == ctx->Dispatch.Save);
|
||||
}
|
||||
|
|
@ -925,7 +925,7 @@ _mesa_End(void)
|
|||
} else if (ctx->GLApi == ctx->Dispatch.BeginEnd ||
|
||||
ctx->GLApi == ctx->Dispatch.HWSelectModeBeginEnd) {
|
||||
ctx->GLApi = ctx->Dispatch.Current = ctx->Dispatch.Exec;
|
||||
_mesa_glapi_set_dispatch(ctx->GLApi);
|
||||
_mesa_set_dispatch(ctx, ctx->GLApi);
|
||||
}
|
||||
|
||||
if (exec->vtx.prim_count > 0) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue