Mesa (staging/20.1): mesa: Fix double-lock of Shared->FrameBuffers and usage of wrong mutex

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri May 22 23:13:03 UTC 2020


Module: Mesa
Branch: staging/20.1
Commit: 5d27b68ba7d128e23897f8b40e4cfe8ff79f8ec4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5d27b68ba7d128e23897f8b40e4cfe8ff79f8ec4

Author: Danylo Piliaiev <danylo.piliaiev at globallogic.com>
Date:   Fri May 22 13:36:31 2020 +0300

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

Fixes: 7534c536ca0f4b2b123200f421460094034f37a3
Fixes: 8cfb3e4ee57070ff45e7534a986a20c5fd649dc7
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3024
Signed-off-by: Danylo Piliaiev <danylo.piliaiev at globallogic.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5160>
(cherry picked from commit 40255831230a6dba45b09ab98d5b626a5bdb18ef)

---

 .pick_status.json        | 2 +-
 src/mesa/main/fbobject.c | 9 +--------
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index f6d3ad556e9..fb2aaadb41d 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -175,7 +175,7 @@
         "description": "mesa: Fix double-lock of Shared->FrameBuffers and usage of wrong mutex",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "7534c536ca0f4b2b123200f421460094034f37a3"
     },
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 3d35b9bdc33..298a6b35d0a 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -174,21 +174,16 @@ _mesa_lookup_framebuffer_dsa(struct gl_context *ctx, GLuint id,
    /* Name exists but buffer is not initialized */
    if (fb == &DummyFramebuffer) {
       fb = ctx->Driver.NewFramebuffer(ctx, id);
-      _mesa_HashLockMutex(ctx->Shared->FrameBuffers);
       _mesa_HashInsert(ctx->Shared->FrameBuffers, id, fb);
-      _mesa_HashUnlockMutex(ctx->Shared->BufferObjects);
    }
    /* Name doesn't exist */
    else if (!fb) {
-      _mesa_HashLockMutex(ctx->Shared->FrameBuffers);
       fb = ctx->Driver.NewFramebuffer(ctx, id);
       if (!fb) {
-         _mesa_HashUnlockMutex(ctx->Shared->FrameBuffers);
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
          return NULL;
       }
-      _mesa_HashInsertLocked(ctx->Shared->BufferObjects, id, fb);
-      _mesa_HashUnlockMutex(ctx->Shared->BufferObjects);
+      _mesa_HashInsert(ctx->Shared->FrameBuffers, id, fb);
    }
    return fb;
 }
@@ -4764,9 +4759,7 @@ lookup_named_framebuffer_ext_dsa(struct gl_context *ctx, GLuint framebuffer, con
       /* Then, make sure it's initialized */
       if (fb == &DummyFramebuffer) {
          fb = ctx->Driver.NewFramebuffer(ctx, framebuffer);
-         _mesa_HashLockMutex(ctx->Shared->FrameBuffers);
          _mesa_HashInsert(ctx->Shared->FrameBuffers, framebuffer, fb);
-         _mesa_HashUnlockMutex(ctx->Shared->BufferObjects);
       }
    }
    else



More information about the mesa-commit mailing list