On Wed, Mar 20, 2002 at 11:04:47AM -0800, Ani Joshi wrote:
> 
> 
> On Wed, 20 Mar 2002, Guido Guenther wrote:
> 
> > I'm seeing another endianess bug with Xv. At least in 16bpp red and
> > blue seem to be swapped. I noticed that the r128 has some endianess
> > fixes in R128PutImage. The Radeon driver will need these too, I guess.
> > What is the Radeon equivalent to APER_0_BIG_ENDIAN_16BPP_SWAP?
> 
> 
> You can turn off framebuffer swapping by clearing the SURFACE_CNTL bits,
> or you can swap the data in CopyData().  Ofcourse, the first one being
> quicker.
Cool, thanks. That was exactly what I was looking for. Video looks
correct now in 16 and 24bpp. Patch attached and bcc'ed to
[EMAIL PROTECTED]
 -- Guido
--- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c.orig      Wed Mar 20 
21:14:04 2002
+++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c   Wed Mar 20 21:17:12 
+2002
@@ -761,9 +761,24 @@
           s3offset = tmp;
        }
        nlines = ((((yb + 0xffff) >> 16) + 1) & ~1) - top;
+       {
+
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+       unsigned char *RADEONMMIO = info->MMIO;
+       CARD32 surface_cntl;
+
+       surface_cntl = INREG(RADEON_SURFACE_CNTL);
+       OUTREG(RADEON_SURFACE_CNTL, (surface_cntl | 
+               RADEON_NONSURF_AP0_SWP_32BPP) & ~RADEON_NONSURF_AP0_SWP_16BPP);
+#endif
        RADEONCopyMungedData(buf + (top * srcPitch) + left, buf + s2offset,
                           buf + s3offset, dst_start, srcPitch, srcPitch2,
                           dstPitch, nlines, npixels);
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+       /* restore byte swapping */
+       OUTREG(RADEON_SURFACE_CNTL, surface_cntl);
+#endif
+       }
        break;
     case FOURCC_UYVY:
     case FOURCC_YUY2:


Reply via email to