From 25d0f7937a09f0d693e664537eeedfb419e45c65 Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Tue, 16 Dec 2008 02:39:49 +0100 Subject: [PATCH] Fix crashes when switching VTs with EXA enabled. Call ModifyPixmapHeader on SMI_EnterVT to update the screen pixmap address tracked by EXA. Set memoryBase in the ExaDriverRec to NULL when switching out: some pixmap could get allocated near the former aperture address and it could be erroneously considered as being in offscreen memory. --- src/smi_crtc.c | 9 +++++---- src/smi_driver.c | 8 ++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/smi_crtc.c b/src/smi_crtc.c index c84e4c2..20a4fd8 100644 --- a/src/smi_crtc.c +++ b/src/smi_crtc.c @@ -217,12 +217,13 @@ SMI_CrtcConfigResize(ScrnInfoPtr pScrn, pSmi->FBOffset = fbArea->offset; pScrn->fbOffset = pSmi->FBOffset + pSmi->fbMapOffset; + pScrn->pScreen->ModifyPixmapHeader(pScrn->pScreen->GetScreenPixmap(pScrn->pScreen), + -1,-1,-1,-1,-1, pSmi->FBBase + pSmi->FBOffset); + if(pScrn->pixmapPrivate.ptr) - /* Framebuffer access is disabled */ + /* The pixmap devPrivate just set may be overwritten by + xf86EnableDisableFBAccess */ pScrn->pixmapPrivate.ptr = pSmi->FBBase + pSmi->FBOffset; - else - pScrn->pScreen->ModifyPixmapHeader(pScrn->pScreen->GetScreenPixmap(pScrn->pScreen), - -1,-1,-1,-1,-1, pSmi->FBBase + pSmi->FBOffset); /* Modify the screen pitch */ pScrn->displayWidth = aligned_pitch / pSmi->Bpp; diff --git a/src/smi_driver.c b/src/smi_driver.c index 929ef3f..9edf02f 100644 --- a/src/smi_driver.c +++ b/src/smi_driver.c @@ -1014,7 +1014,10 @@ SMI_EnterVT(int scrnIndex, int flags) pSmi->Save(pScrn); /* FBBase may have changed after remapping the memory */ + pScrn->pScreen->ModifyPixmapHeader(pScrn->pScreen->GetScreenPixmap(pScrn->pScreen), + -1,-1,-1,-1,-1, pSmi->FBBase + pSmi->FBOffset); pScrn->pixmapPrivate.ptr=pSmi->FBBase + pSmi->FBOffset; + if(pSmi->useEXA) pSmi->EXADriverPtr->memoryBase=pSmi->FBBase; @@ -1058,6 +1061,11 @@ SMI_LeaveVT(int scrnIndex, int flags) unmapped. */ xf86RotateCloseScreen(pScrn->pScreen); + /* Pixmaps that by chance get allocated near the former aperture + address shouldn't be considered offscreen. */ + if(pSmi->useEXA) + pSmi->EXADriverPtr->memoryBase=NULL; + /* Clear frame buffer */ memset(pSmi->FBBase, 0, pSmi->videoRAMBytes); -- 1.5.6.5