diff options
author | Alex Deucher <alex@t41p.hsd1.va.comcast.net> | 2007-07-19 23:48:57 -0400 |
---|---|---|
committer | Alex Deucher <alex@t41p.hsd1.va.comcast.net> | 2007-07-19 23:48:57 -0400 |
commit | 262e32bd9ea4123b116362b33b5798753b2568fe (patch) | |
tree | 0a4fe951ac0f14b32d25ed4b59e4546fc6ebef8c | |
parent | 7b3e22e96cfc98621bd20fa76317e6d8f7242165 (diff) |
RADEON: fix palette when depth != 24
-rw-r--r-- | src/radeon_crtc.c | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/src/radeon_crtc.c b/src/radeon_crtc.c index de060fb..5bd2338 100644 --- a/src/radeon_crtc.c +++ b/src/radeon_crtc.c @@ -872,23 +872,43 @@ void radeon_crtc_load_lut(xf86CrtcPtr crtc) PAL_SELECT(radeon_crtc->crtc_id); - for (i = 0; i < 256; i++) { - OUTPAL(i, radeon_crtc->lut_r[i], radeon_crtc->lut_g[i], radeon_crtc->lut_b[i]); + if (pScrn->depth == 15) { + for (i = 0; i < 32; i++) { + OUTPAL(i * 8, radeon_crtc->lut_r[i], radeon_crtc->lut_g[i], radeon_crtc->lut_b[i]); + } + } else if (pScrn->depth == 16) { + for (i = 0; i < 64; i++) { + OUTPAL(i * 4, radeon_crtc->lut_r[i], radeon_crtc->lut_g[i], radeon_crtc->lut_b[i]); + } + } else { + for (i = 0; i < 256; i++) { + OUTPAL(i, radeon_crtc->lut_r[i], radeon_crtc->lut_g[i], radeon_crtc->lut_b[i]); + } } + } static void -radeon_crtc_gamma_set(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, +radeon_crtc_gamma_set(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue, int size) { RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private; + ScrnInfoPtr pScrn = crtc->scrn; int i; - for (i = 0; i < 256; i++) { - radeon_crtc->lut_r[i] = red[i] >> 8; - radeon_crtc->lut_g[i] = green[i] >> 8; - radeon_crtc->lut_b[i] = blue[i] >> 8; + if (pScrn->depth == 16) { + for (i = 0; i < 64; i++) { + radeon_crtc->lut_r[i] = red[i/2] >> 8; + radeon_crtc->lut_g[i] = green[i] >> 8; + radeon_crtc->lut_b[i] = blue[i/2] >> 8; + } + } else { + for (i = 0; i < 256; i++) { + radeon_crtc->lut_r[i] = red[i] >> 8; + radeon_crtc->lut_g[i] = green[i] >> 8; + radeon_crtc->lut_b[i] = blue[i] >> 8; + } } radeon_crtc_load_lut(crtc); |