Mesa (master): mesa/bufferobj: Fix valgrind complaints
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Nov 10 19:27:26 UTC 2020
Module: Mesa
Branch: master
Commit: e8a1aa9e940af5706fc78d77c4cd509c2f480a6b
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e8a1aa9e940af5706fc78d77c4cd509c2f480a6b
Author: Rob Clark <robdclark at chromium.org>
Date: Mon Nov 9 13:58:42 2020 -0800
mesa/bufferobj: Fix valgrind complaints
==328537== Mutex reinitialization: mutex 0x1281afb0, recursion count 0, owner 0.
==328537== at 0x486FD34: pthread_mutex_init_intercept (drd_pthread_intercepts.c:826)
==328537== by 0x486FD34: pthread_mutex_init (drd_pthread_intercepts.c:835)
==328537== by 0x117DA107: mtx_init (threads_posix.h:207)
==328537== by 0x117DA2BB: simple_mtx_init (simple_mtx.h:132)
==328537== by 0x117DB86B: _mesa_init_buffer_objects (bufferobj.c:878)
==328537== by 0x117E8C6F: init_attrib_groups (context.c:840)
==328537== by 0x117E942F: _mesa_initialize_context (context.c:1225)
==328537== by 0x1173C323: st_create_context (st_context.c:1019)
==328537== by 0x11720A9F: st_api_create_context (st_manager.c:930)
==328537== by 0x1170E2CF: dri_create_context (dri_context.c:163)
==328537== by 0x11FB9DC3: driCreateContextAttribs (dri_util.c:480)
==328537== by 0x8E9D3DF: dri3_create_context_attribs (dri3_glx.c:316)
==328537== by 0x8E9D49B: dri3_create_context (dri3_glx.c:347)
==328537== mutex 0x1281afb0 was first observed at:
==328537== at 0x486FD34: pthread_mutex_init_intercept (drd_pthread_intercepts.c:826)
==328537== by 0x486FD34: pthread_mutex_init (drd_pthread_intercepts.c:835)
==328537== by 0x117DA107: mtx_init (threads_posix.h:207)
==328537== by 0x117DA2BB: simple_mtx_init (simple_mtx.h:132)
==328537== by 0x117DB86B: _mesa_init_buffer_objects (bufferobj.c:878)
==328537== by 0x117E8C6F: init_attrib_groups (context.c:840)
==328537== by 0x117E942F: _mesa_initialize_context (context.c:1225)
==328537== by 0x1173C323: st_create_context (st_context.c:1019)
==328537== by 0x11720A9F: st_api_create_context (st_manager.c:930)
==328537== by 0x1170E2CF: dri_create_context (dri_context.c:163)
==328537== by 0x11FB9DC3: driCreateContextAttribs (dri_util.c:480)
==328537== by 0x8E9D3DF: dri3_create_context_attribs (dri3_glx.c:316)
==328537== by 0x8E9D49B: dri3_create_context (dri3_glx.c:347)
Signed-off-by: Rob Clark <robdclark at chromium.org>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7517>
---
src/mesa/main/bufferobj.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 16a1e5e8b3f..08a3a550c22 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -92,7 +92,10 @@ buffer_usage_warning(struct gl_context *ctx, GLuint *id, const char *fmt, ...)
* Used as a placeholder for buffer objects between glGenBuffers() and
* glBindBuffer() so that glIsBuffer() can work correctly.
*/
-static struct gl_buffer_object DummyBufferObject;
+static struct gl_buffer_object DummyBufferObject = {
+ .MinMaxCacheMutex = _SIMPLE_MTX_INITIALIZER_NP,
+ .RefCount = 1000*1000*1000, /* never delete */
+};
/**
@@ -874,10 +877,6 @@ _mesa_init_buffer_objects( struct gl_context *ctx )
{
GLuint i;
- memset(&DummyBufferObject, 0, sizeof(DummyBufferObject));
- simple_mtx_init(&DummyBufferObject.MinMaxCacheMutex, mtx_plain);
- DummyBufferObject.RefCount = 1000*1000*1000; /* never delete */
-
for (i = 0; i < MAX_COMBINED_UNIFORM_BUFFERS; i++) {
_mesa_reference_buffer_object(ctx,
&ctx->UniformBufferBindings[i].BufferObject,
More information about the mesa-commit
mailing list