summaryrefslogtreecommitdiff
path: root/src/atombios_crtc.c
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2009-01-28 14:33:14 -0500
committerAlex Deucher <alexdeucher@gmail.com>2009-01-28 14:33:14 -0500
commitbd8021d46e9066e4cd116c03a7b7adcfe2557aff (patch)
tree4c4982475b8d3acbbf943b194141ae0876043479 /src/atombios_crtc.c
parent4f88dd83f290fb38e41256a7f1804008c0f28139 (diff)
parent20d5dd387da555e895e2b73fb53e2b026dd91003 (diff)
Merge branch 'atom-rework' and fix conflicts
Diffstat (limited to 'src/atombios_crtc.c')
-rw-r--r--src/atombios_crtc.c58
1 files changed, 18 insertions, 40 deletions
diff --git a/src/atombios_crtc.c b/src/atombios_crtc.c
index a1270f34..32997407 100644
--- a/src/atombios_crtc.c
+++ b/src/atombios_crtc.c
@@ -47,6 +47,9 @@
#include "sarea.h"
#endif
+extern int
+atombios_get_encoder_mode(xf86OutputPtr output);
+
AtomBiosResult
atombios_lock_crtc(atomBiosHandlePtr atomBIOS, int crtc, int lock)
{
@@ -215,6 +218,7 @@ atombios_crtc_set_pll(xf86CrtcPtr crtc, DisplayModePtr mode, int pll_flags)
PIXEL_CLOCK_PARAMETERS_V3 *spc3_ptr;
xf86OutputPtr output;
RADEONOutputPrivatePtr radeon_output = NULL;
+ radeon_encoder_ptr radeon_encoder = NULL;
void *ptr;
AtomBiosArgRec data;
@@ -261,6 +265,7 @@ atombios_crtc_set_pll(xf86CrtcPtr crtc, DisplayModePtr mode, int pll_flags)
output = xf86_config->output[i];
if (output->crtc == crtc) {
radeon_output = output->driver_private;
+ radeon_encoder = radeon_get_encoder(output);
break;
}
}
@@ -270,6 +275,11 @@ atombios_crtc_set_pll(xf86CrtcPtr crtc, DisplayModePtr mode, int pll_flags)
return;
}
+ if (radeon_encoder == NULL) {
+ xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR, "No encoder assigned to output!\n");
+ return;
+ }
+
atombios_get_command_table_version(info->atomBIOS, index, &major, &minor);
/*ErrorF("table is %d %d\n", major, minor);*/
@@ -296,41 +306,8 @@ atombios_crtc_set_pll(xf86CrtcPtr crtc, DisplayModePtr mode, int pll_flags)
spc3_ptr->ucPostDiv = post_div;
spc3_ptr->ucPpll = radeon_crtc->crtc_id ? ATOM_PPLL2 : ATOM_PPLL1;
spc3_ptr->ucMiscInfo = (radeon_crtc->crtc_id << 2);
-
- if (radeon_output->MonType == MT_CRT) {
- if (radeon_output->DACType == DAC_PRIMARY)
- spc3_ptr->ucTransmitterId = ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1;
- else if (radeon_output->DACType == DAC_TVDAC)
- spc3_ptr->ucTransmitterId = ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2;
- spc3_ptr->ucEncoderMode = ATOM_ENCODER_MODE_CRT;
- } else if (radeon_output->MonType == MT_DFP) {
- if (radeon_output->devices & ATOM_DEVICE_DFP1_SUPPORT)
- spc3_ptr->ucTransmitterId = ENCODER_OBJECT_ID_INTERNAL_UNIPHY;
- else if (radeon_output->devices & ATOM_DEVICE_DFP2_SUPPORT)
- spc3_ptr->ucTransmitterId = ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1;
- else if (radeon_output->devices & ATOM_DEVICE_DFP3_SUPPORT)
- spc3_ptr->ucTransmitterId = ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA;
- if (OUTPUT_IS_DVI)
- spc3_ptr->ucEncoderMode = ATOM_ENCODER_MODE_DVI;
- else if (radeon_output->type == OUTPUT_HDMI)
- spc3_ptr->ucEncoderMode = ATOM_ENCODER_MODE_HDMI;
- else if (radeon_output->type == OUTPUT_DP)
- spc3_ptr->ucEncoderMode = ATOM_ENCODER_MODE_DP;
- } else if (radeon_output->MonType == MT_LCD) {
- if (radeon_output->devices & ATOM_DEVICE_LCD1_SUPPORT)
- spc3_ptr->ucTransmitterId = ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA;
- spc3_ptr->ucEncoderMode = ATOM_ENCODER_MODE_LVDS;
- } else if (OUTPUT_IS_TV) {
- if (radeon_output->DACType == DAC_PRIMARY)
- spc3_ptr->ucTransmitterId = ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1;
- else if (radeon_output->DACType == DAC_TVDAC)
- spc3_ptr->ucTransmitterId = ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2;
- } else if (radeon_output->MonType == MT_CV) {
- if (radeon_output->DACType == DAC_PRIMARY)
- spc3_ptr->ucTransmitterId = ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1;
- else if (radeon_output->DACType == DAC_TVDAC)
- spc3_ptr->ucTransmitterId = ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2;
- }
+ spc3_ptr->ucTransmitterId = radeon_encoder->encoder_id;
+ spc3_ptr->ucEncoderMode = atombios_get_encoder_mode(output);
ptr = &spc_param;
break;
@@ -349,11 +326,11 @@ atombios_crtc_set_pll(xf86CrtcPtr crtc, DisplayModePtr mode, int pll_flags)
data.exec.pspace = ptr;
if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
- ErrorF("Set CRTC PLL success\n");
+ ErrorF("Set CRTC %d PLL success\n", radeon_crtc->crtc_id);
return;
}
- ErrorF("Set CRTC PLL failed\n");
+ ErrorF("Set CRTC %d PLL failed\n", radeon_crtc->crtc_id);
return;
}
@@ -384,12 +361,13 @@ atombios_crtc_mode_set(xf86CrtcPtr crtc,
for (i = 0; i < xf86_config->num_output; i++) {
xf86OutputPtr output = xf86_config->output[i];
RADEONOutputPrivatePtr radeon_output = output->driver_private;
+ radeon_tvout_ptr tvout = &radeon_output->tvout;
if (output->crtc == crtc) {
if (radeon_output->MonType == MT_STV || radeon_output->MonType == MT_CTV) {
- if (radeon_output->tvStd == TV_STD_NTSC ||
- radeon_output->tvStd == TV_STD_NTSC_J ||
- radeon_output->tvStd == TV_STD_PAL_M)
+ if (tvout->tvStd == TV_STD_NTSC ||
+ tvout->tvStd == TV_STD_NTSC_J ||
+ tvout->tvStd == TV_STD_PAL_M)
need_tv_timings = 1;
else
need_tv_timings = 2;