Xming,Cygwin/X: Fix crashes when using the DirectDraw '-refresh rate-in-Hz' option in -fullscreen (#11128)

fd.o bugzilla #11128

Fix crashes when using the '-refresh rate-in-Hz' option in -fullscreen mode and using a DirectDraw engine.
On failure (typically 0x80004001 DDERR_UNSUPPORTED), use the default refresh rate for the driver, instead of the
entered value.

Also fix some nearby error reporting

Copyright (C) Colin Harrison 2005-2008
http://www.straightrunning.com/XmingNotes/
http://sourceforge.net/projects/xming/

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
This commit is contained in:
Colin Harrison 2008-11-02 20:46:44 +00:00 committed by Jon TURNEY
parent b0ed1567c1
commit 21a2df9f35
2 changed files with 37 additions and 10 deletions

View File

@ -361,7 +361,7 @@ winAllocateFBShadowDD (ScreenPtr pScreen)
{
ErrorF ("winAllocateFBShadowDD - Changing video mode\n");
/* Change the video mode to the mode requested */
/* Change the video mode to the mode requested, and use the driver default refresh rate on failure */
ddrval = IDirectDraw2_SetDisplayMode (pScreenPriv->pdd2,
pScreenInfo->dwWidth,
pScreenInfo->dwHeight,
@ -373,7 +373,20 @@ winAllocateFBShadowDD (ScreenPtr pScreen)
ErrorF ("winAllocateFBShadowDD - Could not set "\
"full screen display mode: %08x\n",
(unsigned int) ddrval);
return FALSE;
ErrorF ("winAllocateFBShadowDD - Using default driver refresh rate\n");
ddrval = IDirectDraw2_SetDisplayMode (pScreenPriv->pdd2,
pScreenInfo->dwWidth,
pScreenInfo->dwHeight,
pScreenInfo->dwBPP,
0,
0);
if (FAILED(ddrval))
{
ErrorF ("winAllocateFBShadowDD - Could not set default refresh rate "
"full screen display mode: %08x\n",
(unsigned int) ddrval);
return FALSE;
}
}
}
else
@ -534,7 +547,7 @@ winShadowUpdateDD (ScreenPtr pScreen,
ddrval = IDirectDrawSurface2_Unlock (pScreenPriv->pddsShadow, NULL);
if (FAILED (ddrval))
{
ErrorF ("winShadowUpdateProcDD - Unlock failed\n");
ErrorF ("winShadowUpdateDD - Unlock failed\n");
return;
}
@ -626,19 +639,20 @@ winShadowUpdateDD (ScreenPtr pScreen,
NULL);
if (FAILED (ddrval))
{
ErrorF ("winShadowUpdateProcDD - Lock failed\n");
ErrorF ("winShadowUpdateDD - Lock failed\n");
return;
}
/* Has our memory pointer changed? */
if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface)
{
ErrorF ("winShadowUpdateProcDD - Memory location of the shadow "
extern char *g_pszLogFile;
ErrorF ("winShadowUpdateDD - Memory location of the shadow "
"surface has changed, trying to update the root window "
"pixmap header to point to the new address. If you get "
"this message and "PROJECT_NAME" freezes or crashes "
"after this message then send a problem report and your "
"/tmp/XWin.log file to cygwin-xfree@cygwin.com\n");
"%s file to " BUILDERADDR, g_pszLogFile);
/* Location of shadow framebuffer has changed */
pScreenInfo->pfb = pScreenPriv->pddsdShadow->lpSurface;
@ -653,7 +667,7 @@ winShadowUpdateDD (ScreenPtr pScreen,
pScreenInfo->dwBPP),
pScreenInfo->pfb))
{
ErrorF ("winShadowUpdateProcDD - Bits changed, could not "
ErrorF ("winShadowUpdateDD - Bits changed, could not "
"notify fb.\n");
return;
}

View File

@ -391,7 +391,7 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen)
{
winDebug ("winAllocateFBShadowDDNL - Changing video mode\n");
/* Change the video mode to the mode requested */
/* Change the video mode to the mode requested, and use the driver default refresh rate on failure */
ddrval = IDirectDraw4_SetDisplayMode (pScreenPriv->pdd4,
pScreenInfo->dwWidth,
pScreenInfo->dwHeight,
@ -403,7 +403,20 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen)
ErrorF ("winAllocateFBShadowDDNL - Could not set "
"full screen display mode: %08x\n",
(unsigned int) ddrval);
return FALSE;
ErrorF ("winAllocateFBShadowDDNL - Using default driver refresh rate\n");
ddrval = IDirectDraw4_SetDisplayMode (pScreenPriv->pdd4,
pScreenInfo->dwWidth,
pScreenInfo->dwHeight,
pScreenInfo->dwBPP,
0,
0);
if (FAILED(ddrval))
{
ErrorF ("winAllocateFBShadowDDNL - Could not set default refresh rate "
"full screen display mode: %08x\n",
(unsigned int) ddrval);
return FALSE;
}
}
}
else
@ -1310,7 +1323,7 @@ winStoreColorsShadowDDNL (ColormapPtr pColormap,
+ pdefs[0].pixel);
if (FAILED (ddrval))
{
ErrorF ("winStoreColorsShadowDDNL - SetEntries () failed: %08x\n", ddrval);
ErrorF ("winStoreColorsShadowDDNL - SetEntries () failed: %08x\n", (unsigned int) ddrval);
return FALSE;
}