Enable byte swapping for r600 Hardware

Michel Dänzer michel at daenzer.net
Fri Apr 3 01:13:18 PDT 2009


On Thu, 2009-04-02 at 17:17 +0200, Eduard Fuchs wrote:
> 
> --- origin/src/atombios_crtc.c  2009-04-02 16:56:15.000000000 +0200
> +++ xf86-video-ati/src/atombios_crtc.c  2009-04-02 16:43:59.000000000 +0200
> @@ -450,17 +450,21 @@
> 
>      if (IS_AVIVO_VARIANT) {
>         uint32_t fb_format;
> +       uint32_t fb_swap = AVIVO_D1GRPH_SWAP_ENDIAN_NONE;
> 
>         switch (crtc->scrn->bitsPerPixel) {
>         case 15:
>             fb_format = AVIVO_D1GRPH_CONTROL_DEPTH_16BPP | 
> AVIVO_D1GRPH_CONTROL_16BPP_ARGB1555;
> +               fb_swap = AVIVO_D1GRPH_SWAP_ENDIAN_NONE;
>             break;
>         case 16:
>             fb_format = AVIVO_D1GRPH_CONTROL_DEPTH_16BPP | 
> AVIVO_D1GRPH_CONTROL_16BPP_RGB565;
> +               fb_swap = AVIVO_D1GRPH_SWAP_ENDIAN_NONE;
>             break;
>         case 24:
>         case 32:
>             fb_format = AVIVO_D1GRPH_CONTROL_DEPTH_32BPP | 
> AVIVO_D1GRPH_CONTROL_32BPP_ARGB8888;
> +               fb_swap = AVIVO_D1GRPH_SWAP_ENDIAN_32BIT;
>             break;
>         default:
>             FatalError("Unsupported screen depth: %d\n", xf86GetDepth());
> @@ -488,6 +492,10 @@
>         OUTREG(AVIVO_D1GRPH_SECONDARY_SURFACE_ADDRESS + radeon_crtc-
> >crtc_offset, fb_location);
>         OUTREG(AVIVO_D1GRPH_CONTROL + radeon_crtc->crtc_offset, fb_format);
> 
> +#if X_BYTE_ORDER == X_BIG_ENDIAN
> +       OUTREG(AVIVO_D1GRPH_SWAP_CONTROL + radeon_crtc->crtc_offset, fb_swap);
> +#endif
> +
>         OUTREG(AVIVO_D1GRPH_SURFACE_OFFSET_X + radeon_crtc->crtc_offset, 0);
>         OUTREG(AVIVO_D1GRPH_SURFACE_OFFSET_Y + radeon_crtc->crtc_offset, 0);
>         OUTREG(AVIVO_D1GRPH_X_START + radeon_crtc->crtc_offset, 0);

Not sure this is a good approach... Our approach for older GPUs has been
to make sure data is always stored little endian in video RAM, so we
only need to care about endianness when moving data to/from video RAM. I
suspect this change breaks R5xx cards on big endian.


P.S. Of course our approach so far probably won't work for buffer
objects in GART memory with kernel memory management, but that's another
story...

-- 
Earthling Michel Dänzer           |                http://www.vmware.com
Libre software enthusiast         |          Debian, X and DRI developer


More information about the xorg-driver-ati mailing list