Francisco Jerez
2009-Oct-18 17:48 UTC
[Nouveau] [PATCH 1/2] nv04-nv40/crtc: Don't perform the LUT expansion twice.
Fixes bug 24595. Signed-off-by: Francisco Jerez <currojerez at riseup.net> --- src/nv_crtc.c | 34 ++++------------------------------ 1 files changed, 4 insertions(+), 30 deletions(-) diff --git a/src/nv_crtc.c b/src/nv_crtc.c index 2ae36a0..9708741 100644 --- a/src/nv_crtc.c +++ b/src/nv_crtc.c @@ -888,8 +888,6 @@ static void nv_crtc_unlock(xf86CrtcPtr crtc) { } -#define DEPTH_SHIFT(val, w) ((val << (8 - w)) | (val >> ((w << 1) - 8))) - static void nv_crtc_gamma_set(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue, int size) @@ -901,34 +899,10 @@ nv_crtc_gamma_set(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue, rgbs = (struct rgb *)nv_crtc->state->DAC; - switch (crtc->scrn->depth) { - case 15: - /* R5G5B5 */ - /* spread 5 bits per colour (32 colours) over 256 (per colour) registers */ - for (i = 0; i < 32; i++) { - rgbs[DEPTH_SHIFT(i, 5)].r = red[i] >> 8; - rgbs[DEPTH_SHIFT(i, 5)].g = green[i] >> 8; - rgbs[DEPTH_SHIFT(i, 5)].b = blue[i] >> 8; - } - break; - case 16: - /* R5G6B5 */ - for (i = 0; i < 64; i++) { - /* set 64 regs for green's 6 bits of colour */ - rgbs[DEPTH_SHIFT(i, 6)].g = green[i] >> 8; - if (i < 32) { - rgbs[DEPTH_SHIFT(i, 5)].r = red[i] >> 8; - rgbs[DEPTH_SHIFT(i, 5)].b = blue[i] >> 8; - } - } - break; - default: - /* R8G8B8 */ - for (i = 0; i < 256; i++) { - rgbs[i].r = red[i] >> 8; - rgbs[i].g = green[i] >> 8; - rgbs[i].b = blue[i] >> 8; - } + for (i = 0; i < 256; i++) { + rgbs[i].r = red[i] >> 8; + rgbs[i].g = green[i] >> 8; + rgbs[i].b = blue[i] >> 8; } nouveau_hw_load_state_palette(pNv, nv_crtc->head, &pNv->set_state); -- 1.6.4.4
Francisco Jerez
2009-Oct-18 17:48 UTC
[Nouveau] [PATCH 2/2] nv50/crtc: Don't perform the LUT expansion twice.
Signed-off-by: Francisco Jerez <currojerez at riseup.net> --- src/nv50_crtc.c | 40 ++++++---------------------------------- 1 files changed, 6 insertions(+), 34 deletions(-) diff --git a/src/nv50_crtc.c b/src/nv50_crtc.c index 73f6239..aa85cee 100644 --- a/src/nv50_crtc.c +++ b/src/nv50_crtc.c @@ -455,46 +455,18 @@ NV50CrtcLoadCursor(nouveauCrtcPtr crtc, Bool argb, uint32_t *src) * The indices are a bit strange, but i'll assume it's correct (taken from nv). * The LUT resolution seems to be 14 bits on NV50 as opposed to the 8 bits of previous hardware. */ -#define NV50_LUT_INDEX(val, w) ((val << (8 - w)) | (val >> ((w << 1) - 8))) static void NV50CrtcGammaSet(nouveauCrtcPtr crtc, uint16_t *red, uint16_t *green, uint16_t *blue, int size) { ScrnInfoPtr pScrn = crtc->scrn; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "NV50CrtcGammaSet is called for %s.\n", crtc->index ? "CRTC1" : "CRTC0"); - uint32_t index, i; + uint32_t i; - switch (pScrn->depth) { - case 15: - /* R5G5B5 */ - for (i = 0; i < 32; i++) { - index = NV50_LUT_INDEX(i, 5); - crtc->lut_values[index].red = red[i] >> 2; - crtc->lut_values[index].green = green[i] >> 2; - crtc->lut_values[index].blue = blue[i] >> 2; - } - break; - case 16: - /* R5G6B5 */ - for (i = 0; i < 32; i++) { - index = NV50_LUT_INDEX(i, 5); - crtc->lut_values[index].red = red[i] >> 2; - crtc->lut_values[index].blue = blue[i] >> 2; - } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "NV50CrtcGammaSet is called for %s.\n", crtc->index ? "CRTC1" : "CRTC0"); - /* Green has an extra bit. */ - for (i = 0; i < 64; i++) { - index = NV50_LUT_INDEX(i, 6); - crtc->lut_values[index].green = green[i] >> 2; - } - break; - default: - /* R8G8B8 */ - for (i = 0; i < 256; i++) { - crtc->lut_values[i].red = red[i] >> 2; - crtc->lut_values[i].green = green[i] >> 2; - crtc->lut_values[i].blue = blue[i] >> 2; - } - break; + for (i = 0; i < 256; i++) { + crtc->lut_values[i].red = red[i] >> 2; + crtc->lut_values[i].green = green[i] >> 2; + crtc->lut_values[i].blue = blue[i] >> 2; } crtc->lut_values_valid = true; -- 1.6.4.4
Possibly Parallel Threads
- [Bug 18286] New: GeForce 8300 not supported (10de:0848/C77/MCP77)
- [PATCH 08/11] drm: nouveau: remove dead code and pointless local lut storage
- [PATCH v4 11/14] drm: nouveau: remove dead code and pointless local lut storage
- [PATCH v3 13/16] drm: nouveau: remove dead code and pointless local lut storage
- [PATCH v5 11/14] drm: nouveau: remove dead code and pointless local lut storage