summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2004-10-28 12:30:28 +0000
committerAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2004-10-28 12:30:28 +0000
commit210fd527978bcc1b38f810c8c8da49a442b4696f (patch)
tree47c58911e3a713aec9bc23abbc32c06e912d6e2d
parent5fcb657e305444233867e07dd4380ab3f89ee818 (diff)
add fRetryCreateSurface
try to recreate the primary surface if it was lost mark screen to retry creating the primary surface if it failed
-rw-r--r--hw/xwin/ChangeLog9
-rw-r--r--hw/xwin/win.h1
-rw-r--r--hw/xwin/winshadddnl.c27
3 files changed, 34 insertions, 3 deletions
diff --git a/hw/xwin/ChangeLog b/hw/xwin/ChangeLog
index 1f4f455c9..fb8eac42e 100644
--- a/hw/xwin/ChangeLog
+++ b/hw/xwin/ChangeLog
@@ -1,3 +1,12 @@
+2004-10-28 Alexander Gottwald <ago at freedesktop dot org>
+
+ * win.h:
+ add fRetryCreateSurface
+ * winshaddnl.c (winBltExposedRegionsShadowDDNL):
+ try to recreate the primary surface if it was lost
+ * winshaddnl.c (winCreatePrimarySurfaceShadowDDNL):
+ mark screen to retry creating the primary surface if it failed
+
2004-10-23 Alexander Gottwald <ago at freedesktop dot org>
* winconfig (winConfigFiles):
diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index df336bac6..8fd8d21af 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -511,6 +511,7 @@ typedef struct _winPrivScreenRec
LPDIRECTDRAW4 pdd4;
LPDIRECTDRAWSURFACE4 pddsShadow4;
LPDIRECTDRAWSURFACE4 pddsPrimary4;
+ BOOL fRetryCreateSurface;
/* Privates used by both shadow fb DirectDraw servers */
LPDIRECTDRAWCLIPPER pddcPrimary;
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)