opengl32: Don't use ENTER_GL/LEAVE_GL around calls to driver functions.

This causes lock inversions when the driver accesses the DC.
This commit is contained in:
Alexandre Julliard 2006-12-12 18:21:01 +01:00
parent de154e738a
commit 6e01e4aa51
2 changed files with 47 additions and 43 deletions

View File

@ -569,9 +569,7 @@ BOOL WINAPI wglUseFontOutlinesW(HDC hdc,
void WINAPI wine_glEnable( GLenum cap ) void WINAPI wine_glEnable( GLenum cap )
{ {
TRACE("(%d)\n", cap ); TRACE("(%d)\n", cap );
ENTER_GL();
wine_wgl.p_wglEnable(cap); wine_wgl.p_wglEnable(cap);
LEAVE_GL();
} }
/*********************************************************************** /***********************************************************************
@ -579,12 +577,8 @@ void WINAPI wine_glEnable( GLenum cap )
*/ */
GLboolean WINAPI wine_glIsEnabled( GLenum cap ) GLboolean WINAPI wine_glIsEnabled( GLenum cap )
{ {
GLboolean ret_value;
TRACE("(%d)\n", cap ); TRACE("(%d)\n", cap );
ENTER_GL(); return wine_wgl.p_wglIsEnabled(cap);
ret_value = wine_wgl.p_wglIsEnabled(cap);
LEAVE_GL();
return ret_value;
} }
/*********************************************************************** /***********************************************************************
@ -593,9 +587,7 @@ GLboolean WINAPI wine_glIsEnabled( GLenum cap )
void WINAPI wine_glDisable( GLenum cap ) void WINAPI wine_glDisable( GLenum cap )
{ {
TRACE("(%d)\n", cap ); TRACE("(%d)\n", cap );
ENTER_GL();
wine_wgl.p_wglDisable(cap); 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 ) void WINAPI wine_glScissor( GLint x, GLint y, GLsizei width, GLsizei height )
{ {
TRACE("(%d, %d, %d, %d)\n", x, y, width, height ); TRACE("(%d, %d, %d, %d)\n", x, y, width, height );
ENTER_GL();
wine_wgl.p_wglScissor(x, y, width, height); wine_wgl.p_wglScissor(x, y, width, height);
LEAVE_GL();
} }
/*********************************************************************** /***********************************************************************
@ -615,9 +605,7 @@ void WINAPI wine_glScissor( GLint x, GLint y, GLsizei width, GLsizei height )
void WINAPI wine_glViewport( GLint x, GLint y, GLsizei width, GLsizei height ) void WINAPI wine_glViewport( GLint x, GLint y, GLsizei width, GLsizei height )
{ {
TRACE("(%d, %d, %d, %d)\n", x, y, width, height ); TRACE("(%d, %d, %d, %d)\n", x, y, width, height );
ENTER_GL();
wine_wgl.p_wglViewport(x, y, width, height); wine_wgl.p_wglViewport(x, y, width, height);
LEAVE_GL();
} }
/*********************************************************************** /***********************************************************************
@ -678,11 +666,7 @@ const GLubyte * WINAPI wine_glGetString( GLenum name )
*/ */
void WINAPI wine_glGetIntegerv( GLenum pname, GLint* params ) 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); wine_wgl.p_wglGetIntegerv(pname, params);
LEAVE_GL();
} }

View File

@ -1463,6 +1463,8 @@ static void sync_current_drawable(void)
width = ctx->physDev->dc_rect.right - ctx->physDev->dc_rect.left; width = ctx->physDev->dc_rect.right - ctx->physDev->dc_rect.left;
height = ctx->physDev->dc_rect.bottom - ctx->physDev->dc_rect.top; height = ctx->physDev->dc_rect.bottom - ctx->physDev->dc_rect.top;
wine_tsx11_lock();
pglViewport(ctx->physDev->dc_rect.left + ctx->viewport.left, pglViewport(ctx->physDev->dc_rect.left + ctx->viewport.left,
dy + ctx->viewport.top, dy + ctx->viewport.top,
ctx->viewport.right ? (ctx->viewport.right - ctx->viewport.left) : width, ctx->viewport.right ? (ctx->viewport.right - ctx->viewport.left) : width,
@ -1478,6 +1480,7 @@ static void sync_current_drawable(void)
else else
pglScissor(ctx->physDev->dc_rect.left, dy, width, height); pglScissor(ctx->physDev->dc_rect.left, dy, width, height);
wine_tsx11_unlock();
} }
} }
@ -1796,7 +1799,9 @@ static void WINAPI X11DRV_wglDisable(GLenum cap)
} }
else else
{ {
pglDisable(cap); wine_tsx11_lock();
pglDisable(cap);
wine_tsx11_unlock();
} }
} }
@ -1809,35 +1814,49 @@ static void WINAPI X11DRV_wglEnable(GLenum cap)
} }
else else
{ {
pglEnable(cap); wine_tsx11_lock();
pglEnable(cap);
wine_tsx11_unlock();
} }
} }
/* WGL helper function which handles differences in glGetIntegerv from WGL and GLX */ /* WGL helper function which handles differences in glGetIntegerv from WGL and GLX */
static void WINAPI X11DRV_wglGetIntegerv(GLenum pname, GLint* params) { static void WINAPI X11DRV_wglGetIntegerv(GLenum pname, GLint* params)
TRACE("pname: 0x%x, params: %p\n", pname, params); {
if (pname == GL_DEPTH_BITS) { wine_tsx11_lock();
GLXContext gl_ctx = pglXGetCurrentContext(); switch(pname)
Wine_GLContext* ret = get_context_from_GLXContext(gl_ctx); {
/*TRACE("returns Wine Ctx as %p\n", ret);*/ case GL_DEPTH_BITS:
/** {
* if we cannot find a Wine Context GLXContext gl_ctx = pglXGetCurrentContext();
* we only have the default wine desktop context, Wine_GLContext* ret = get_context_from_GLXContext(gl_ctx);
* so if we have only a 24 depth say we have 32
*/ pglGetIntegerv(pname, params);
if (NULL == ret && 24 == *params) { /**
*params = 32; * 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); case GL_ALPHA_BITS:
} {
if (pname == GL_ALPHA_BITS) { GLXContext gl_ctx = pglXGetCurrentContext();
GLint tmp; Wine_GLContext* ret = get_context_from_GLXContext(gl_ctx);
GLXContext gl_ctx = pglXGetCurrentContext();
Wine_GLContext* ret = get_context_from_GLXContext(gl_ctx); pglXGetFBConfigAttrib(ret->display, ret->fb_conf, GLX_ALPHA_SIZE, params);
pglXGetFBConfigAttrib(ret->display, ret->fb_conf, GLX_ALPHA_SIZE, &tmp); TRACE("returns GL_ALPHA_BITS as '%d'\n", *params);
TRACE("returns GL_ALPHA_BITS as '%d'\n", tmp); break;
*params = tmp; }
default:
pglGetIntegerv(pname, params);
break;
} }
wine_tsx11_unlock();
} }
static GLboolean WINAPI X11DRV_wglIsEnabled(GLenum cap) static GLboolean WINAPI X11DRV_wglIsEnabled(GLenum cap)
@ -1851,9 +1870,10 @@ static GLboolean WINAPI X11DRV_wglIsEnabled(GLenum cap)
} }
else else
{ {
enabled = pglIsEnabled(cap); wine_tsx11_lock();
enabled = pglIsEnabled(cap);
wine_tsx11_unlock();
} }
return enabled; return enabled;
} }