summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2009-03-13 17:51:56 -0400
committerAlex Deucher <alexdeucher@gmail.com>2009-03-13 17:58:06 -0400
commit1db81afe4f8db55e02a65cd22ad84c6bbb27e8ef (patch)
tree7df77b815947f7fb6b276e50257abb7346ebbc92
parent5bb326c64ad3bf5c93943280dcbcb25c8910d1aa (diff)
radeon: add support for 30 bit LUTs
All radeons have them. Thanks to Yang Zhao for figuring this out.
-rw-r--r--src/radeon_crtc.c12
-rw-r--r--src/radeon_driver.c29
-rw-r--r--src/radeon_macros.h13
-rw-r--r--src/radeon_probe.h2
4 files changed, 26 insertions, 30 deletions
diff --git a/src/radeon_crtc.c b/src/radeon_crtc.c
index e360d4e..cd0d55e 100644
--- a/src/radeon_crtc.c
+++ b/src/radeon_crtc.c
@@ -339,20 +339,20 @@ radeon_crtc_gamma_set(xf86CrtcPtr crtc, uint16_t *red, uint16_t *green,
for (i = 0; i < 64; i++) {
if (i <= 31) {
for (j = 0; j < 8; j++) {
- radeon_crtc->lut_r[i * 8 + j] = red[i] >> 8;
- radeon_crtc->lut_b[i * 8 + j] = blue[i] >> 8;
+ radeon_crtc->lut_r[i * 8 + j] = red[i] >> 6;
+ radeon_crtc->lut_b[i * 8 + j] = blue[i] >> 6;
}
}
for (j = 0; j < 4; j++) {
- radeon_crtc->lut_g[i * 4 + j] = green[i] >> 8;
+ radeon_crtc->lut_g[i * 4 + j] = green[i] >> 6;
}
}
} 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->lut_r[i] = red[i] >> 6;
+ radeon_crtc->lut_g[i] = green[i] >> 6;
+ radeon_crtc->lut_b[i] = blue[i] >> 6;
}
}
diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index 2e4967f..d1b2f54 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -3122,9 +3122,9 @@ static void RADEONLoadPalette(ScrnInfoPtr pScrn, int numColors,
RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private;
for (i = 0 ; i < 256; i++) {
- lut_r[i] = radeon_crtc->lut_r[i] << 8;
- lut_g[i] = radeon_crtc->lut_g[i] << 8;
- lut_b[i] = radeon_crtc->lut_b[i] << 8;
+ lut_r[i] = radeon_crtc->lut_r[i] << 6;
+ lut_g[i] = radeon_crtc->lut_g[i] << 6;
+ lut_b[i] = radeon_crtc->lut_b[i] << 6;
}
switch (info->CurrentLayout.depth) {
@@ -3132,9 +3132,9 @@ static void RADEONLoadPalette(ScrnInfoPtr pScrn, int numColors,
for (i = 0; i < numColors; i++) {
index = indices[i];
for (j = 0; j < 8; j++) {
- lut_r[index * 8 + j] = colors[index].red << 8;
- lut_g[index * 8 + j] = colors[index].green << 8;
- lut_b[index * 8 + j] = colors[index].blue << 8;
+ lut_r[index * 8 + j] = colors[index].red << 6;
+ lut_g[index * 8 + j] = colors[index].green << 6;
+ lut_b[index * 8 + j] = colors[index].blue << 6;
}
}
case 16:
@@ -3143,21 +3143,21 @@ static void RADEONLoadPalette(ScrnInfoPtr pScrn, int numColors,
if (i <= 31) {
for (j = 0; j < 8; j++) {
- lut_r[index * 8 + j] = colors[index].red << 8;
- lut_b[index * 8 + j] = colors[index].blue << 8;
+ lut_r[index * 8 + j] = colors[index].red << 6;
+ lut_b[index * 8 + j] = colors[index].blue << 6;
}
}
-
+
for (j = 0; j < 4; j++) {
- lut_g[index * 4 + j] = colors[index].green << 8;
+ lut_g[index * 4 + j] = colors[index].green << 6;
}
}
default:
for (i = 0; i < numColors; i++) {
index = indices[i];
- lut_r[index] = colors[index].red << 8;
- lut_g[index] = colors[index].green << 8;
- lut_b[index] = colors[index].blue << 8;
+ lut_r[index] = colors[index].red << 6;
+ lut_g[index] = colors[index].green << 6;
+ lut_b[index] = colors[index].blue << 6;
}
break;
}
@@ -3749,7 +3749,8 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen,
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
"Initializing color map\n");
if (!miCreateDefColormap(pScreen)) return FALSE;
- if (!xf86HandleColormaps(pScreen, 256, info->dac6bits ? 6 : 8,
+ /* all radeons support 10 bit CLUTs */
+ if (!xf86HandleColormaps(pScreen, 256, 10,
RADEONLoadPalette, NULL,
CMAP_PALETTED_TRUECOLOR
#if 0 /* This option messes up text mode! (eich@suse.de) */
diff --git a/src/radeon_macros.h b/src/radeon_macros.h
index f19bc3e..387e5f5 100644
--- a/src/radeon_macros.h
+++ b/src/radeon_macros.h
@@ -102,17 +102,12 @@ do { \
#define OUTPAL_NEXT(r, g, b) \
do { \
if (IS_AVIVO_VARIANT) { \
- OUTREG(AVIVO_DC_LUT_30_COLOR, ((r) << 22) | ((g) << 12) | ((b) << 2)); \
- } else { \
- OUTREG(RADEON_PALETTE_DATA, ((r) << 16) | ((g) << 8) | (b)); \
+ OUTREG(AVIVO_DC_LUT_30_COLOR, ((r) << 20) | ((g) << 10) | (b)); \
+ } else { \
+ OUTREG(RADEON_PALETTE_30_DATA, ((r) << 20) | ((g) << 10) | (b)); \
} \
} while (0)
-#define OUTPAL_NEXT_uint32_t(v) \
-do { \
- OUTREG(RADEON_PALETTE_DATA, (v & 0x00ffffff)); \
-} while (0)
-
#define OUTPAL(idx, r, g, b) \
do { \
OUTPAL_START((idx)); \
@@ -133,7 +128,7 @@ do { \
if (IS_AVIVO_VARIANT) { \
INREG(AVIVO_DC_LUT_30_COLOR); \
} else { \
- INREG(RADEON_PALETTE_DATA); \
+ INREG(RADEON_PALETTE_30_DATA); \
} \
} while (0)
diff --git a/src/radeon_probe.h b/src/radeon_probe.h
index afc8e21..a0c6b2c 100644
--- a/src/radeon_probe.h
+++ b/src/radeon_probe.h
@@ -153,7 +153,7 @@ typedef struct _RADEONCrtcPrivateRec {
int binding;
uint32_t cursor_offset;
/* Lookup table values to be set when the CRTC is enabled */
- uint8_t lut_r[256], lut_g[256], lut_b[256];
+ uint16_t lut_r[256], lut_g[256], lut_b[256];
uint32_t crtc_offset;
int can_tile;