Mesa (main): mesa: remove mutex locking from a glBindTexture early out path

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Jun 27 15:02:26 UTC 2021


Module: Mesa
Branch: main
Commit: 553588194e4d6b3faa87a2746db210102062ff09
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=553588194e4d6b3faa87a2746db210102062ff09

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Mon Jun  7 11:03:10 2021 -0400

mesa: remove mutex locking from a glBindTexture early out path

The locking doesn't seem to be needed. This removes large locking
overhead.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Reviewed-by: Emma Anholt <emma at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11339>

---

 src/mesa/main/texobj.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index b5b873b3ebd..400c85f653e 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -1608,16 +1608,10 @@ bind_texture_object(struct gl_context *ctx, unsigned unit,
     * If so, just return. For GL_OES_image_external, rebinding the texture
     * always must invalidate cached resources.
     */
-   if (targetIndex != TEXTURE_EXTERNAL_INDEX) {
-      bool early_out;
-      simple_mtx_lock(&ctx->Shared->Mutex);
-      early_out = ((ctx->Shared->RefCount == 1)
-                   && (texObj == texUnit->CurrentTex[targetIndex]));
-      simple_mtx_unlock(&ctx->Shared->Mutex);
-      if (early_out) {
-         return;
-      }
-   }
+   if (targetIndex != TEXTURE_EXTERNAL_INDEX &&
+       ctx->Shared->RefCount == 1 &&
+       texObj == texUnit->CurrentTex[targetIndex])
+      return;
 
    /* Flush before changing binding.
     *



More information about the mesa-commit mailing list