mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 02:10:11 +01:00
glthread: don't free glthread for GL_DEBUG_OUTPUT_SYNCHRONOUS, only disable it
and enable it when GL_DEBUG_OUTPUT_SYNCHRONOUS is disabled. Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20624>
This commit is contained in:
parent
068670a79a
commit
201038a80d
3 changed files with 49 additions and 18 deletions
|
|
@ -203,18 +203,15 @@ _mesa_glthread_init(struct gl_context *ctx)
|
|||
}
|
||||
glthread->next_batch = &glthread->batches[glthread->next];
|
||||
glthread->used = 0;
|
||||
|
||||
glthread->enabled = true;
|
||||
glthread->stats.queue = &glthread->queue;
|
||||
|
||||
ctx->CurrentClientDispatch = ctx->MarshalExec;
|
||||
|
||||
glthread->LastDListChangeBatchIndex = -1;
|
||||
|
||||
/* glthread takes over all L3 pinning */
|
||||
ctx->st->pin_thread_counter = ST_L3_PINNING_DISABLED;
|
||||
|
||||
_mesa_glthread_update_draw_always_async(ctx);
|
||||
_mesa_glthread_enable(ctx);
|
||||
|
||||
/* Execute the thread initialization function in the thread. */
|
||||
struct util_queue_fence fence;
|
||||
|
|
@ -236,23 +233,47 @@ _mesa_glthread_destroy(struct gl_context *ctx)
|
|||
{
|
||||
struct glthread_state *glthread = &ctx->GLThread;
|
||||
|
||||
if (!glthread->enabled)
|
||||
_mesa_glthread_disable(ctx);
|
||||
|
||||
if (util_queue_is_initialized(&glthread->queue)) {
|
||||
util_queue_destroy(&glthread->queue);
|
||||
|
||||
for (unsigned i = 0; i < MARSHAL_MAX_BATCHES; i++)
|
||||
util_queue_fence_destroy(&glthread->batches[i].fence);
|
||||
|
||||
_mesa_HashDeleteAll(glthread->VAOs, free_vao, NULL);
|
||||
_mesa_DeleteHashTable(glthread->VAOs);
|
||||
_mesa_glthread_release_upload_buffer(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
void _mesa_glthread_enable(struct gl_context *ctx)
|
||||
{
|
||||
if (ctx->GLThread.enabled ||
|
||||
ctx->CurrentServerDispatch == ctx->ContextLost ||
|
||||
ctx->GLThread.DebugOutputSynchronous)
|
||||
return;
|
||||
|
||||
ctx->GLThread.enabled = true;
|
||||
ctx->CurrentClientDispatch = ctx->MarshalExec;
|
||||
|
||||
/* Update the dispatch only if the dispatch is current. */
|
||||
if (_glapi_get_dispatch() == ctx->CurrentServerDispatch) {
|
||||
_glapi_set_dispatch(ctx->CurrentClientDispatch);
|
||||
}
|
||||
}
|
||||
|
||||
void _mesa_glthread_disable(struct gl_context *ctx)
|
||||
{
|
||||
if (!ctx->GLThread.enabled)
|
||||
return;
|
||||
|
||||
_mesa_glthread_finish(ctx);
|
||||
util_queue_destroy(&glthread->queue);
|
||||
|
||||
for (unsigned i = 0; i < MARSHAL_MAX_BATCHES; i++)
|
||||
util_queue_fence_destroy(&glthread->batches[i].fence);
|
||||
|
||||
_mesa_HashDeleteAll(glthread->VAOs, free_vao, NULL);
|
||||
_mesa_DeleteHashTable(glthread->VAOs);
|
||||
_mesa_glthread_release_upload_buffer(ctx);
|
||||
|
||||
ctx->GLThread.enabled = false;
|
||||
ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
|
||||
|
||||
/* Update the dispatch only if the context is current. */
|
||||
/* Update the dispatch only if the dispatch is current. */
|
||||
if (_glapi_get_dispatch() == ctx->MarshalExec) {
|
||||
_glapi_set_dispatch(ctx->CurrentClientDispatch);
|
||||
}
|
||||
|
|
@ -266,7 +287,7 @@ _mesa_glthread_flush_batch(struct gl_context *ctx)
|
|||
return;
|
||||
|
||||
if (ctx->CurrentServerDispatch == ctx->ContextLost) {
|
||||
_mesa_glthread_destroy(ctx);
|
||||
_mesa_glthread_disable(ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -264,6 +264,7 @@ struct glthread_state
|
|||
bool Blend;
|
||||
bool DepthTest;
|
||||
bool CullFace;
|
||||
bool DebugOutputSynchronous;
|
||||
bool Lighting;
|
||||
bool PolygonStipple;
|
||||
|
||||
|
|
@ -296,6 +297,8 @@ void _mesa_glthread_init_dispatch6(struct gl_context *ctx,
|
|||
void _mesa_glthread_init_dispatch7(struct gl_context *ctx,
|
||||
struct _glapi_table *table);
|
||||
|
||||
void _mesa_glthread_enable(struct gl_context *ctx);
|
||||
void _mesa_glthread_disable(struct gl_context *ctx);
|
||||
void _mesa_glthread_flush_batch(struct gl_context *ctx);
|
||||
void _mesa_glthread_finish(struct gl_context *ctx);
|
||||
void _mesa_glthread_finish_before(struct gl_context *ctx, const char *func);
|
||||
|
|
|
|||
|
|
@ -433,12 +433,13 @@ _mesa_glthread_Enable(struct gl_context *ctx, GLenum cap)
|
|||
case GL_PRIMITIVE_RESTART_FIXED_INDEX:
|
||||
_mesa_glthread_set_prim_restart(ctx, cap, true);
|
||||
break;
|
||||
case GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB:
|
||||
_mesa_glthread_destroy(ctx);
|
||||
break;
|
||||
case GL_BLEND:
|
||||
ctx->GLThread.Blend = true;
|
||||
break;
|
||||
case GL_DEBUG_OUTPUT_SYNCHRONOUS:
|
||||
_mesa_glthread_disable(ctx);
|
||||
ctx->GLThread.DebugOutputSynchronous = true;
|
||||
break;
|
||||
case GL_DEPTH_TEST:
|
||||
ctx->GLThread.DepthTest = true;
|
||||
break;
|
||||
|
|
@ -483,6 +484,10 @@ _mesa_glthread_Disable(struct gl_context *ctx, GLenum cap)
|
|||
case GL_CULL_FACE:
|
||||
ctx->GLThread.CullFace = false;
|
||||
break;
|
||||
case GL_DEBUG_OUTPUT_SYNCHRONOUS:
|
||||
ctx->GLThread.DebugOutputSynchronous = false;
|
||||
_mesa_glthread_enable(ctx);
|
||||
break;
|
||||
case GL_DEPTH_TEST:
|
||||
ctx->GLThread.DepthTest = false;
|
||||
break;
|
||||
|
|
@ -519,6 +524,8 @@ _mesa_glthread_IsEnabled(struct gl_context *ctx, GLenum cap)
|
|||
return ctx->GLThread.Blend;
|
||||
case GL_CULL_FACE:
|
||||
return ctx->GLThread.CullFace;
|
||||
case GL_DEBUG_OUTPUT_SYNCHRONOUS:
|
||||
return ctx->GLThread.DebugOutputSynchronous;
|
||||
case GL_DEPTH_TEST:
|
||||
return ctx->GLThread.DepthTest;
|
||||
case GL_LIGHTING:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue