diff options
author | Alan Hourihane <alanh@fairlite.demon.co.uk> | 2005-09-06 10:31:33 +0000 |
---|---|---|
committer | Alan Hourihane <alanh@fairlite.demon.co.uk> | 2005-09-06 10:31:33 +0000 |
commit | e8c46c897564f038744b9274949482568d654ecc (patch) | |
tree | aa26a79475c2bf4de622adfddc910e2a6b37acfa | |
parent | bf6fef41935ebf624cc1ae6faa084dfa0a7eee72 (diff) |
Fix DirectColor visual colormap issues at 16bpp in the i830 driver.
-rw-r--r-- | src/i830_driver.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/i830_driver.c b/src/i830_driver.c index f4d5f229..b4abf6bc 100644 --- a/src/i830_driver.c +++ b/src/i830_driver.c @@ -1736,7 +1736,11 @@ I830LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, dspbase = DSPBBASE; } - OUTREG(dspreg, INREG(dspreg) | DISPPLANE_GAMMA_ENABLE); + /* To ensure gamma is enabled we need to turn off and on the plane */ + temp = INREG(dspreg); + OUTREG(dspreg, temp & ~(1<<31)); + OUTREG(dspbase, INREG(dspbase)); + OUTREG(dspreg, temp | DISPPLANE_GAMMA_ENABLE); OUTREG(dspbase, INREG(dspbase)); /* It seems that an initial read is needed. */ @@ -1749,19 +1753,18 @@ I830LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, r = colors[index].red; g = colors[index].green; b = colors[index].blue; + val = (r << 16) | (g << 8) | b; for (j = 0; j < 8; j++) { - val = (r << 16) | (g << 8) | b; OUTREG(palreg + index * 32 + (j * 4), val); } } break; case 16: for (i = 0; i < numColors; i++) { - index = indices[i / 2]; - r = colors[index].red; - b = colors[index].blue; index = indices[i]; - g = colors[index].green; + r = colors[index / 2].red; + g = colors[index].green; + b = colors[index / 2].blue; val = (r << 16) | (g << 8) | b; OUTREG(palreg + index * 16, val); @@ -1769,15 +1772,17 @@ I830LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, OUTREG(palreg + index * 16 + 8, val); OUTREG(palreg + index * 16 + 12, val); - i++; - index = indices[i]; - g = colors[index].green; + if (index <= 31) { + r = colors[index].red; + g = colors[(index * 2) + 1].green; + b = colors[index].blue; - val = (r << 16) | (g << 8) | b; - OUTREG(palreg + index * 16, val); - OUTREG(palreg + index * 16 + 4, val); - OUTREG(palreg + index * 16 + 8, val); - OUTREG(palreg + index * 16 + 12, val); + val = (r << 16) | (g << 8) | b; + OUTREG(palreg + index * 32, val); + OUTREG(palreg + index * 32 + 4, val); + OUTREG(palreg + index * 32 + 8, val); + OUTREG(palreg + index * 32 + 12, val); + } } break; default: |