diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/i830_cursor.c | 7 | ||||
-rw-r--r-- | src/i830_driver.c | 73 |
2 files changed, 77 insertions, 3 deletions
diff --git a/src/i830_cursor.c b/src/i830_cursor.c index 1d7808b6..1657f7c4 100644 --- a/src/i830_cursor.c +++ b/src/i830_cursor.c @@ -116,9 +116,10 @@ I830InitHWCursor(ScrnInfoPtr pScrn) temp = INREG(CURSOR_CONTROL); temp &= ~(CURSOR_FORMAT_MASK | CURSOR_GAMMA_ENABLE | CURSOR_ENABLE | CURSOR_STRIDE_MASK); - temp |= (CURSOR_FORMAT_3C); if (pI830->CursorIsARGB) - temp |= CURSOR_GAMMA_ENABLE; + temp |= CURSOR_FORMAT_ARGB | CURSOR_GAMMA_ENABLE; + else + temp |= CURSOR_FORMAT_3C; /* This initialises the format and leave the cursor disabled. */ OUTREG(CURSOR_CONTROL, temp); /* Need to set address and size after disabling. */ @@ -588,7 +589,7 @@ I830ShowCursor(ScrnInfoPtr pScrn) temp = INREG(CURSOR_A_CONTROL); temp &= ~(CURSOR_MODE | MCURSOR_PIPE_SELECT | MCURSOR_GAMMA_ENABLE); if (pI830->CursorIsARGB) - temp |= CURSOR_MODE_64_ARGB_AX; + temp |= CURSOR_MODE_64_ARGB_AX | MCURSOR_GAMMA_ENABLE; else temp |= CURSOR_MODE_64_4C_AX; temp |= (pI830->pipe << 28); /* Connect to correct pipe */ 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; |