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

This causes lock inversions when the driver accesses the DC.
oldstable
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 )
{
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( GLenum cap )
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, 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 );
ENTER_GL();
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 )
{
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();
}

View File

@ -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(GLenum cap)
}
else
{
pglDisable(cap);
wine_tsx11_lock();
pglDisable(cap);
wine_tsx11_unlock();
}
}
@ -1809,35 +1814,49 @@ static void WINAPI X11DRV_wglEnable(GLenum cap)
}
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_wglIsEnabled(GLenum cap)
}
else
{
enabled = pglIsEnabled(cap);
wine_tsx11_lock();
enabled = pglIsEnabled(cap);
wine_tsx11_unlock();
}
return enabled;
}