summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <daenzer@vmware.com>2009-01-24 11:10:00 +0100
committerMichel Dänzer <daenzer@vmware.com>2009-01-24 11:10:00 +0100
commit1c5678fc452dbc93135e9ece50a4cff6583f6078 (patch)
tree729504a960f00c84f238e515c7a54729c8898b23
parent5cbd6082b9f8d7009ee9ef5e036673f99e1bfb05 (diff)
Drop memcpy fallbacks from EXA UploadToScreen and DownloadFromScreen hooks.
While in theory it's possible for the PrepareAccess hook to fail on big endian platforms, in practice it isn't at this point because there's no other users of the surface registers.
-rw-r--r--src/radeon_driver.c14
-rw-r--r--src/radeon_exa_funcs.c114
2 files changed, 19 insertions, 109 deletions
diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index e53edbbe..22b2e4c6 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -3361,15 +3361,9 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen,
#ifdef USE_EXA
if (info->useEXA) {
#ifdef XF86DRI
- MessageType from = X_DEFAULT;
-
if (hasDRI) {
- info->accelDFS = info->cardType != CARD_AGP;
-
- if (xf86GetOptValInteger(info->Options, OPTION_ACCEL_DFS,
- &info->accelDFS)) {
- from = X_CONFIG;
- }
+ info->accelDFS = xf86ReturnOptValBool(info->Options, OPTION_ACCEL_DFS,
+ info->cardType != CARD_AGP);
/* Reserve approx. half of offscreen memory for local textures by
* default, can be overridden with Option "FBTexPercent".
@@ -3387,10 +3381,6 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen,
}
}
}
-
- xf86DrvMsg(pScrn->scrnIndex, from,
- "%ssing accelerated EXA DownloadFromScreen hook\n",
- info->accelDFS ? "U" : "Not u");
#endif /* XF86DRI */
if (!RADEONSetupMemEXA(pScreen))
diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c
index 55710ff5..cd97cc6e 100644
--- a/src/radeon_exa_funcs.c
+++ b/src/radeon_exa_funcs.c
@@ -256,31 +256,23 @@ FUNC_NAME(RADEONDoneCopy)(PixmapPtr pDst)
FINISH_ACCEL();
}
+
+#ifdef ACCEL_CP
+
static Bool
-FUNC_NAME(RADEONUploadToScreen)(PixmapPtr pDst, int x, int y, int w, int h,
- char *src, int src_pitch)
+RADEONUploadToScreenCP(PixmapPtr pDst, int x, int y, int w, int h,
+ char *src, int src_pitch)
{
RINFO_FROM_SCREEN(pDst->drawable.pScreen);
- uint8_t *dst = info->FB + exaGetPixmapOffset(pDst);
- unsigned int dst_pitch = exaGetPixmapPitch(pDst);
unsigned int bpp = pDst->drawable.bitsPerPixel;
-#ifdef ACCEL_CP
unsigned int hpass;
uint32_t buf_pitch, dst_pitch_off;
-#endif
-#if X_BYTE_ORDER == X_BIG_ENDIAN
- unsigned char *RADEONMMIO = info->MMIO;
- unsigned int swapper = info->ModeReg->surface_cntl &
- ~(RADEON_NONSURF_AP0_SWP_32BPP | RADEON_NONSURF_AP1_SWP_32BPP |
- RADEON_NONSURF_AP0_SWP_16BPP | RADEON_NONSURF_AP1_SWP_16BPP);
-#endif
TRACE;
if (bpp < 8)
return FALSE;
-#ifdef ACCEL_CP
if (info->directRenderingEnabled &&
RADEONGetPixmapOffsetPitch(pDst, &dst_pitch_off)) {
uint8_t *buf;
@@ -301,45 +293,11 @@ FUNC_NAME(RADEONUploadToScreen)(PixmapPtr pDst, int x, int y, int w, int h,
exaMarkSync(pDst->drawable.pScreen);
return TRUE;
- }
-#endif
-
- /* Do we need that sync here ? probably not .... */
- exaWaitSync(pDst->drawable.pScreen);
-
-#if X_BYTE_ORDER == X_BIG_ENDIAN
- switch(bpp) {
- case 15:
- case 16:
- swapper |= RADEON_NONSURF_AP0_SWP_16BPP
- | RADEON_NONSURF_AP1_SWP_16BPP;
- break;
- case 24:
- case 32:
- swapper |= RADEON_NONSURF_AP0_SWP_32BPP
- | RADEON_NONSURF_AP1_SWP_32BPP;
- break;
}
- OUTREG(RADEON_SURFACE_CNTL, swapper);
-#endif
- w *= bpp / 8;
- dst += (x * bpp / 8) + (y * dst_pitch);
-
- while (h--) {
- memcpy(dst, src, w);
- src += src_pitch;
- dst += dst_pitch;
- }
-
-#if X_BYTE_ORDER == X_BIG_ENDIAN
- /* restore byte swapping */
- OUTREG(RADEON_SURFACE_CNTL, info->ModeReg->surface_cntl);
-#endif
- return TRUE;
+ return FALSE;
}
-#ifdef ACCEL_CP
/* Emit blit with arbitrary source and destination offsets and pitches */
static void
RADEONBlitChunk(ScrnInfoPtr pScrn, uint32_t datatype, uint32_t src_pitch_offset,
@@ -372,36 +330,26 @@ RADEONBlitChunk(ScrnInfoPtr pScrn, uint32_t datatype, uint32_t src_pitch_offset,
RADEON_WAIT_2D_IDLECLEAN | RADEON_WAIT_DMA_GUI_IDLE);
FINISH_ACCEL();
}
-#endif
+
static Bool
-FUNC_NAME(RADEONDownloadFromScreen)(PixmapPtr pSrc, int x, int y, int w, int h,
+RADEONDownloadFromScreenCP(PixmapPtr pSrc, int x, int y, int w, int h,
char *dst, int dst_pitch)
{
RINFO_FROM_SCREEN(pSrc->drawable.pScreen);
-#if X_BYTE_ORDER == X_BIG_ENDIAN
- unsigned char *RADEONMMIO = info->MMIO;
- unsigned int swapper = info->ModeReg->surface_cntl &
- ~(RADEON_NONSURF_AP0_SWP_32BPP | RADEON_NONSURF_AP1_SWP_32BPP |
- RADEON_NONSURF_AP0_SWP_16BPP | RADEON_NONSURF_AP1_SWP_16BPP);
-#endif
uint8_t *src = info->FB + exaGetPixmapOffset(pSrc);
- int src_pitch = exaGetPixmapPitch(pSrc);
int bpp = pSrc->drawable.bitsPerPixel;
-#ifdef ACCEL_CP
uint32_t datatype, src_pitch_offset, scratch_pitch = (w * bpp/8 + 63) & ~63, scratch_off = 0;
drmBufPtr scratch;
-#endif
TRACE;
-#ifdef ACCEL_CP
/*
* Try to accelerate download. Use an indirect buffer as scratch space,
* blitting the bits to one half while copying them out of the other one and
* then swapping the halves.
*/
- if (info->accelDFS && bpp != 24 && RADEONGetDatatypeBpp(bpp, &datatype) &&
+ if (bpp != 24 && RADEONGetDatatypeBpp(bpp, &datatype) &&
RADEONGetPixmapOffsetPitch(pSrc, &src_pitch_offset) &&
(scratch = RADEONCPGetBuffer(pScrn)))
{
@@ -487,43 +435,12 @@ FUNC_NAME(RADEONDownloadFromScreen)(PixmapPtr pSrc, int x, int y, int w, int h,
return TRUE;
}
-#endif
-
- /* Can't accelerate download */
- exaWaitSync(pSrc->drawable.pScreen);
-#if X_BYTE_ORDER == X_BIG_ENDIAN
- switch(bpp) {
- case 15:
- case 16:
- swapper |= RADEON_NONSURF_AP0_SWP_16BPP
- | RADEON_NONSURF_AP1_SWP_16BPP;
- break;
- case 24:
- case 32:
- swapper |= RADEON_NONSURF_AP0_SWP_32BPP
- | RADEON_NONSURF_AP1_SWP_32BPP;
- break;
- }
- OUTREG(RADEON_SURFACE_CNTL, swapper);
-#endif
-
- src += (x * bpp / 8) + (y * src_pitch);
- w *= bpp / 8;
-
- while (h--) {
- memcpy(dst, src, w);
- src += src_pitch;
- dst += dst_pitch;
- }
+ return FALSE;
+}
-#if X_BYTE_ORDER == X_BIG_ENDIAN
- /* restore byte swapping */
- OUTREG(RADEON_SURFACE_CNTL, info->ModeReg->surface_cntl);
-#endif
+#endif /* def ACCEL_CP */
- return TRUE;
-}
Bool FUNC_NAME(RADEONDrawInit)(ScreenPtr pScreen)
{
@@ -547,8 +464,11 @@ Bool FUNC_NAME(RADEONDrawInit)(ScreenPtr pScreen)
info->accel_state->exa->MarkSync = FUNC_NAME(RADEONMarkSync);
info->accel_state->exa->WaitMarker = FUNC_NAME(RADEONSync);
- info->accel_state->exa->UploadToScreen = FUNC_NAME(RADEONUploadToScreen);
- info->accel_state->exa->DownloadFromScreen = FUNC_NAME(RADEONDownloadFromScreen);
+#ifdef ACCEL_CP
+ info->accel_state->exa->UploadToScreen = RADEONUploadToScreenCP;
+ if (info->accelDFS)
+ info->accel_state->exa->DownloadFromScreen = RADEONDownloadFromScreenCP;
+#endif
#if X_BYTE_ORDER == X_BIG_ENDIAN
info->accel_state->exa->PrepareAccess = RADEONPrepareAccess;