From: Brian Paul Date: Sat, 1 Mar 2014 17:21:07 +0000 (-0700) Subject: xlib: switch to c11 mutex functions X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2706db701d6217d245325f90f014233ff40ba18c;p=mesa.git xlib: switch to c11 mutex functions The _glthread_LOCK/UNLOCK_MUTEX() macros are just wrappers around the c11 mutex functions. Let's start getting rid of those wrappers. Reviewed-by: José Fonseca --- diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index ac290a546b4..5a3a206270d 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -74,7 +74,6 @@ #include "main/teximage.h" #include "main/version.h" #include "main/vtxfmt.h" -#include "glapi/glthread.h" #include "swrast/swrast.h" #include "swrast/s_renderbuffer.h" #include "swrast_setup/swrast_setup.h" @@ -88,7 +87,7 @@ /** * Global X driver lock */ -_glthread_Mutex _xmesa_lock; +mtx_t _xmesa_lock; @@ -248,10 +247,10 @@ xmesa_get_window_size(XMesaDisplay *dpy, XMesaBuffer b, { Status stat; - _glthread_LOCK_MUTEX(_xmesa_lock); + mtx_lock(&_xmesa_lock); XSync(b->xm_visual->display, 0); /* added for Chromium */ stat = get_drawable_size(dpy, b->frontxrb->pixmap, width, height); - _glthread_UNLOCK_MUTEX(_xmesa_lock); + mtx_unlock(&_xmesa_lock); if (!stat) { /* probably querying a window that's recently been destroyed */ @@ -892,7 +891,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) TNLcontext *tnl; if (firstTime) { - _glthread_INIT_MUTEX(_xmesa_lock); + mtx_init(&_xmesa_lock, mtx_plain); firstTime = GL_FALSE; } @@ -1336,28 +1335,28 @@ void XMesaSwapBuffers( XMesaBuffer b ) /* Copy Ximage (back buf) from client memory to server window */ #if defined(USE_XSHM) if (b->shm) { - /*_glthread_LOCK_MUTEX(_xmesa_lock);*/ + /*mtx_lock(&_xmesa_lock);*/ XShmPutImage( b->xm_visual->display, b->frontxrb->drawable, b->swapgc, b->backxrb->ximage, 0, 0, 0, 0, b->mesa_buffer.Width, b->mesa_buffer.Height, False ); - /*_glthread_UNLOCK_MUTEX(_xmesa_lock);*/ + /*mtx_unlock(&_xmesa_lock);*/ } else #endif { - /*_glthread_LOCK_MUTEX(_xmesa_lock);*/ + /*mtx_lock(&_xmesa_lock);*/ XMesaPutImage( b->xm_visual->display, b->frontxrb->drawable, b->swapgc, b->backxrb->ximage, 0, 0, 0, 0, b->mesa_buffer.Width, b->mesa_buffer.Height ); - /*_glthread_UNLOCK_MUTEX(_xmesa_lock);*/ + /*mtx_unlock(&_xmesa_lock);*/ } } else if (b->backxrb->pixmap) { /* Copy pixmap (back buf) to window (front buf) on server */ - /*_glthread_LOCK_MUTEX(_xmesa_lock);*/ + /*mtx_lock(&_xmesa_lock);*/ XMesaCopyArea( b->xm_visual->display, b->backxrb->pixmap, /* source drawable */ b->frontxrb->drawable, /* dest. drawable */ @@ -1365,7 +1364,7 @@ void XMesaSwapBuffers( XMesaBuffer b ) 0, 0, b->mesa_buffer.Width, b->mesa_buffer.Height, 0, 0 /* dest region */ ); - /*_glthread_UNLOCK_MUTEX(_xmesa_lock);*/ + /*mtx_unlock(&_xmesa_lock);*/ } } XSync( b->xm_visual->display, False ); diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index c0dcb61e234..3fe1f01c4ed 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -54,9 +54,9 @@ finish_or_flush( struct gl_context *ctx ) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); if (xmesa) { - _glthread_LOCK_MUTEX(_xmesa_lock); + mtx_lock(&_xmesa_lock); XSync( xmesa->display, False ); - _glthread_UNLOCK_MUTEX(_xmesa_lock); + mtx_unlock(&_xmesa_lock); } } diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index 85af1df02b7..b47934db877 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -27,12 +27,13 @@ #define XMESAP_H +#include "c11/threads.h" #include "xmesa.h" #include "main/mtypes.h" #include "swrast/s_context.h" -extern _glthread_Mutex _xmesa_lock; +extern mtx_t _xmesa_lock; extern XMesaBuffer XMesaBufferList;