Commit 40255831 authored by Danylo Piliaiev's avatar Danylo Piliaiev 🇺🇦 Committed by Marge Bot
Browse files

mesa: Fix double-lock of Shared->FrameBuffers and usage of wrong mutex

Fixes: 7534c536
Fixes: 8cfb3e4e
Closes: mesa/mesa#3024

Signed-off-by: Danylo Piliaiev's avatarDanylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer's avatarPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <mesa/mesa!5160>
parent 0d2ec80d
Pipeline #150281 waiting for manual action with stages
...@@ -174,21 +174,16 @@ _mesa_lookup_framebuffer_dsa(struct gl_context *ctx, GLuint id, ...@@ -174,21 +174,16 @@ _mesa_lookup_framebuffer_dsa(struct gl_context *ctx, GLuint id,
/* Name exists but buffer is not initialized */ /* Name exists but buffer is not initialized */
if (fb == &DummyFramebuffer) { if (fb == &DummyFramebuffer) {
fb = ctx->Driver.NewFramebuffer(ctx, id); fb = ctx->Driver.NewFramebuffer(ctx, id);
_mesa_HashLockMutex(ctx->Shared->FrameBuffers);
_mesa_HashInsert(ctx->Shared->FrameBuffers, id, fb); _mesa_HashInsert(ctx->Shared->FrameBuffers, id, fb);
_mesa_HashUnlockMutex(ctx->Shared->BufferObjects);
} }
/* Name doesn't exist */ /* Name doesn't exist */
else if (!fb) { else if (!fb) {
_mesa_HashLockMutex(ctx->Shared->FrameBuffers);
fb = ctx->Driver.NewFramebuffer(ctx, id); fb = ctx->Driver.NewFramebuffer(ctx, id);
if (!fb) { if (!fb) {
_mesa_HashUnlockMutex(ctx->Shared->FrameBuffers);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func); _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
return NULL; return NULL;
} }
_mesa_HashInsertLocked(ctx->Shared->BufferObjects, id, fb); _mesa_HashInsert(ctx->Shared->FrameBuffers, id, fb);
_mesa_HashUnlockMutex(ctx->Shared->BufferObjects);
} }
return fb; return fb;
} }
...@@ -4764,9 +4759,7 @@ lookup_named_framebuffer_ext_dsa(struct gl_context *ctx, GLuint framebuffer, con ...@@ -4764,9 +4759,7 @@ lookup_named_framebuffer_ext_dsa(struct gl_context *ctx, GLuint framebuffer, con
/* Then, make sure it's initialized */ /* Then, make sure it's initialized */
if (fb == &DummyFramebuffer) { if (fb == &DummyFramebuffer) {
fb = ctx->Driver.NewFramebuffer(ctx, framebuffer); fb = ctx->Driver.NewFramebuffer(ctx, framebuffer);
_mesa_HashLockMutex(ctx->Shared->FrameBuffers);
_mesa_HashInsert(ctx->Shared->FrameBuffers, framebuffer, fb); _mesa_HashInsert(ctx->Shared->FrameBuffers, framebuffer, fb);
_mesa_HashUnlockMutex(ctx->Shared->BufferObjects);
} }
} }
else else
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment