From d901348441642fadbd71ed2e37e74b3b2a7af97c Mon Sep 17 00:00:00 2001 From: Jordan Crouse Date: Thu, 14 Dec 2006 17:28:48 -0700 Subject: Fix the memory mapping so its more sane, and disable XAA pixmap caches during rotation. --- src/amd_gx_driver.c | 20 +++++++------------- src/amd_gx_rotate.c | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 14 deletions(-) diff --git a/src/amd_gx_driver.c b/src/amd_gx_driver.c index 99ff264..7548fc7 100644 --- a/src/amd_gx_driver.c +++ b/src/amd_gx_driver.c @@ -308,7 +308,9 @@ GXAllocateMemory(ScreenPtr pScrn, ScrnInfoPtr pScrni, int rotate) } } - /* Set the memory available for the offscreen pixmaps */ + /* XAA always exists - we can't remove it on demand like we can with EXA. + So we assume the worse, and only give XAA enough offspace room to + account for any eventuality that RandR might throw at us. */ if (!pGeode->NoAccel) { @@ -319,9 +321,6 @@ GXAllocateMemory(ScreenPtr pScrn, ScrnInfoPtr pScrni, int rotate) pExa->memorySize = fboffset + fbavail; } - /* XXX - We don't use XAA if we are rotated, so this should be fine. Changing the - * resolution will hurt us though */ - if (!pGeode->useEXA) { if (!xf86FBManagerRunning(pScrn)) { @@ -331,15 +330,10 @@ GXAllocateMemory(ScreenPtr pScrn, ScrnInfoPtr pScrni, int rotate) RegionRec OffscreenRegion; BoxRec AvailBox; - /* We only get one shot at allocating offscreen memory for XAA */ - /* That means if the mode changes with RandR, we'll probably be out of luck. - * we can compensate for rotation by offsetting the start of offscreen memory to account - * for the shadow framebuffer even if we're not using it right now - */ + /* Assume the shadow FB exists even if it doesnt */ if (pGeode->shadowSize == 0) { size = (pScrn->width * bytpp) * pScrni->virtualX; - offset += size; avail -= size; } @@ -709,9 +703,6 @@ GXPreInit(ScrnInfoPtr pScrni, int flags) else pScrni->videoRam = pGeode->pEnt->device->videoRam; - if (!GXMapMem(pScrni)) - return FALSE; - pGeode->maxWidth = GX_MAX_WIDTH; pGeode->maxHeight = GX_MAX_HEIGHT; @@ -1076,6 +1067,9 @@ GXEnterGraphics(ScreenPtr pScrn, ScrnInfoPtr pScrni) { GeodeRec *pGeode = GEODEPTR(pScrni); + if (!GXMapMem(pScrni)) + return FALSE; + gfx_wait_until_idle(); /* Save off the current state (should this be somewhere else)? */ diff --git a/src/amd_gx_rotate.c b/src/amd_gx_rotate.c index c5ae30a..3bc0d06 100644 --- a/src/amd_gx_rotate.c +++ b/src/amd_gx_rotate.c @@ -90,7 +90,7 @@ GXRotate(ScrnInfoPtr pScrni, DisplayModePtr mode) GeodeRec *pGeode = GEODEPTR(pScrni); ShadowUpdateProc update; Rotation curr = pGeode->rotation; - unsigned int pitch, dw; + unsigned int curdw = pScrni->displayWidth; PixmapPtr pPixmap; BOOL ret; @@ -154,5 +154,37 @@ GXRotate(ScrnInfoPtr pScrni, DisplayModePtr mode) PixmapBytePad(pScrni->displayWidth, pScrni->pScreen->rootDepth), (pointer) (pGeode->FBBase + pScrni->fbOffset)); + /* Don't use XAA pixmap cache or offscreen pixmaps when rotated */ + + if (pGeode->AccelInfoRec) { + if (pGeode->rotation == RR_Rotate_0) { + pGeode->AccelInfoRec->Flags = LINEAR_FRAMEBUFFER | OFFSCREEN_PIXMAPS | PIXMAP_CACHE; + pGeode->AccelInfoRec->UsingPixmapCache = TRUE; + pGeode->AccelInfoRec->maxOffPixWidth = 0; + pGeode->AccelInfoRec->maxOffPixHeight = 0; + } + else { + pGeode->AccelInfoRec->Flags = LINEAR_FRAMEBUFFER; + pGeode->AccelInfoRec->UsingPixmapCache = FALSE; + pGeode->AccelInfoRec->maxOffPixWidth = 1; + pGeode->AccelInfoRec->maxOffPixHeight = 1; + } + } + return TRUE; + +error: + /* Restore the old rotation */ + pScrni->displayWidth = curdw; + + if (curr & (RR_Rotate_0 | RR_Rotate_180)) { + pScrni->pScreen->width = pScrni->virtualX; + pScrni->pScreen->height = pScrni->virtualY; + } else { + pScrni->pScreen->width = pScrni->virtualY; + pScrni->pScreen->height = pScrni->virtualX; + } + + pGeode->rotation = curr; + return FALSE; } -- cgit v1.2.3