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@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13403>
This commit is contained in:
Marek Olšák 2021-10-23 18:26:30 -04:00 committed by Marge Bot
parent c14d755f3d
commit e1619b268a
3 changed files with 6 additions and 0 deletions

View File

@ -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)) {

View File

@ -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;

View File

@ -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 */