Bug 29701

Summary: incorrect colors and gamma with 16-bit color depth
Product: xorg Reporter: Boyan <btanastasov>
Component: Driver/RadeonAssignee: xf86-video-ati maintainers <xorg-driver-ati>
Status: RESOLVED DUPLICATE QA Contact: Xorg Project Team <xorg-team>
Severity: major    
Priority: medium    
Version: unspecified   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Boyan 2010-08-20 06:34:58 UTC
With radeon driver 6.13.0 and probably older versions in fedora 12 and 13 when color depth in xorg.conf is set to 16-bit the picture looks rather green with less contrast. The picture is ok with 15 or 24 bit, but not with 16 bit.
(This is without KMS. With KMS colors looks ok, but the system is not stable with random segmentation faults of X.)

How to reproduce:
Edit /etc/X11/xorg.conf and add in Screen section:

Section "Screen"
        ...
        ...
        DefaultDepth 16
        ...
        ...


        Subsection "Display"
                Depth 24
                Modes "..." "..." "..."
        EndSubSection
EndSection

I think I've found the problem for wrong gamma. It seems that there is different logic for 16 bit and everything else in src/radeon_crtc.c, and if commented the colors looks ok.

{
    RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private;
    ScrnInfoPtr         pScrn = crtc->scrn;
    int i, j;

    if (0/*pScrn->depth == 16*/) {
        for (i = 0; i < 64; i++) {
            if (i <= 31) {
                for (j = 0; j < 8; j++) {
                    radeon_crtc->lut_r[i * 8 + j] = red[i] >> 6;
                    radeon_crtc->lut_b[i * 8 + j] = blue[i] >> 6;
                }
            }

            for (j = 0; j < 4; j++) {
                radeon_crtc->lut_g[i * 4 + j] = green[i] >> 6;
            }
        }
    } else {
        for (i = 0; i < 256; i++) {
            radeon_crtc->lut_r[i] = red[i] >> 6;
            radeon_crtc->lut_g[i] = green[i] >> 6;
            radeon_crtc->lut_b[i] = blue[i] >> 6;
        }
    }

    radeon_crtc_load_lut(crtc);
}

The other problem which it seems for me is related to the gamma is that opengl programs for example glxgears are with wrong colors too on my HD4200 card and is not fixed with disabling the "if" part.
The colors are wrong on 3 different hardwares, so I think it is not ati model related:
- ATI 9550
- ATI X1300
- ATI HD4200


I've reported this problem in fedora bugzilla but nothing happened for 7 months.
https://bugzilla.redhat.com/show_bug.cgi?id=554967

There are attachments with Xorg.log with 16 and 24 bit depths if needed.
Comment 1 Alex Deucher 2010-08-20 07:31:33 UTC

*** This bug has been marked as a duplicate of bug 28494 ***

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.