Cygwin/X: DirectDraw engines shouldn't try to blit if the surface wasn't allocated

Fix winShadowUpdateDD(|NL) so we don't try to blit to primary surface if it didn't get allocated

(Intel drivers, in particular, seem to like to issue a WM_DISPLAYCHANGE during a suspend/resume
cycle, but not allow surface to be allocated right then)

Also:
Use winReleasePrimarySurfaceShadowDD(|NL) in winFreeFBShadowDD(|NL) rather than open coding it
Don't mess about recreating surface if we're going to resize it anyhow

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
Tested-by: Colin Harrison <colin.harrison@virgin.net>
This commit is contained in:
Jon TURNEY 2010-09-29 22:54:22 +01:00
parent 625ab9701f
commit 09fd010902
3 changed files with 18 additions and 44 deletions

View File

@ -514,25 +514,16 @@ winFreeFBShadowDD (ScreenPtr pScreen)
pScreenPriv->pddsShadow = NULL; pScreenPriv->pddsShadow = NULL;
} }
/* Detach the clipper from the primary surface and release the clipper. */ /* Detach the clipper from the primary surface and release the primary surface, if there is one */
if (pScreenPriv->pddcPrimary) winReleasePrimarySurfaceShadowDD(pScreen);
{
/* Detach the clipper */
IDirectDrawSurface2_SetClipper (pScreenPriv->pddsPrimary,
NULL);
/* Release the clipper object */ /* Release the clipper object */
if (pScreenPriv->pddcPrimary)
{
IDirectDrawClipper_Release (pScreenPriv->pddcPrimary); IDirectDrawClipper_Release (pScreenPriv->pddcPrimary);
pScreenPriv->pddcPrimary = NULL; pScreenPriv->pddcPrimary = NULL;
} }
/* Release the primary surface, if there is one */
if (pScreenPriv->pddsPrimary)
{
IDirectDrawSurface2_Release (pScreenPriv->pddsPrimary);
pScreenPriv->pddsPrimary = NULL;
}
/* Free the DirectDraw2 object, if there is one */ /* Free the DirectDraw2 object, if there is one */
if (pScreenPriv->pdd2) if (pScreenPriv->pdd2)
{ {
@ -577,6 +568,10 @@ winShadowUpdateDD (ScreenPtr pScreen,
if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen) if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen)
|| pScreenPriv->fBadDepth) return; || pScreenPriv->fBadDepth) return;
/* Return immediately if we didn't get needed surfaces */
if (!pScreenPriv->pddsPrimary || !pScreenPriv->pddsShadow)
return;
/* Get the origin of the window in the screen coords */ /* Get the origin of the window in the screen coords */
ptOrigin.x = pScreenInfo->dwXOffset; ptOrigin.x = pScreenInfo->dwXOffset;
ptOrigin.y = pScreenInfo->dwYOffset; ptOrigin.y = pScreenInfo->dwYOffset;

View File

@ -546,25 +546,16 @@ winFreeFBShadowDDNL(ScreenPtr pScreen)
pScreenPriv->pddsShadow4 = NULL; pScreenPriv->pddsShadow4 = NULL;
} }
/* Detach the clipper from the primary surface and release the clipper. */ /* Detach the clipper from the primary surface and release the primary surface, if there is one */
if (pScreenPriv->pddcPrimary) winReleasePrimarySurfaceShadowDDNL(pScreen);
{
/* Detach the clipper */
IDirectDrawSurface4_SetClipper (pScreenPriv->pddsPrimary4,
NULL);
/* Release the clipper object */ /* Release the clipper object */
if (pScreenPriv->pddcPrimary)
{
IDirectDrawClipper_Release (pScreenPriv->pddcPrimary); IDirectDrawClipper_Release (pScreenPriv->pddcPrimary);
pScreenPriv->pddcPrimary = NULL; pScreenPriv->pddcPrimary = NULL;
} }
/* Release the primary surface, if there is one */
if (pScreenPriv->pddsPrimary4)
{
IDirectDrawSurface4_Release (pScreenPriv->pddsPrimary4);
pScreenPriv->pddsPrimary4 = NULL;
}
/* Free the DirectDraw4 object, if there is one */ /* Free the DirectDraw4 object, if there is one */
if (pScreenPriv->pdd4) if (pScreenPriv->pdd4)
{ {
@ -658,6 +649,10 @@ winShadowUpdateDDNL (ScreenPtr pScreen,
if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen) if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen)
|| pScreenPriv->fBadDepth) return; || pScreenPriv->fBadDepth) return;
/* Return immediately if we didn't get needed surfaces */
if (!pScreenPriv->pddsPrimary4 || !pScreenPriv->pddsShadow4)
return;
/* Get the origin of the window in the screen coords */ /* Get the origin of the window in the screen coords */
ptOrigin.x = pScreenInfo->dwXOffset; ptOrigin.x = pScreenInfo->dwXOffset;
ptOrigin.y = pScreenInfo->dwYOffset; ptOrigin.y = pScreenInfo->dwYOffset;

View File

@ -230,19 +230,8 @@ winWindowProc (HWND hwnd, UINT message,
then we should do so here. For the moment, assume it does. then we should do so here. For the moment, assume it does.
(this is probably usually the case so that might be an (this is probably usually the case so that might be an
overoptimization) overoptimization)
*/
/*
* We can simply recreate the same-sized primary surface when
* the display dimensions change.
*/ */
{ {
#if CYGDEBUG
winDebug ("winWindowProc - WM_DISPLAYCHANGE - Recreated "
"primary surface\n");
#endif
/* /*
In rootless modes which are monitor or virtual desktop size In rootless modes which are monitor or virtual desktop size
use RandR to resize the X screen use RandR to resize the X screen
@ -311,13 +300,8 @@ winWindowProc (HWND hwnd, UINT message,
else else
{ {
/* /*
If we get here, we are either windowed and using the GDI engine * We can simply recreate the same-sized primary surface when
or windowed and non-fullscreen using any engine * the display dimensions change.
*/
/*
* For ddraw engines, we need to (try to) recreate the same-sized primary surface
* when display dimensions change (but not depth, that is disruptive)
*/ */
/* /*