summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@openbsd.org>2010-08-29 18:07:01 +0200
committerMark Kettenis <kettenis@openbsd.org>2010-08-29 18:07:01 +0200
commit1732886624c7590a8084bb7d92e87ff341aa6d66 (patch)
treec7ca34352e7257677094c08c598af3d5892ac599
parent7a1549678a19c6e94e1ecb3223c74effbd5009d2 (diff)
Don't play wrapping games
The driver calls the wrapped CloseScreen function in the middle of messing with the hardware state. On multi-card setups this may cause the VGA arbiter to switch to a different card while we're in the middle of things, with obvious disastrous effects. This fixes things by making sure we only call the wrapped CloseScreen function at the very end of the driver's CloseScreen function. Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
-rw-r--r--src/aticonsole.c9
-rw-r--r--src/atiscreen.c14
2 files changed, 4 insertions, 19 deletions
diff --git a/src/aticonsole.c b/src/aticonsole.c
index 8efe897..1be147e 100644
--- a/src/aticonsole.c
+++ b/src/aticonsole.c
@@ -784,17 +784,10 @@ ATIFreeScreen
int flags
)
{
- ScreenPtr pScreen = screenInfo.screens[iScreen];
ScrnInfoPtr pScreenInfo = xf86Screens[iScreen];
ATIPtr pATI = ATIPTR(pScreenInfo);
- if (pATI->Closeable || (serverGeneration > 1))
- ATII2CFreeScreen(iScreen);
-
- if (pATI->Closeable)
- (void)(*pScreen->CloseScreen)(iScreen, pScreen);
-
- ATILeaveGraphics(pScreenInfo, pATI);
+ ATII2CFreeScreen(iScreen);
#ifndef AVOID_CPIO
diff --git a/src/atiscreen.c b/src/atiscreen.c
index bc57934..cf79c37 100644
--- a/src/atiscreen.c
+++ b/src/atiscreen.c
@@ -628,7 +628,6 @@ ATICloseScreen
{
ScrnInfoPtr pScreenInfo = xf86Screens[iScreen];
ATIPtr pATI = ATIPTR(pScreenInfo);
- Bool Closed = TRUE;
#ifdef XF86DRI_DEVEL
@@ -658,21 +657,13 @@ ATICloseScreen
pATI->pXAAInfo = NULL;
}
#endif
-
- if ((pScreen->CloseScreen = pATI->CloseScreen))
- {
- pATI->CloseScreen = NULL;
- Closed = (*pScreen->CloseScreen)(iScreen, pScreen);
- }
-
- pATI->Closeable = FALSE;
-
if (pATI->pCursorInfo)
{
xf86DestroyCursorInfoRec(pATI->pCursorInfo);
pATI->pCursorInfo = NULL;
}
+ pATI->Closeable = FALSE;
ATILeaveGraphics(pScreenInfo, pATI);
#ifdef USE_XAA
@@ -688,5 +679,6 @@ ATICloseScreen
pATI->pShadow = NULL;
pScreenInfo->pScreen = NULL;
- return Closed;
+ pScreen->CloseScreen = pATI->CloseScreen;
+ return (*pScreen->CloseScreen)(iScreen, pScreen);
}