Alexandre Julliard : opengl32: Don't use ENTER_GL/
LEAVE_GL around calls to driver functions.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Dec 12 14:29:50 CST 2006
Module: wine
Branch: master
Commit: 6e01e4aa519e99ea1981b97f925e0d7a7bf7c90a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6e01e4aa519e99ea1981b97f925e0d7a7bf7c90a
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Dec 12 18:21:01 2006 +0100
opengl32: Don't use ENTER_GL/LEAVE_GL around calls to driver functions.
This causes lock inversions when the driver accesses the DC.
---
dlls/opengl32/wgl.c | 18 +----------
dlls/winex11.drv/opengl.c | 72 ++++++++++++++++++++++++++++----------------
2 files changed, 47 insertions(+), 43 deletions(-)
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index 792707e..344af98 100644
--- a/dlls/opengl32/wgl.c
+++ b/dlls/opengl32/wgl.c
@@ -569,9 +569,7 @@ BOOL WINAPI wglUseFontOutlinesW(HDC hdc,
void WINAPI wine_glEnable( GLenum cap )
{
TRACE("(%d)\n", cap );
- ENTER_GL();
wine_wgl.p_wglEnable(cap);
- LEAVE_GL();
}
/***********************************************************************
@@ -579,12 +577,8 @@ void WINAPI wine_glEnable( GLenum cap )
*/
GLboolean WINAPI wine_glIsEnabled( GLenum cap )
{
- GLboolean ret_value;
TRACE("(%d)\n", cap );
- ENTER_GL();
- ret_value = wine_wgl.p_wglIsEnabled(cap);
- LEAVE_GL();
- return ret_value;
+ return wine_wgl.p_wglIsEnabled(cap);
}
/***********************************************************************
@@ -593,9 +587,7 @@ GLboolean WINAPI wine_glIsEnabled( GLenu
void WINAPI wine_glDisable( GLenum cap )
{
TRACE("(%d)\n", cap );
- ENTER_GL();
wine_wgl.p_wglDisable(cap);
- LEAVE_GL();
}
/***********************************************************************
@@ -604,9 +596,7 @@ void WINAPI wine_glDisable( GLenum cap )
void WINAPI wine_glScissor( GLint x, GLint y, GLsizei width, GLsizei height )
{
TRACE("(%d, %d, %d, %d)\n", x, y, width, height );
- ENTER_GL();
wine_wgl.p_wglScissor(x, y, width, height);
- LEAVE_GL();
}
/***********************************************************************
@@ -615,9 +605,7 @@ void WINAPI wine_glScissor( GLint x, GLi
void WINAPI wine_glViewport( GLint x, GLint y, GLsizei width, GLsizei height )
{
TRACE("(%d, %d, %d, %d)\n", x, y, width, height );
- ENTER_GL();
wine_wgl.p_wglViewport(x, y, width, height);
- LEAVE_GL();
}
/***********************************************************************
@@ -678,11 +666,7 @@ const GLubyte * WINAPI wine_glGetString(
*/
void WINAPI wine_glGetIntegerv( GLenum pname, GLint* params )
{
- ENTER_GL();
- glGetIntegerv(pname, params);
- /* A few parameters like GL_DEPTH_BITS differ between WGL and GLX, the wglGetIntegerv helper function handles those */
wine_wgl.p_wglGetIntegerv(pname, params);
- LEAVE_GL();
}
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 927abfc..2769580 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -1463,6 +1463,8 @@ static void sync_current_drawable(void)
width = ctx->physDev->dc_rect.right - ctx->physDev->dc_rect.left;
height = ctx->physDev->dc_rect.bottom - ctx->physDev->dc_rect.top;
+ wine_tsx11_lock();
+
pglViewport(ctx->physDev->dc_rect.left + ctx->viewport.left,
dy + ctx->viewport.top,
ctx->viewport.right ? (ctx->viewport.right - ctx->viewport.left) : width,
@@ -1478,6 +1480,7 @@ static void sync_current_drawable(void)
else
pglScissor(ctx->physDev->dc_rect.left, dy, width, height);
+ wine_tsx11_unlock();
}
}
@@ -1796,7 +1799,9 @@ static void WINAPI X11DRV_wglDisable(GLe
}
else
{
- pglDisable(cap);
+ wine_tsx11_lock();
+ pglDisable(cap);
+ wine_tsx11_unlock();
}
}
@@ -1809,35 +1814,49 @@ static void WINAPI X11DRV_wglEnable(GLen
}
else
{
- pglEnable(cap);
+ wine_tsx11_lock();
+ pglEnable(cap);
+ wine_tsx11_unlock();
}
}
/* WGL helper function which handles differences in glGetIntegerv from WGL and GLX */
-static void WINAPI X11DRV_wglGetIntegerv(GLenum pname, GLint* params) {
- TRACE("pname: 0x%x, params: %p\n", pname, params);
- if (pname == GL_DEPTH_BITS) {
- GLXContext gl_ctx = pglXGetCurrentContext();
- Wine_GLContext* ret = get_context_from_GLXContext(gl_ctx);
- /*TRACE("returns Wine Ctx as %p\n", ret);*/
- /**
- * if we cannot find a Wine Context
- * we only have the default wine desktop context,
- * so if we have only a 24 depth say we have 32
- */
- if (NULL == ret && 24 == *params) {
- *params = 32;
+static void WINAPI X11DRV_wglGetIntegerv(GLenum pname, GLint* params)
+{
+ wine_tsx11_lock();
+ switch(pname)
+ {
+ case GL_DEPTH_BITS:
+ {
+ GLXContext gl_ctx = pglXGetCurrentContext();
+ Wine_GLContext* ret = get_context_from_GLXContext(gl_ctx);
+
+ pglGetIntegerv(pname, params);
+ /**
+ * if we cannot find a Wine Context
+ * we only have the default wine desktop context,
+ * so if we have only a 24 depth say we have 32
+ */
+ if (NULL == ret && 24 == *params) {
+ *params = 32;
+ }
+ TRACE("returns GL_DEPTH_BITS as '%d'\n", *params);
+ break;
}
- TRACE("returns GL_DEPTH_BITS as '%d'\n", *params);
- }
- if (pname == GL_ALPHA_BITS) {
- GLint tmp;
- GLXContext gl_ctx = pglXGetCurrentContext();
- Wine_GLContext* ret = get_context_from_GLXContext(gl_ctx);
- pglXGetFBConfigAttrib(ret->display, ret->fb_conf, GLX_ALPHA_SIZE, &tmp);
- TRACE("returns GL_ALPHA_BITS as '%d'\n", tmp);
- *params = tmp;
+ case GL_ALPHA_BITS:
+ {
+ GLXContext gl_ctx = pglXGetCurrentContext();
+ Wine_GLContext* ret = get_context_from_GLXContext(gl_ctx);
+
+ pglXGetFBConfigAttrib(ret->display, ret->fb_conf, GLX_ALPHA_SIZE, params);
+ TRACE("returns GL_ALPHA_BITS as '%d'\n", *params);
+ break;
+ }
+ default:
+ pglGetIntegerv(pname, params);
+ break;
}
+ wine_tsx11_unlock();
}
static GLboolean WINAPI X11DRV_wglIsEnabled(GLenum cap)
@@ -1851,9 +1870,10 @@ static GLboolean WINAPI X11DRV_wglIsEnab
}
else
{
- enabled = pglIsEnabled(cap);
+ wine_tsx11_lock();
+ enabled = pglIsEnabled(cap);
+ wine_tsx11_unlock();
}
-
return enabled;
}
More information about the wine-cvs
mailing list