[PATCH] WineD3D: Call glFlush outside the GL lock=0A=
Stefan Doesinger
stefan at codeweavers.com
Mon Aug 4 13:34:47 CDT 2008
=0A=
Since we're using the glFlush from opengl32, it does the locking on its =
own where needed. IN fact,=0A=
x11drv's glFlush locks the gdi lock in some cases, causing deadlocks in =
VLC.=0A=
---=0A=
dlls/wined3d/device.c | 6 +++---=0A=
dlls/wined3d/surface.c | 12 +++++-------=0A=
2 files changed, 8 insertions(+), 10 deletions(-)=0A=
=0A=
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c=0A=
index cc1b448..e6b7b50 100644=0A=
--- a/dlls/wined3d/device.c=0A=
+++ b/dlls/wined3d/device.c=0A=
@@ -4945,10 +4945,10 @@ static HRESULT WINAPI =
IWineD3DDeviceImpl_EndScene(IWineD3DDevice *iface) {=0A=
=0A=
ActivateContext(This, This->lastActiveRenderTarget, =
CTXUSAGE_RESOURCELOAD);=0A=
/* We only have to do this if we need to read the, swapbuffers =
performs a flush for us */=0A=
- ENTER_GL();=0A=
glFlush();=0A=
- checkGLcall("glFlush");=0A=
- LEAVE_GL();=0A=
+ /* No checkGLcall here to avoid locking the lock just for checking =
a call that hardly ever=0A=
+ * fails=0A=
+ */=0A=
=0A=
This->inScene =3D FALSE;=0A=
return WINED3D_OK;=0A=
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c=0A=
index cb4d879..10c8ab1 100644=0A=
--- a/dlls/wined3d/surface.c=0A=
+++ b/dlls/wined3d/surface.c=0A=
@@ -3438,10 +3438,6 @@ static HRESULT =
IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, RECT *=0A=
checkGLcall("glDisable(GL_ALPHA_TEST)");=0A=
}=0A=
=0A=
- /* Flush in case the drawable is used by multiple GL contexts */=0A=
- if(dstSwapchain && (This =3D=3D (IWineD3DSurfaceImpl *) =
dstSwapchain->frontBuffer || dstSwapchain->num_contexts >=3D 2))=0A=
- glFlush();=0A=
-=0A=
glBindTexture(Src->glDescription.target, 0);=0A=
checkGLcall("glBindTexture(Src->glDescription.target, 0)");=0A=
/* Leave the opengl state valid for blitting */=0A=
@@ -3465,6 +3461,10 @@ static HRESULT =
IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, RECT *=0A=
=0A=
LEAVE_GL();=0A=
=0A=
+ /* Flush in case the drawable is used by multiple GL contexts */=0A=
+ if(dstSwapchain && (This =3D=3D (IWineD3DSurfaceImpl *) =
dstSwapchain->frontBuffer || dstSwapchain->num_contexts >=3D 2))=0A=
+ glFlush();=0A=
+=0A=
/* TODO: If the surface is locked often, perform the Blt in =
software on the memory instead */=0A=
/* The surface is now in the drawable. On onscreen surfaces or =
without fbos the texture=0A=
* is outdated now=0A=
@@ -3729,9 +3729,7 @@ HRESULT WINAPI =
IWineD3DSurfaceImpl_RealizePalette(IWineD3DSurface *iface) {=0A=
=0A=
/* Without this some palette updates are missed. This at =
least happens on Nvidia drivers but=0A=
* it works fine using Mesa. */=0A=
- ENTER_GL();=0A=
glFlush();=0A=
- LEAVE_GL();=0A=
} else {=0A=
if(!(This->Flags & SFLAG_INSYSMEM)) {=0A=
TRACE("Palette changed with surface that does not have =
an up to date system memory copy\n");=0A=
@@ -4183,6 +4181,7 @@ static inline void =
surface_blt_to_drawable(IWineD3DSurfaceImpl *This, const RECT=0A=
glDisable(GL_TEXTURE_2D);=0A=
checkGLcall("glDisable(GL_TEXTURE_2D)");=0A=
}=0A=
+ LEAVE_GL();=0A=
=0A=
hr =3D IWineD3DSurface_GetContainer((IWineD3DSurface*)This, =
&IID_IWineD3DSwapChain, (void **) &swapchain);=0A=
if(hr =3D=3D WINED3D_OK && swapchain) {=0A=
@@ -4204,7 +4203,6 @@ static inline void =
surface_blt_to_drawable(IWineD3DSurfaceImpl *This, const RECT=0A=
IWineD3DBaseTexture_Release(texture);=0A=
}=0A=
}=0A=
- LEAVE_GL();=0A=
}=0A=
=0A=
=
/************************************************************************=
*****=0A=
-- =0A=
1.5.4.5=0A=
=0A=
------=_NextPart_000_003D_01C8F640.A19167A0--
More information about the wine-patches
mailing list