diff options
author | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-10-28 14:23:08 +0000 |
---|---|---|
committer | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-10-28 14:23:08 +0000 |
commit | 9d4823adc8319a20d2ace3d0944ca32e300f6eeb (patch) | |
tree | 66a10f48e62f2e8281af56877105d97f1c34f6d9 /hw/xwin/winshadddnl.c | |
parent | db65fce04ddec1dac0d92ad3abc95ab4996bd206 (diff) |
Import recent changes from CYGWIN branch
Diffstat (limited to 'hw/xwin/winshadddnl.c')
-rw-r--r-- | hw/xwin/winshadddnl.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/hw/xwin/winshadddnl.c b/hw/xwin/winshadddnl.c index c9e629298..2ec28c957 100644 --- a/hw/xwin/winshadddnl.c +++ b/hw/xwin/winshadddnl.c @@ -141,11 +141,21 @@ winCreatePrimarySurfaceShadowDDNL (ScreenPtr pScreen) &ddsd, &pScreenPriv->pddsPrimary4, NULL); + pScreenPriv->fRetryCreateSurface = FALSE; if (FAILED (ddrval)) { - ErrorF ("winCreatePrimarySurfaceShadowDDNL - Could not create primary " - "surface: %08x\n", - (unsigned int) ddrval); + if (ddrval == DDERR_NOEXCLUSIVEMODE) + { + /* Recreating the surface failed. Mark screen to retry later */ + pScreenPriv->fRetryCreateSurface = TRUE; + winDebug ("winCreatePrimarySurfaceShadowDDNL - Could not create " + "primary surface: DDERR_NOEXCLUSIVEMODE\n"); + } + else + { + ErrorF ("winCreatePrimarySurfaceShadowDDNL - Could not create " + "primary surface: %08x\n", (unsigned int) ddrval); + } return FALSE; } @@ -1055,6 +1065,17 @@ winBltExposedRegionsShadowDDNL (ScreenPtr pScreen) Bool fReturn = TRUE; int i; + /* Quite common case. The primary surface was lost (maybe because of depth + * change). Try to create a new primary surface. Bail out if this fails */ + if (pScreenPriv->pddsPrimary4 == NULL && pScreenPriv->fRetryCreateSurface && + !winCreatePrimarySurfaceShadowDDNL(pScreen)) + { + Sleep(100); + return FALSE; + } + if (pScreenPriv->pddsPrimary4 == NULL) + return FALSE; + /* BeginPaint gives us an hdc that clips to the invalidated region */ hdcUpdate = BeginPaint (pScreenPriv->hwndScreen, &ps); if (hdcUpdate == NULL) |