From 537da7018b0fd2ad263fc5cdc55b3b85cf8e9205 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Wed, 18 Mar 2009 19:22:55 -0400 Subject: ATOM: fix up tv-out support - fix purple hue when using ATOMTvOut option - fix TV load detection on newer r6xx/r7xx chips - disable CV for now --- src/atombios_output.c | 76 ++++++++++++++++++++++++++++++++++----------------- src/radeon_atombios.c | 12 ++++++-- 2 files changed, 60 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/atombios_output.c b/src/atombios_output.c index 2f858339..35d1767c 100644 --- a/src/atombios_output.c +++ b/src/atombios_output.c @@ -1019,11 +1019,30 @@ static void atom_rv515_force_tv_scaler(ScrnInfoPtr pScrn) static int atombios_output_yuv_setup(xf86OutputPtr output, Bool enable) { + RADEONOutputPrivatePtr radeon_output = output->driver_private; RADEONInfoPtr info = RADEONPTR(output->scrn); RADEONCrtcPrivatePtr radeon_crtc = output->crtc->driver_private; ENABLE_YUV_PS_ALLOCATION disp_data; AtomBiosArgRec data; unsigned char *space; + unsigned char *RADEONMMIO = info->MMIO; + uint32_t temp, reg; + + if (info->ChipFamily >= CHIP_FAMILY_R600) + reg = R600_BIOS_3_SCRATCH; + else + reg = RADEON_BIOS_3_SCRATCH; + + //fix up scratch reg handling + temp = INREG(reg); + if (radeon_output->active_device & (ATOM_DEVICE_TV_SUPPORT)) + OUTREG(reg, (ATOM_S3_TV1_ACTIVE | + (radeon_crtc->crtc_id << 18))); + else if (radeon_output->active_device & (ATOM_DEVICE_CV_SUPPORT)) + OUTREG(reg, (ATOM_S3_CV_ACTIVE | + (radeon_crtc->crtc_id << 24))); + else + OUTREG(reg, 0); memset(&disp_data, 0, sizeof(disp_data)); @@ -1036,10 +1055,15 @@ atombios_output_yuv_setup(xf86OutputPtr output, Bool enable) data.exec.pspace = &disp_data; if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) { + + OUTREG(reg, temp); + ErrorF("crtc %d YUV %s setup success\n", radeon_crtc->crtc_id, enable ? "enable" : "disable"); return ATOM_SUCCESS; } + OUTREG(reg, temp); + ErrorF("crtc %d YUV %s setup failed\n", radeon_crtc->crtc_id, enable ? "enable" : "disable"); return ATOM_NOT_IMPLEMENTED; @@ -1631,36 +1655,38 @@ atom_bios_dac_load_detect(atomBiosHandlePtr atomBIOS, xf86OutputPtr output) } } else if (radeon_output->devices & ATOM_DEVICE_CV_SUPPORT) { dac_data.sDacload.usDeviceID = cpu_to_le16(ATOM_DEVICE_CV_SUPPORT); - if (IS_AVIVO_VARIANT) { - if (info->encoders[ATOM_DEVICE_CV_INDEX] && - (info->encoders[ATOM_DEVICE_CV_INDEX]->encoder_id == ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1)) - dac_data.sDacload.ucDacType = ATOM_DAC_A; - else - dac_data.sDacload.ucDacType = ATOM_DAC_B; - } else { - if (info->encoders[ATOM_DEVICE_CV_INDEX] && - (info->encoders[ATOM_DEVICE_CV_INDEX]->encoder_id == ENCODER_OBJECT_ID_INTERNAL_DAC1)) - dac_data.sDacload.ucDacType = ATOM_DAC_A; - else + if (IS_AVIVO_VARIANT) { + if (info->encoders[ATOM_DEVICE_CV_INDEX] && + (info->encoders[ATOM_DEVICE_CV_INDEX]->encoder_id == ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1)) + dac_data.sDacload.ucDacType = ATOM_DAC_A; + else + dac_data.sDacload.ucDacType = ATOM_DAC_B; + } else { + if (info->encoders[ATOM_DEVICE_CV_INDEX] && + (info->encoders[ATOM_DEVICE_CV_INDEX]->encoder_id == ENCODER_OBJECT_ID_INTERNAL_DAC1)) + dac_data.sDacload.ucDacType = ATOM_DAC_A; + else dac_data.sDacload.ucDacType = ATOM_DAC_B; - } + } if (minor >= 3) dac_data.sDacload.ucMisc = DAC_LOAD_MISC_YPrPb; } else if (radeon_output->devices & ATOM_DEVICE_TV1_SUPPORT) { dac_data.sDacload.usDeviceID = cpu_to_le16(ATOM_DEVICE_TV1_SUPPORT); - if (IS_AVIVO_VARIANT) { - if (info->encoders[ATOM_DEVICE_TV1_INDEX] && - (info->encoders[ATOM_DEVICE_TV1_INDEX]->encoder_id == ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1)) - dac_data.sDacload.ucDacType = ATOM_DAC_A; - else - dac_data.sDacload.ucDacType = ATOM_DAC_B; - } else { - if (info->encoders[ATOM_DEVICE_TV1_INDEX] && - (info->encoders[ATOM_DEVICE_TV1_INDEX]->encoder_id == ENCODER_OBJECT_ID_INTERNAL_DAC1)) - dac_data.sDacload.ucDacType = ATOM_DAC_A; - else - dac_data.sDacload.ucDacType = ATOM_DAC_B; - } + if (IS_AVIVO_VARIANT) { + if (info->encoders[ATOM_DEVICE_TV1_INDEX] && + (info->encoders[ATOM_DEVICE_TV1_INDEX]->encoder_id == ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1)) + dac_data.sDacload.ucDacType = ATOM_DAC_A; + else + dac_data.sDacload.ucDacType = ATOM_DAC_B; + } else { + if (info->encoders[ATOM_DEVICE_TV1_INDEX] && + (info->encoders[ATOM_DEVICE_TV1_INDEX]->encoder_id == ENCODER_OBJECT_ID_INTERNAL_DAC1)) + dac_data.sDacload.ucDacType = ATOM_DAC_A; + else + dac_data.sDacload.ucDacType = ATOM_DAC_B; + } + if (minor >= 3) + dac_data.sDacload.ucMisc = DAC_LOAD_MISC_YPrPb; } else { ErrorF("invalid output device for dac detection\n"); return ATOM_NOT_IMPLEMENTED; diff --git a/src/radeon_atombios.c b/src/radeon_atombios.c index 406e4f9d..0b17cbd2 100644 --- a/src/radeon_atombios.c +++ b/src/radeon_atombios.c @@ -1771,14 +1771,19 @@ RADEONGetATOMConnectorInfoFromBIOSObject (ScrnInfoPtr pScrn) con_obj_type = (path->usConnObjectId & OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT; if ((path->usDeviceTag == ATOM_DEVICE_TV1_SUPPORT) || - (path->usDeviceTag == ATOM_DEVICE_TV2_SUPPORT) || - (path->usDeviceTag == ATOM_DEVICE_CV_SUPPORT)) { + (path->usDeviceTag == ATOM_DEVICE_TV2_SUPPORT)) { if (!enable_tv) { info->BiosConnector[i].valid = FALSE; continue; } } + /* don't support CV yet */ + if (path->usDeviceTag == ATOM_DEVICE_CV_SUPPORT) { + info->BiosConnector[i].valid = FALSE; + continue; + } + if ((info->ChipFamily == CHIP_FAMILY_RS780) && (con_obj_id == CONNECTOR_OBJECT_ID_PCIE_CONNECTOR)) { uint32_t slot_config, ct; @@ -2203,7 +2208,8 @@ RADEONGetATOMConnectorInfoFromBIOSConnectorTable (ScrnInfoPtr pScrn) continue; } - if (!enable_tv && (i == ATOM_DEVICE_CV_INDEX)) { + /* don't support CV yet */ + if (i == ATOM_DEVICE_CV_INDEX) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Skipping Component Video\n"); info->BiosConnector[i].valid = FALSE; continue; -- cgit v1.2.3