diff options
author | Egbert Eich <eich@freedesktop.org> | 2008-06-25 22:55:27 +0200 |
---|---|---|
committer | Egbert Eich <eich@freedesktop.org> | 2008-06-28 11:20:58 +0200 |
commit | 5344ea9afa8b7d8ae1b455344f0391f4e71f00c8 (patch) | |
tree | f6223ca4fe7c81289987e95ac3be0f2569e62802 | |
parent | c1ee81fb896928f8baa8ace1e2c738e9dc8c72a4 (diff) |
2D: Consolidated variables on which acceleration is used.
Both accelOn and useEXA were consolidated to AccelMethod.
2D memory setup and init was moved to a separate function.
-rw-r--r-- | src/radeon_accel.c | 4 | ||||
-rw-r--r-- | src/radeon_textured_video.c | 6 | ||||
-rw-r--r-- | src/radeon_textured_videofuncs.c | 2 | ||||
-rw-r--r-- | src/radeon_video.c | 9 | ||||
-rw-r--r-- | src/rhd.h | 2 | ||||
-rw-r--r-- | src/rhd_cp.h | 8 | ||||
-rw-r--r-- | src/rhd_driver.c | 115 |
7 files changed, 96 insertions, 50 deletions
diff --git a/src/radeon_accel.c b/src/radeon_accel.c index 8bb7db9..9f309f9 100644 --- a/src/radeon_accel.c +++ b/src/radeon_accel.c @@ -836,7 +836,7 @@ Bool RADEONAccelInit(ScreenPtr pScreen) return FALSE; #ifdef USE_EXA - if (info->useEXA) { + if (info->AccelMethod == RHD_ACCEL_EXA) { # ifdef USE_DRI if (info->directRenderingEnabled) { if (!RADEONDrawInitCP(pScreen)) @@ -850,7 +850,7 @@ Bool RADEONAccelInit(ScreenPtr pScreen) } #endif /* USE_EXA */ #ifdef USE_XAA - if (!info->useEXA) { + if (info->AccelMethod == RHD_ACCEL_XAA) { XAAInfoRecPtr a; if (!(a = info->accel = XAACreateInfoRec())) { diff --git a/src/radeon_textured_video.c b/src/radeon_textured_video.c index 4a69c3b..aa07af6 100644 --- a/src/radeon_textured_video.c +++ b/src/radeon_textured_video.c @@ -57,7 +57,7 @@ RADEONTilingEnabled(ScrnInfoPtr pScrn, PixmapPtr pPix) RHDPtr info = RHDPTR(pScrn); #ifdef USE_EXA - if (info->useEXA) { + if (info->AccelMethod == RHD_ACCEL_EXA) { if (info->tilingEnabled && exaGetPixmapOffset(pPix) == 0) return TRUE; else @@ -207,13 +207,13 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn, pPriv->pPixmap = (PixmapPtr)pDraw; #ifdef USE_EXA - if (info->useEXA) { + if (info->AccelMethod == RHD_ACCEL_EXA) { /* Force the pixmap into framebuffer so we can draw to it. */ exaMoveInPixmap(pPriv->pPixmap); } #endif - if (!info->useEXA && + if (info->AccelMethod == RHD_ACCEL_XAA && (((char *)pPriv->pPixmap->devPrivate.ptr < ((char *)info->FbBase + info->FbScanoutStart)) || ((char *)pPriv->pPixmap->devPrivate.ptr >= ((char *)info->FbBase + info->FbMapSize)))) { /* If the pixmap wasn't in framebuffer, then we have no way in XAA to diff --git a/src/radeon_textured_videofuncs.c b/src/radeon_textured_videofuncs.c index b354569..a819955 100644 --- a/src/radeon_textured_videofuncs.c +++ b/src/radeon_textured_videofuncs.c @@ -89,7 +89,7 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv pixel_shift = pPixmap->drawable.bitsPerPixel >> 4; #ifdef USE_EXA - if (info->useEXA) { + if (info->AccelMethod == RHD_ACCEL_EXA) { dst_offset = exaGetPixmapOffset(pPixmap) + info->FbIntAddress + info->FbScanoutStart; dst_pitch = exaGetPixmapPitch(pPixmap); } else diff --git a/src/radeon_video.c b/src/radeon_video.c index 074c38f..8b36632 100644 --- a/src/radeon_video.c +++ b/src/radeon_video.c @@ -1,4 +1,3 @@ - #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -485,7 +484,7 @@ RADEONAllocateMemory( pScreen = screenInfo.screens[pScrn->scrnIndex]; #ifdef USE_EXA - if (info->useEXA) { + if (info->AccelMethod == RHD_ACCEL_EXA) { ExaOffscreenArea *area = *mem_struct; if (area != NULL) { @@ -504,7 +503,7 @@ RADEONAllocateMemory( } #endif /* USE_EXA */ #ifdef USE_XAA - if (!info->useEXA) { + if (info->AccelMethod == RHD_ACCEL_XAA) { FBLinearPtr linear = *mem_struct; int cpp = pScrn->bitsPerPixel >> 3; @@ -558,7 +557,7 @@ RADEONFreeMemory( RHDPtr info = RHDPTR(pScrn); #ifdef USE_EXA - if (info->useEXA) { + if (info->AccelMethod == RHD_ACCEL_EXA) { ExaOffscreenArea *area = mem_struct; if (area != NULL) @@ -566,7 +565,7 @@ RADEONFreeMemory( } #endif /* USE_EXA */ #ifdef USE_XAA - if (!info->useEXA) { + if (info->AccelMethod == RHD_ACCEL_XAA) { FBLinearPtr linear = mem_struct; if (linear != NULL) @@ -412,11 +412,9 @@ typedef struct RHDRec { #ifdef USE_EXA ExaDriverPtr exa; #endif - Bool useEXA; #ifdef USE_XAA XAAInfoRecPtr accel; #endif - Bool accelOn; Bool allowColorTiling; Bool tilingEnabled; /* mirror of sarea->tiling_enabled */ diff --git a/src/rhd_cp.h b/src/rhd_cp.h index 5b6df38..7e0fcc4 100644 --- a/src/rhd_cp.h +++ b/src/rhd_cp.h @@ -298,11 +298,11 @@ do { \ static __inline__ void RADEON_MARK_SYNC(RHDPtr info, ScrnInfoPtr pScrn) { # ifdef USE_EXA - if (info->useEXA) + if (info->AccelMethod == RHD_ACCEL_EXA) exaMarkSync(pScrn->pScreen); # endif # ifdef USE_XAA - if (!info->useEXA) + if (info->AccelMethod == RHD_ACCEL_XAA) SET_SYNC_FLAG(info->accel); # endif } @@ -310,11 +310,11 @@ static __inline__ void RADEON_MARK_SYNC(RHDPtr info, ScrnInfoPtr pScrn) static __inline__ void RADEON_SYNC(RHDPtr info, ScrnInfoPtr pScrn) { # ifdef USE_EXA - if (info->useEXA) + if (info->AccelMethod == RHD_ACCEL_EXA) exaWaitSync(pScrn->pScreen); # endif # ifdef USE_XAA - if (!info->useEXA && info->accel) + if (info->AccelMethod == RHD_ACCEL_XAA && info->accel) info->accel->Sync(pScrn); # endif } diff --git a/src/rhd_driver.c b/src/rhd_driver.c index b52d5fa..17c4e3d 100644 --- a/src/rhd_driver.c +++ b/src/rhd_driver.c @@ -885,7 +885,6 @@ RHDPreInit(ScrnInfoPtr pScrn, int flags) } } - rhdPtr->useEXA = FALSE; /* try to load the XAA module here */ if (rhdPtr->AccelMethod == RHD_ACCEL_XAA) { if (!xf86LoadSubModule(pScrn, "xaa")) { @@ -905,7 +904,6 @@ RHDPreInit(ScrnInfoPtr pScrn, int flags) rhdPtr->AccelMethod = RHD_ACCEL_SHADOWFB; } else { xf86LoaderReqSymLists(exaSymbols, NULL); - rhdPtr->useEXA = TRUE; } } #endif /* USE_EXA */ @@ -928,6 +926,37 @@ RHDPreInit(ScrnInfoPtr pScrn, int flags) RHDDebug(pScrn->scrnIndex, "Free FB offset 0x%08X (size = 0x%08X)\n", rhdPtr->FbFreeStart, rhdPtr->FbFreeSize); + ret = TRUE; + + error1: + rhdUnmapMMIO(rhdPtr); + error0: + if (!ret) + RHDFreeRec(pScrn); + + return ret; +} + +/* + * + */ +static Bool +RHD2DAccelInit(ScreenPtr pScreen, ScrnInfoPtr pScrn) +{ + RHDPtr rhdPtr = RHDPTR(pScrn); + + Bool ret = FALSE; + + RHDFUNC(pScrn); + + if (rhdPtr->ChipSet >= RHD_R600) + return FALSE; + + if (!(rhdPtr->accel_state = xcalloc(1, sizeof(struct rhdAccel)))) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unable to allocate accel_state rec!\n"); + return FALSE; + } + /* old IGP chips have no PVS/TCL hw */ if ((rhdPtr->ChipSet == RHD_RS600) || (rhdPtr->ChipSet == RHD_RS690) || @@ -936,13 +965,44 @@ RHDPreInit(ScrnInfoPtr pScrn, int flags) else rhdPtr->has_tcl = TRUE; - ret = TRUE; + rhdPtr->accel_state->dst_pitch_offset = (((pScrn->displayWidth * (pScrn->bitsPerPixel >> 3) / 64) + << 22) | ((rhdPtr->FbIntAddress + rhdPtr->FbScanoutStart) >> 10)); - error1: - rhdUnmapMMIO(rhdPtr); - error0: - if (!ret) - RHDFreeRec(pScrn); +#ifdef USE_EXA + if (rhdPtr->AccelMethod == RHD_ACCEL_EXA) { + if (RADEONSetupMemEXA(pScreen)) { + if (!(ret = RADEONAccelInit(pScreen))) { + + if (rhdPtr->exa) + xfree(rhdPtr->exa); + rhdPtr->exa = NULL; + + } + } + } +#endif +#ifdef USE_XAA + + if (rhdPtr->AccelMethod == RHD_ACCEL_XAA) { + if (RADEONSetupMemXAA(pScrn->scrnIndex, pScreen)) { + + if (!(ret = RADEONAccelInit(pScreen))) { + + if (rhdPtr->accel_state->scratch_save) + xfree(rhdPtr->accel_state->scratch_save); + rhdPtr->accel_state->scratch_save = NULL; + + if (rhdPtr->accel) + xfree(rhdPtr->accel); + rhdPtr->accel = NULL; + } + } + } +#endif + if (!ret) { + xfree(rhdPtr->accel_state); + rhdPtr->accel_state = NULL; + } return ret; } @@ -956,7 +1016,7 @@ RHDScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) VisualPtr visual; unsigned int racflag = 0; Bool DriScreenInited = FALSE; - + pScrn = xf86Screens[pScreen->myNum]; rhdPtr = RHDPTR(pScrn); RHDFUNC(pScrn); @@ -1034,31 +1094,18 @@ RHDScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) xf86SetBlackWhitePixels(pScreen); #ifdef USE_DRI -if (DriScreenInited) + if (DriScreenInited) rhdPtr->directRenderingEnabled = RHDDRIFinishScreenInit(pScreen); #endif - - rhdPtr->accelOn = FALSE; + /* Init 2D after DRI is set up */ if (rhdPtr->AccelMethod == RHD_ACCEL_SHADOWFB) { if (!RHDShadowSetup(pScreen)) /* No safetynet anymore */ return FALSE; - } else { - if (!(rhdPtr->accel_state = xcalloc(1, sizeof(struct rhdAccel)))) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unable to allocate accel_state rec!\n"); - return FALSE; - } - if (rhdPtr->AccelMethod == RHD_ACCEL_EXA) - RADEONSetupMemEXA(pScreen); - else if (rhdPtr->AccelMethod == RHD_ACCEL_XAA) - RADEONSetupMemXAA(scrnIndex, pScreen); - - rhdPtr->accel_state->dst_pitch_offset = (((pScrn->displayWidth * (pScrn->bitsPerPixel >> 3) / 64) - << 22) | ((rhdPtr->FbIntAddress + rhdPtr->FbScanoutStart) >> 10)); - if (RADEONAccelInit(pScreen)) - rhdPtr->accelOn = TRUE; - else - rhdPtr->accelOn = FALSE; + } else if (rhdPtr->AccelMethod == RHD_ACCEL_XAA + || rhdPtr->AccelMethod == RHD_ACCEL_EXA) { + if (!RHD2DAccelInit(pScreen, pScrn)) + rhdPtr->AccelMethod = RHD_ACCEL_NONE; } miInitializeBackingStore(pScreen); @@ -1129,15 +1176,15 @@ if (DriScreenInited) return TRUE; } -/* Mandatory */ +/* + * Mandatory + */ static Bool RHDCloseScreen(int scrnIndex, ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; RHDPtr rhdPtr = RHDPTR(pScrn); - rhdPtr->accelOn = FALSE; - #ifdef USE_DRI if (rhdPtr->dri) RHDDRICloseScreen(pScreen); @@ -1175,7 +1222,7 @@ RHDCloseScreen(int scrnIndex, ScreenPtr pScreen) } #endif /* USE_EXA */ #ifdef USE_XAA - if (!rhdPtr->useEXA) { + if (rhdPtr->AccelMethod == RHD_ACCEL_XAA) { if (rhdPtr->accel) XAADestroyInfoRec(rhdPtr->accel); rhdPtr->accel = NULL; @@ -1185,6 +1232,7 @@ RHDCloseScreen(int scrnIndex, ScreenPtr pScreen) xfree(rhdPtr->accel_state->scratch_save); rhdPtr->accel_state->scratch_save = NULL; } + } #endif /* USE_XAA */ if (rhdPtr->accel_state) { @@ -1236,7 +1284,8 @@ RHDEnterVT(int scrnIndex, int flags) RHDAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); - if (rhdPtr->accelOn) + if (rhdPtr->AccelMethod == RHD_ACCEL_XAA + || rhdPtr->AccelMethod == RHD_ACCEL_EXA) RADEONEngineRestore(pScrn); #ifdef USE_DRI |