Mesa (main): glthread: add a trivial thread-safe way to skip display list execution
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Oct 27 01:46:57 UTC 2021
Module: Mesa
Branch: main
Commit: e1619b268a6f4f3eec3ab7ecd558b02665c7f50b
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e1619b268a6f4f3eec3ab7ecd558b02665c7f50b
Author: Marek Olšák <marek.olsak at amd.com>
Date: Sat Oct 23 18:26:30 2021 -0400
glthread: add a trivial thread-safe way to skip display list execution
There are apps that never put state changes into display lists.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13403>
---
src/mesa/main/dlist.c | 1 +
src/mesa/main/glthread_marshal.h | 3 +++
src/mesa/main/mtypes.h | 2 ++
3 files changed, 6 insertions(+)
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index a741fa6a71a..611c4c3d001 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -13749,6 +13749,7 @@ _mesa_EndList(void)
struct gl_dlist_state *list = &ctx->ListState;
list->CurrentList->execute_glthread =
_mesa_glthread_should_execute_list(ctx, list->CurrentList);
+ ctx->Shared->DisplayListsAffectGLThread |= list->CurrentList->execute_glthread;
if ((list->CurrentList->Head == list->CurrentBlock) &&
(list->CurrentPos < BLOCK_SIZE)) {
diff --git a/src/mesa/main/glthread_marshal.h b/src/mesa/main/glthread_marshal.h
index 03700dbdd95..300d975a6e9 100644
--- a/src/mesa/main/glthread_marshal.h
+++ b/src/mesa/main/glthread_marshal.h
@@ -612,6 +612,9 @@ _mesa_glthread_CallList(struct gl_context *ctx, GLuint list)
p_atomic_set(&ctx->GLThread.LastDListChangeBatchIndex, -1);
}
+ if (!ctx->Shared->DisplayListsAffectGLThread)
+ return;
+
/* Clear GL_COMPILE_AND_EXECUTE if needed. We only execute here. */
unsigned saved_mode = ctx->GLThread.ListMode;
ctx->GLThread.ListMode = 0;
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index f8f12c03152..fb168ed770a 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3369,6 +3369,8 @@ struct gl_shared_state
{
simple_mtx_t Mutex; /**< for thread safety */
GLint RefCount; /**< Reference count */
+ bool DisplayListsAffectGLThread;
+
struct _mesa_HashTable *DisplayList; /**< Display lists hash table */
struct _mesa_HashTable *BitmapAtlas; /**< For optimized glBitmap text */
struct _mesa_HashTable *TexObjects; /**< Texture objects hash table */
More information about the mesa-commit
mailing list