diff options
author | Alan Hourihane <alanh@fairlite.demon.co.uk> | 2006-08-08 10:23:29 +0100 |
---|---|---|
committer | Alan Hourihane <alanh@fairlite.demon.co.uk> | 2006-08-08 10:23:29 +0100 |
commit | 633a683a4adcb9a44a54519fd7ff66aab2d12f97 (patch) | |
tree | 3a2804af9aa600a8c8b4db8f6398338c378504bc /src/i830_driver.c | |
parent | e71108f1e05b7a8d8edd174eb64edd6cccacbcdc (diff) |
Ensure palette is updated in mergedfb & clone modes
Diffstat (limited to 'src/i830_driver.c')
-rw-r--r-- | src/i830_driver.c | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/i830_driver.c b/src/i830_driver.c index 256ae22e..84fb21a9 100644 --- a/src/i830_driver.c +++ b/src/i830_driver.c @@ -3486,6 +3486,79 @@ I830LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, DPRINTF(PFX, "I830LoadPalette: numColors: %d\n", numColors); pI830 = I830PTR(pScrn); + if (pI830->Clone || pI830->MergedFB) { + if (!pI830->pipe == 0) { + palreg = PALETTE_A; + dspreg = DSPACNTR; + dspbase = DSPABASE; + } else { + palreg = PALETTE_B; + dspreg = DSPBCNTR; + dspbase = DSPBBASE; + } + + /* 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. */ + temp = INREG(palreg); + + switch(pScrn->depth) { + case 15: + for (i = 0; i < numColors; i++) { + index = indices[i]; + r = colors[index].red; + g = colors[index].green; + b = colors[index].blue; + val = (r << 16) | (g << 8) | b; + for (j = 0; j < 8; j++) { + OUTREG(palreg + index * 32 + (j * 4), val); + } + } + break; + case 16: + for (i = 0; i < numColors; i++) { + index = indices[i]; + 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); + OUTREG(palreg + index * 16 + 4, val); + OUTREG(palreg + index * 16 + 8, val); + OUTREG(palreg + index * 16 + 12, val); + + 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 * 32, val); + OUTREG(palreg + index * 32 + 4, val); + OUTREG(palreg + index * 32 + 8, val); + OUTREG(palreg + index * 32 + 12, val); + } + } + break; + default: + for(i = 0; i < numColors; i++) { + index = indices[i]; + r = colors[index].red; + g = colors[index].green; + b = colors[index].blue; + val = (r << 16) | (g << 8) | b; + OUTREG(palreg + index * 4, val); + } + break; + } + } + if (pI830->pipe == 0) { palreg = PALETTE_A; dspreg = DSPACNTR; |