XVideo modes YUY2 and UYVY incorrectly byteswapped on r128 PowerPC
The r128 driver correctly byte-swaps I420 XVideo data when copying
to the board, but does not for YUY2 and UYVY. This gives cool
green-pink images, as can be seen by using the xv test program
xvtest.tar.gz at http://www.xfree86.org/~mvojkovi/.
Following is a patch to fix it, copying the code from I420 a few
lines prior.
dave...
Binärdateien xc.orig/programs/Xserver/hw/xfree86/drivers/ati/.r128_video.c.swp and xc/programs/Xserver/hw/xfree86/drivers/ati/.r128_video.c.swp sind verschieden.
diff -urN xc.orig/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c
--- xc.orig/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c 2002-09-26 22:22:41.000000000 -0700
+++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c 2002-09-26 22:46:26.000000000 -0700
@@ -1014,8 +1014,23 @@
d3offset = 0;
s1offset += (top * srcPitch) + left;
nlines = ((yb + 0xffff) >> 16) - top;
+ {
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ unsigned char *R128MMIO = info->MMIO;
+ CARD32 config_cntl;
+
+ /* We need to disable byte swapping, or the data gets mangled */
+ config_cntl = INREG(R128_CONFIG_CNTL);
+ OUTREG(R128_CONFIG_CNTL, config_cntl &
+ ~(APER_0_BIG_ENDIAN_16BPP_SWAP|APER_0_BIG_ENDIAN_32BPP_SWAP));
+#endif
R128CopyData422(info, buf + s1offset, info->FB + d1offset,
srcPitch, dstPitch, nlines, npixels);
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ /* restore byte swapping */
+ OUTREG(R128_CONFIG_CNTL, config_cntl);
+#endif
+ }
break;
}
Reply to: