From cd18cc1e967ef442885dc7c812742331bfab0ea6 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Wed, 14 Jan 2015 10:54:45 -0500 Subject: [PATCH 1/2] [libglx] Bump client string storage size Mesa already needs ~700 bytes here. Obviously this still wants to be a proper union operation, but this gets me non-truncated output in glxinfo for now. Signed-off-by: Adam Jackson --- src/GLX/libglx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GLX/libglx.c b/src/GLX/libglx.c index a9893ab..0f7fe8f 100644 --- a/src/GLX/libglx.c +++ b/src/GLX/libglx.c @@ -855,7 +855,7 @@ PUBLIC void glXWaitX(void) } #define GLX_CLIENT_STRING_LAST_ATTRIB GLX_EXTENSIONS -#define CLIENT_STRING_BUFFER_SIZE 256 +#define CLIENT_STRING_BUFFER_SIZE 1024 PUBLIC const char *glXGetClientString(Display *dpy, int name) { -- GitLab From bbb622dfe0b9abf23aa3ca931ff0241a360ad6be Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Wed, 18 Mar 2015 13:06:40 -0400 Subject: [PATCH 2/2] [libglx] Fix a thread-safety bug in glXGetClientString The problem with allocating a mutex on the stack is that every thread that enters the function is going to get their own copy of the mutex, which sort of defeats any mutual exclusion you might have been hoping for. Signed-off-by: Adam Jackson --- src/GLX/libglx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GLX/libglx.c b/src/GLX/libglx.c index 0f7fe8f..5a34178 100644 --- a/src/GLX/libglx.c +++ b/src/GLX/libglx.c @@ -866,7 +866,7 @@ PUBLIC const char *glXGetClientString(Display *dpy, int name) size_t n = CLIENT_STRING_BUFFER_SIZE - 1; int index = name - 1; - glvnd_mutex_t clientStringLock = GLVND_MUTEX_INITIALIZER; + static glvnd_mutex_t clientStringLock = GLVND_MUTEX_INITIALIZER; static struct { int initialized; char string[CLIENT_STRING_BUFFER_SIZE]; -- GitLab