xf86-video-r128: Branch 'master'
Connor Behan
cbehan at kemper.freedesktop.org
Fri Mar 8 01:06:45 PST 2013
src/r128.h | 1 +
src/r128_accel.c | 37 +++++++++++++++++++++++++++++++++++++
src/r128_exa_render.c | 11 +++++++++++
3 files changed, 49 insertions(+)
New commits:
commit aca6aa127f43deeed42c4d3bef8d1e6a735b4c50
Author: Connor Behan <connor.behan at gmail.com>
Date: Fri Mar 8 01:02:22 2013 -0800
Swap pixmap bytes for a solid picture on big endian host
Some PowerPC users were reporting color errors that only happened with
EXA+DRI. This implements a recent bugfix in the Radeon driver which will
solve at least one of these problems.
Signed-off-by: Connor Behan <connor.behan at gmail.com>
diff --git a/src/r128.h b/src/r128.h
index 9c0ecb6..90071b4 100644
--- a/src/r128.h
+++ b/src/r128.h
@@ -602,6 +602,7 @@ extern void R128CCEFlushIndirect(ScrnInfoPtr pScrn, int discard);
extern void R128CCEReleaseIndirect(ScrnInfoPtr pScrn);
extern void R128CCEWaitForIdle(ScrnInfoPtr pScrn);
extern int R128CCEStop(ScrnInfoPtr pScrn);
+extern void R128CopySwap(uint8_t *dst, uint8_t *src, unsigned int size, int swap);
#ifdef USE_EXA
extern Bool R128EXAInit(ScreenPtr pScreen);
diff --git a/src/r128_accel.c b/src/r128_accel.c
index 1b8c023..7ffd15f 100644
--- a/src/r128_accel.c
+++ b/src/r128_accel.c
@@ -1869,6 +1869,43 @@ static void R128MMIOAccelInit(ScrnInfoPtr pScrn, XAAInfoRecPtr a)
}
#endif
+void R128CopySwap(uint8_t *dst, uint8_t *src, unsigned int size, int swap)
+{
+ switch(swap) {
+ case APER_0_BIG_ENDIAN_32BPP_SWAP:
+ {
+ unsigned int *d = (unsigned int *)dst;
+ unsigned int *s = (unsigned int *)src;
+ unsigned int nwords = size >> 2;
+
+ for (; nwords > 0; --nwords, ++d, ++s)
+#ifdef __powerpc__
+ asm volatile("stwbrx %0,0,%1" : : "r" (*s), "r" (d));
+#else
+ *d = ((*s >> 24) & 0xff) | ((*s >> 8) & 0xff00)
+ | ((*s & 0xff00) << 8) | ((*s & 0xff) << 24);
+#endif
+ return;
+ }
+ case APER_0_BIG_ENDIAN_16BPP_SWAP:
+ {
+ unsigned short *d = (unsigned short *)dst;
+ unsigned short *s = (unsigned short *)src;
+ unsigned int nwords = size >> 1;
+
+ for (; nwords > 0; --nwords, ++d, ++s)
+#ifdef __powerpc__
+ asm volatile("sthbrx %0,0,%1" : : "r" (*s), "r" (d));
+#else
+ *d = (*s >> 8) | (*s << 8);
+#endif
+ return;
+ }
+ }
+ if (src != dst)
+ memcpy(dst, src, size);
+}
+
/* Initialize XAA for supported acceleration and also initialize the
graphics hardware for acceleration. */
Bool R128AccelInit(ScreenPtr pScreen)
diff --git a/src/r128_exa_render.c b/src/r128_exa_render.c
index db14bb1..f31bdf3 100644
--- a/src/r128_exa_render.c
+++ b/src/r128_exa_render.c
@@ -102,6 +102,17 @@ R128SolidPixmap(ScreenPtr pScreen, uint32_t solid)
return NULL;
}
info->ExaDriver->WaitMarker(pScreen, 0);
+
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ if (pScrn->bitsPerPixel == 32)
+ R128CopySwap(info->ExaDriver->memoryBase + exaGetPixmapOffset(pPix), (uint8_t*)&solid, 4,
+ APER_0_BIG_ENDIAN_32BPP_SWAP);
+ else if (pScrn->bitsPerPixel == 16)
+ R128CopySwap(info->ExaDriver->memoryBase + exaGetPixmapOffset(pPix), (uint8_t*)&solid, 4,
+ APER_0_BIG_ENDIAN_16BPP_SWAP);
+ else
+ /* Fall through for 8 bpp */
+#endif
memcpy(info->ExaDriver->memoryBase + exaGetPixmapOffset(pPix), &solid, 4);
return pPix;
More information about the xorg-commit
mailing list