summaryrefslogtreecommitdiff
path: root/src/radeon_render.c
diff options
context:
space:
mode:
authorMichel Daenzer <michel@daenzer.net>2004-08-04 13:17:31 +0000
committerMichel Daenzer <michel@daenzer.net>2004-08-04 13:17:31 +0000
commit27ef7adf3c1f6c3ca79b42b468d08b8542348cdd (patch)
tree07d1fadd8e56bc49416ca6f83fc4b781c2e3cae3 /src/radeon_render.c
parent2efdc9f847fa9ff3096667b16df84817fc65605d (diff)
Use info->ModeReg.surface_cntl to restore byte swapping for the framebuffer
aperture on big endian machines, remove superfluous local variables and register reads. Adapt framebuffer aperture byte swapping to texture format before copying data to offscreen area and restore it afterwards on big endian machines, fixes Render acceleration there. reviewed by: Hui Yu <hyu@ati.com>, Kevin E. Martin <kem@freedesktop.org>
Diffstat (limited to 'src/radeon_render.c')
-rw-r--r--src/radeon_render.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/radeon_render.c b/src/radeon_render.c
index 7eb293d..8b4f5da 100644
--- a/src/radeon_render.c
+++ b/src/radeon_render.c
@@ -368,6 +368,9 @@ static Bool FUNC_NAME(R100SetupTexture)(
CARD8 *dst;
CARD32 tex_size = 0, txformat;
int dst_pitch, offset, size, i, tex_bytepp;
+#if X_BYTE_ORDER == X_BIG_ENDIAN && defined(ACCEL_CP)
+ unsigned char *RADEONMMIO = info->MMIO;
+#endif
ACCEL_PREAMBLE();
if ((width > 2048) || (height > 2048))
@@ -376,6 +379,31 @@ static Bool FUNC_NAME(R100SetupTexture)(
txformat = RadeonGetTextureFormat(format);
tex_bytepp = PICT_FORMAT_BPP(format) >> 3;
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ /* Set up byte swapping for the framebuffer aperture as needed */
+ switch (tex_bytepp) {
+ case 1:
+ OUTREG(RADEON_SURFACE_CNTL, info->ModeReg.surface_cntl &
+ ~(RADEON_NONSURF_AP0_SWP_32BPP
+ | RADEON_NONSURF_AP0_SWP_16BPP));
+ break;
+ case 2:
+ OUTREG(RADEON_SURFACE_CNTL, (info->ModeReg.surface_cntl &
+ ~RADEON_NONSURF_AP0_SWP_32BPP)
+ | RADEON_NONSURF_AP0_SWP_16BPP);
+ break;
+ case 4:
+ OUTREG(RADEON_SURFACE_CNTL, info->ModeReg.surface_cntl
+ | RADEON_NONSURF_AP0_SWP_32BPP
+ | RADEON_NONSURF_AP0_SWP_16BPP);
+ break;
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "%s: Don't know what to do for "
+ "tex_bytepp == %d!\n", __func__, tex_bytepp);
+ return FALSE;
+ }
+#endif
+
dst_pitch = (width * tex_bytepp + 31) & ~31;
size = dst_pitch * height;
@@ -403,6 +431,11 @@ static Bool FUNC_NAME(R100SetupTexture)(
dst += dst_pitch;
}
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ /* restore byte swapping */
+ OUTREG(RADEON_SURFACE_CNTL, info->ModeReg.surface_cntl);
+#endif
+
BEGIN_ACCEL(5);
OUT_ACCEL_REG(RADEON_PP_TXFORMAT_0, txformat);
OUT_ACCEL_REG(RADEON_PP_TEX_SIZE_0, tex_size);
@@ -639,6 +672,9 @@ static Bool FUNC_NAME(R200SetupTexture)(
CARD8 *dst;
CARD32 tex_size = 0, txformat;
int dst_pitch, offset, size, i, tex_bytepp;
+#if X_BYTE_ORDER == X_BIG_ENDIAN && defined(ACCEL_CP)
+ unsigned char *RADEONMMIO = info->MMIO;
+#endif
ACCEL_PREAMBLE();
if ((width > 2048) || (height > 2048))
@@ -647,6 +683,31 @@ static Bool FUNC_NAME(R200SetupTexture)(
txformat = RadeonGetTextureFormat(format);
tex_bytepp = PICT_FORMAT_BPP(format) >> 3;
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ /* Set up byte swapping for the framebuffer aperture as needed */
+ switch (tex_bytepp) {
+ case 1:
+ OUTREG(RADEON_SURFACE_CNTL, info->ModeReg.surface_cntl &
+ ~(RADEON_NONSURF_AP0_SWP_32BPP
+ | RADEON_NONSURF_AP0_SWP_16BPP));
+ break;
+ case 2:
+ OUTREG(RADEON_SURFACE_CNTL, (info->ModeReg.surface_cntl &
+ ~RADEON_NONSURF_AP0_SWP_32BPP)
+ | RADEON_NONSURF_AP0_SWP_16BPP);
+ break;
+ case 4:
+ OUTREG(RADEON_SURFACE_CNTL, info->ModeReg.surface_cntl
+ | RADEON_NONSURF_AP0_SWP_32BPP
+ | RADEON_NONSURF_AP0_SWP_16BPP);
+ break;
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "%s: Don't know what to do for "
+ "tex_bytepp == %d!\n", __func__, tex_bytepp);
+ return FALSE;
+ }
+#endif
+
dst_pitch = (width * tex_bytepp + 31) & ~31;
size = dst_pitch * height;
@@ -674,6 +735,11 @@ static Bool FUNC_NAME(R200SetupTexture)(
dst += dst_pitch;
}
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ /* restore byte swapping */
+ OUTREG(RADEON_SURFACE_CNTL, info->ModeReg.surface_cntl);
+#endif
+
BEGIN_ACCEL(6);
OUT_ACCEL_REG(R200_PP_TXFORMAT_0, txformat);
OUT_ACCEL_REG(R200_PP_TXFORMAT_X_0, 0);