summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2008-12-17 03:17:45 -0500
committerAlex Deucher <alexdeucher@gmail.com>2008-12-17 03:17:45 -0500
commitf21e673aced1bb5138bbb80e6d9724530eb95ebf (patch)
tree6268d6aa0c20a710348f9834c9793060df2a9330
parentbe12cf8fcc7a5a3c3ee2c630474e2f9d9368f4d4 (diff)
Fix colors on tv-out
Call EnableYUV to set the transform and enable/disable it. should also fix green tint with tv connected at boot issues.
-rw-r--r--src/atombios_output.c51
-rw-r--r--src/radeon_reg.h2
2 files changed, 52 insertions, 1 deletions
diff --git a/src/atombios_output.c b/src/atombios_output.c
index 0fd47457..6603b102 100644
--- a/src/atombios_output.c
+++ b/src/atombios_output.c
@@ -603,7 +603,7 @@ atombios_output_dig_transmitter_setup(xf86OutputPtr output, int device, DisplayM
}
-void atom_rv515_force_tv_scaler(ScrnInfoPtr pScrn)
+static void atom_rv515_force_tv_scaler(ScrnInfoPtr pScrn)
{
RADEONInfoPtr info = RADEONPTR(pScrn);
unsigned char *RADEONMMIO = info->MMIO;
@@ -833,6 +833,49 @@ void atom_rv515_force_tv_scaler(ScrnInfoPtr pScrn)
OUTREG(0x657C,0xBF008900);
}
+static void atom_enable_yuv_transform(xf86OutputPtr output, Bool enable)
+{
+ RADEONCrtcPrivatePtr radeon_crtc = output->crtc->driver_private;
+ RADEONInfoPtr info = RADEONPTR(output->scrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ if (enable)
+ OUTREG(AVIVO_D1GRPH_COLOR_MATRIX_TRANSFORMATION_CNTL + radeon_crtc->crtc_offset, 0x1);
+ else
+ OUTREG(AVIVO_D1GRPH_COLOR_MATRIX_TRANSFORMATION_CNTL + radeon_crtc->crtc_offset, 0x0);
+}
+
+static int
+atombios_output_yuv_setup(xf86OutputPtr output, Bool enable)
+{
+ RADEONInfoPtr info = RADEONPTR(output->scrn);
+ RADEONCrtcPrivatePtr radeon_crtc = output->crtc->driver_private;
+ ENABLE_YUV_PS_ALLOCATION disp_data;
+ AtomBiosArgRec data;
+ unsigned char *space;
+
+ memset(&disp_data, 0, sizeof(disp_data));
+
+ if (enable)
+ disp_data.ucEnable = ATOM_ENABLE;
+ disp_data.ucCRTC = radeon_crtc->crtc_id;
+
+ data.exec.index = GetIndexIntoMasterTable(COMMAND, EnableYUV);
+ data.exec.dataSpace = (void *)&space;
+ data.exec.pspace = &disp_data;
+
+ if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
+
+ atom_enable_yuv_transform(output, enable);
+
+ ErrorF("YUV %d setup success\n", radeon_crtc->crtc_id);
+ return ATOM_SUCCESS;
+ }
+
+ ErrorF("YUV %d setup failed\n", radeon_crtc->crtc_id);
+ return ATOM_NOT_IMPLEMENTED;
+
+}
static int
atombios_output_scaler_setup(xf86OutputPtr output, DisplayModePtr mode)
@@ -1246,6 +1289,12 @@ atombios_output_mode_set(xf86OutputPtr output,
atombios_output_scaler_setup(output, mode);
atombios_set_output_crtc_source(output);
+ if ((radeon_output->MonType == MT_CTV) ||
+ (radeon_output->MonType == MT_STV) ||
+ (radeon_output->MonType == MT_CV))
+ atombios_output_yuv_setup(output, TRUE);
+ else
+ atombios_output_yuv_setup(output, FALSE);
if (radeon_output->MonType == MT_CRT) {
if (radeon_output->devices & ATOM_DEVICE_CRT1_SUPPORT ||
diff --git a/src/radeon_reg.h b/src/radeon_reg.h
index 92bbccca..1987d61d 100644
--- a/src/radeon_reg.h
+++ b/src/radeon_reg.h
@@ -3593,6 +3593,8 @@
# define AVIVO_D1GRPH_UPDATE_LOCK (1<<16)
#define AVIVO_D1GRPH_FLIP_CONTROL 0x6148
+#define AVIVO_D1GRPH_COLOR_MATRIX_TRANSFORMATION_CNTL 0x6380
+
#define AVIVO_D1CUR_CONTROL 0x6400
# define AVIVO_D1CURSOR_EN (1<<0)
# define AVIVO_D1CURSOR_MODE_SHIFT 8