summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2009-01-26 01:50:18 -0500
committerAlex Deucher <alexdeucher@gmail.com>2009-01-26 01:50:18 -0500
commitb515eee4b1cafae78ed39cd91c18b4f5e671b20b (patch)
tree334f2d5174b6ebd5e52dc02bcb1d3e1cf80f707c /src
parent289b4a377cfff0c2a8ec938951cfbae1e270570e (diff)
Additional output cleanup
Diffstat (limited to 'src')
-rw-r--r--src/atombios_output.c29
-rw-r--r--src/legacy_output.c3
-rw-r--r--src/radeon.h3
-rw-r--r--src/radeon_output.c215
4 files changed, 110 insertions, 140 deletions
diff --git a/src/atombios_output.c b/src/atombios_output.c
index a6bfa7a0..92ae3f54 100644
--- a/src/atombios_output.c
+++ b/src/atombios_output.c
@@ -431,8 +431,7 @@ atombios_output_dig_encoder_setup(xf86OutputPtr output, DisplayModePtr mode)
DIG_ENCODER_CONTROL_PS_ALLOCATION disp_data;
AtomBiosArgRec data;
unsigned char *space;
- int index;
- int major, minor;
+ int index, major, minor, num = 0;
if (radeon_encoder == NULL)
return ATOM_NOT_IMPLEMENTED;
@@ -444,17 +443,20 @@ atombios_output_dig_encoder_setup(xf86OutputPtr output, DisplayModePtr mode)
index = GetIndexIntoMasterTable(COMMAND, DIG2EncoderControl);
else
index = GetIndexIntoMasterTable(COMMAND, DIG1EncoderControl);
+ num = radeon_crtc->crtc_id + 1;
} else {
switch (radeon_encoder->encoder_id) {
case ENCODER_OBJECT_ID_INTERNAL_TMDS1:
case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1:
case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
index = GetIndexIntoMasterTable(COMMAND, DIG1EncoderControl);
+ num = 1;
break;
case ENCODER_OBJECT_ID_INTERNAL_LVDS:
case ENCODER_OBJECT_ID_INTERNAL_LVTM1:
case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA:
index = GetIndexIntoMasterTable(COMMAND, DIG2EncoderControl);
+ num = 2;
break;
}
}
@@ -509,11 +511,11 @@ atombios_output_dig_encoder_setup(xf86OutputPtr output, DisplayModePtr mode)
data.exec.pspace = &disp_data;
if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) {
- ErrorF("Output DIG%d encoder setup success\n", radeon_crtc->crtc_id + 1);
+ ErrorF("Output DIG%d encoder setup success\n", num);
return ATOM_SUCCESS;
}
- ErrorF("Output DIG%d setup failed\n", radeon_crtc->crtc_id + 1);
+ ErrorF("Output DIG%d setup failed\n", num);
return ATOM_NOT_IMPLEMENTED;
}
@@ -1073,17 +1075,16 @@ atombios_output_mode_set(xf86OutputPtr output,
switch (radeon_encoder->encoder_id) {
case ENCODER_OBJECT_ID_INTERNAL_TMDS1:
case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1:
+ case ENCODER_OBJECT_ID_INTERNAL_LVDS:
+ case ENCODER_OBJECT_ID_INTERNAL_LVTM1:
+ atombios_output_digital_setup(output, adjusted_mode);
+ break;
case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:
- case ENCODER_OBJECT_ID_INTERNAL_LVDS:
- case ENCODER_OBJECT_ID_INTERNAL_LVTM1:
case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA:
- if (IS_DCE3_VARIANT) {
- atombios_output_dig_encoder_setup(output, adjusted_mode);
- atombios_output_dig_transmitter_setup(output, adjusted_mode);
- } else
- atombios_output_digital_setup(output, adjusted_mode);
+ atombios_output_dig_encoder_setup(output, adjusted_mode);
+ atombios_output_dig_transmitter_setup(output, adjusted_mode);
break;
case ENCODER_OBJECT_ID_INTERNAL_DDI:
atombios_output_ddia_setup(output, adjusted_mode);
@@ -1097,8 +1098,7 @@ atombios_output_mode_set(xf86OutputPtr output,
case ENCODER_OBJECT_ID_INTERNAL_DAC2:
case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2:
atombios_output_dac_setup(output, adjusted_mode);
- if ((radeon_output->active_device & (ATOM_DEVICE_TV_SUPPORT)) ||
- (radeon_output->active_device & (ATOM_DEVICE_CRT_SUPPORT)))
+ if (radeon_output->active_device & (ATOM_DEVICE_TV_SUPPORT | ATOM_DEVICE_CV_SUPPORT))
atombios_output_tv_setup(output, adjusted_mode);
break;
}
@@ -1171,8 +1171,9 @@ atom_bios_dac_load_detect(atomBiosHandlePtr atomBIOS, xf86OutputPtr output)
}
RADEONMonitorType
-atombios_dac_detect(ScrnInfoPtr pScrn, xf86OutputPtr output)
+atombios_dac_detect(xf86OutputPtr output)
{
+ ScrnInfoPtr pScrn = output->scrn;
RADEONInfoPtr info = RADEONPTR(pScrn);
unsigned char *RADEONMMIO = info->MMIO;
RADEONOutputPrivatePtr radeon_output = output->driver_private;
diff --git a/src/legacy_output.c b/src/legacy_output.c
index 54896145..b7b57280 100644
--- a/src/legacy_output.c
+++ b/src/legacy_output.c
@@ -565,8 +565,9 @@ RADEONCrtIsPhysicallyConnected(ScrnInfoPtr pScrn, int IsCrtDac)
#endif
RADEONMonitorType
-legacy_dac_detect(ScrnInfoPtr pScrn, xf86OutputPtr output)
+legacy_dac_detect(xf86OutputPtr output)
{
+ ScrnInfoPtr pScrn = output->scrn;
RADEONInfoPtr info = RADEONPTR(pScrn);
RADEONOutputPrivatePtr radeon_output = output->driver_private;
RADEONMonitorType found = MT_NONE;
diff --git a/src/radeon.h b/src/radeon.h
index 0c114c60..9b724ec7 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -866,8 +866,7 @@ extern void RADEONSavePLLRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save);
extern void RADEONSavePLL2Registers(ScrnInfoPtr pScrn, RADEONSavePtr save);
/* legacy_output.c */
-extern RADEONMonitorType legacy_dac_detect(ScrnInfoPtr pScrn,
- xf86OutputPtr output);
+extern RADEONMonitorType legacy_dac_detect(xf86OutputPtr output);
extern void legacy_output_dpms(xf86OutputPtr output, int mode);
extern void legacy_output_mode_set(xf86OutputPtr output, DisplayModePtr mode,
DisplayModePtr adjusted_mode);
diff --git a/src/radeon_output.c b/src/radeon_output.c
index de1af5de..a2f0a294 100644
--- a/src/radeon_output.c
+++ b/src/radeon_output.c
@@ -48,20 +48,6 @@
#include "radeon_tv.h"
#include "radeon_atombios.h"
-
-const RADEONMonitorType MonTypeID[10] = {
- MT_UNKNOWN, /* this is just a dummy value for AUTO DETECTION */
- MT_NONE, /* NONE -> NONE */
- MT_CRT, /* CRT -> CRT */
- MT_LCD, /* Laptop LCDs are driven via LVDS port */
- MT_DFP, /* DFPs are driven via TMDS */
- MT_CTV, /* CTV -> CTV */
- MT_STV, /* STV -> STV */
- MT_CV,
- MT_HDMI,
- MT_DP
-};
-
const char *encoder_name[33] = {
"NONE",
"INTERNAL_LVDS",
@@ -172,7 +158,7 @@ extern void atombios_output_mode_set(xf86OutputPtr output,
DisplayModePtr mode,
DisplayModePtr adjusted_mode);
extern void atombios_output_dpms(xf86OutputPtr output, int mode);
-extern RADEONMonitorType atombios_dac_detect(ScrnInfoPtr pScrn, xf86OutputPtr output);
+extern RADEONMonitorType atombios_dac_detect(xf86OutputPtr output);
extern int atombios_external_tmds_setup(xf86OutputPtr output, DisplayModePtr mode);
extern AtomBiosResult
atombios_lock_crtc(atomBiosHandlePtr atomBIOS, int crtc, int lock);
@@ -222,6 +208,54 @@ void RADEONPrintPortMap(ScrnInfoPtr pScrn)
}
+static void
+radeon_set_active_device(xf86OutputPtr output)
+{
+ RADEONOutputPrivatePtr radeon_output = output->driver_private;
+
+ radeon_output->active_device = 0;
+
+ switch (radeon_output->MonType) {
+ case MT_DFP:
+ if (radeon_output->devices & ATOM_DEVICE_DFP1_SUPPORT)
+ radeon_output->active_device = ATOM_DEVICE_DFP1_SUPPORT;
+ else if (radeon_output->devices & ATOM_DEVICE_DFP2_SUPPORT)
+ radeon_output->active_device = ATOM_DEVICE_DFP2_SUPPORT;
+ else if (radeon_output->devices & ATOM_DEVICE_DFP3_SUPPORT)
+ radeon_output->active_device = ATOM_DEVICE_DFP3_SUPPORT;
+ else if (radeon_output->devices & ATOM_DEVICE_DFP4_SUPPORT)
+ radeon_output->active_device = ATOM_DEVICE_DFP4_SUPPORT;
+ else if (radeon_output->devices & ATOM_DEVICE_DFP5_SUPPORT)
+ radeon_output->active_device = ATOM_DEVICE_DFP5_SUPPORT;
+ break;
+ case MT_CRT:
+ if (radeon_output->devices & ATOM_DEVICE_CRT1_SUPPORT)
+ radeon_output->active_device = ATOM_DEVICE_CRT1_SUPPORT;
+ else if (radeon_output->devices & ATOM_DEVICE_CRT2_SUPPORT)
+ radeon_output->active_device = ATOM_DEVICE_CRT2_SUPPORT;
+ break;
+ case MT_LCD:
+ if (radeon_output->devices & ATOM_DEVICE_LCD1_SUPPORT)
+ radeon_output->active_device = ATOM_DEVICE_LCD1_SUPPORT;
+ else if (radeon_output->devices & ATOM_DEVICE_LCD2_SUPPORT)
+ radeon_output->active_device = ATOM_DEVICE_LCD2_SUPPORT;
+ break;
+ case MT_STV:
+ case MT_CTV:
+ if (radeon_output->devices & ATOM_DEVICE_TV1_SUPPORT)
+ radeon_output->active_device = ATOM_DEVICE_TV1_SUPPORT;
+ else if (radeon_output->devices & ATOM_DEVICE_TV2_SUPPORT)
+ radeon_output->active_device = ATOM_DEVICE_TV2_SUPPORT;
+ break;
+ case MT_CV:
+ if (radeon_output->devices & ATOM_DEVICE_CV_SUPPORT)
+ radeon_output->active_device = ATOM_DEVICE_CV_SUPPORT;
+ break;
+ default:
+ radeon_output->active_device = 0;
+ }
+}
+
static RADEONMonitorType
radeon_ddc_connected(xf86OutputPtr output)
{
@@ -348,50 +382,6 @@ RADEONDetectLidStatus(ScrnInfoPtr pScrn)
#endif /* __powerpc__ */
static void
-RADEONConnectorFindMonitor(xf86OutputPtr output)
-{
- ScrnInfoPtr pScrn = output->scrn;
- RADEONInfoPtr info = RADEONPTR(pScrn);
- RADEONOutputPrivatePtr radeon_output = output->driver_private;
-
- if (radeon_output->MonType == MT_UNKNOWN) {
- radeon_output->MonType = radeon_ddc_connected(output);
- if (!radeon_output->MonType) {
- if (radeon_output->devices & (ATOM_DEVICE_LCD_SUPPORT)) {
- if (xf86ReturnOptValBool(info->Options, OPTION_IGNORE_LID_STATUS, TRUE))
- radeon_output->MonType = MT_LCD;
- else
-#if defined(__powerpc__)
- radeon_output->MonType = MT_LCD;
-#else
- radeon_output->MonType = RADEONDetectLidStatus(pScrn);
-#endif
- } else {
- if (info->IsAtomBios)
- radeon_output->MonType = atombios_dac_detect(pScrn, output);
- else
- radeon_output->MonType = legacy_dac_detect(pScrn, output);
- }
- }
- }
-
- /* update panel info for RMX */
- if (radeon_output->MonType == MT_LCD || radeon_output->MonType == MT_DFP)
- RADEONUpdatePanelSize(output);
-
- /* panel is probably busted or not connected */
- if ((radeon_output->MonType == MT_LCD) &&
- ((radeon_output->PanelXRes == 0) || (radeon_output->PanelYRes == 0)))
- radeon_output->MonType = MT_NONE;
-
- if (output->MonInfo) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "EDID data from the display on output: %s ----------------------\n",
- output->name);
- xf86PrintEDID( output->MonInfo );
- }
-}
-
-static void
radeon_dpms(xf86OutputPtr output, int mode)
{
RADEONInfoPtr info = RADEONPTR(output->scrn);
@@ -484,7 +474,7 @@ radeon_mode_fixup(xf86OutputPtr output, DisplayModePtr mode,
xf86SetModeCrtc(adjusted_mode, 0);
/* decide if we are using RMX */
- if ((radeon_output->MonType == MT_LCD || radeon_output->MonType == MT_DFP)
+ if ((radeon_output->active_device & (ATOM_DEVICE_LCD_SUPPORT | ATOM_DEVICE_DFP_SUPPORT))
&& radeon_output->rmx_type != RMX_OFF) {
xf86CrtcPtr crtc = output->crtc;
RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private;
@@ -1001,7 +991,39 @@ radeon_detect(xf86OutputPtr output)
radeon_output->MonType = MT_UNKNOWN;
radeon_bios_output_connected(output, FALSE);
- RADEONConnectorFindMonitor(output);
+ radeon_output->MonType = radeon_ddc_connected(output);
+ if (!radeon_output->MonType) {
+ if (radeon_output->devices & (ATOM_DEVICE_LCD_SUPPORT)) {
+ if (xf86ReturnOptValBool(info->Options, OPTION_IGNORE_LID_STATUS, TRUE))
+ radeon_output->MonType = MT_LCD;
+ else
+#if defined(__powerpc__)
+ radeon_output->MonType = MT_LCD;
+#else
+ radeon_output->MonType = RADEONDetectLidStatus(pScrn);
+#endif
+ } else {
+ if (info->IsAtomBios)
+ radeon_output->MonType = atombios_dac_detect(output);
+ else
+ radeon_output->MonType = legacy_dac_detect(output);
+ }
+ }
+
+ /* update panel info for RMX */
+ if (radeon_output->MonType == MT_LCD || radeon_output->MonType == MT_DFP)
+ RADEONUpdatePanelSize(output);
+
+ /* panel is probably busted or not connected */
+ if ((radeon_output->MonType == MT_LCD) &&
+ ((radeon_output->PanelXRes == 0) || (radeon_output->PanelYRes == 0)))
+ radeon_output->MonType = MT_NONE;
+
+ if (output->MonInfo) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "EDID data from the display on output: %s ----------------------\n",
+ output->name);
+ xf86PrintEDID( output->MonInfo );
+ }
/* nothing connected, light up some defaults so the server comes up */
if (radeon_output->MonType == MT_NONE &&
@@ -1064,70 +1086,17 @@ radeon_detect(xf86OutputPtr output)
}
}
- if (radeon_output->MonType == MT_DFP) {
- if (radeon_output->devices & ATOM_DEVICE_DFP1_SUPPORT)
- radeon_output->active_device = ATOM_DEVICE_DFP1_SUPPORT;
- else if (radeon_output->devices & ATOM_DEVICE_DFP2_SUPPORT)
- radeon_output->active_device = ATOM_DEVICE_DFP2_SUPPORT;
- else if (radeon_output->devices & ATOM_DEVICE_DFP3_SUPPORT)
- radeon_output->active_device = ATOM_DEVICE_DFP3_SUPPORT;
- else if (radeon_output->devices & ATOM_DEVICE_DFP4_SUPPORT)
- radeon_output->active_device = ATOM_DEVICE_DFP4_SUPPORT;
- else if (radeon_output->devices & ATOM_DEVICE_DFP5_SUPPORT)
- radeon_output->active_device = ATOM_DEVICE_DFP5_SUPPORT;
- else
- radeon_output->active_device = 0;
- } else if (radeon_output->MonType == MT_CRT) {
- if (radeon_output->devices & ATOM_DEVICE_CRT1_SUPPORT)
- radeon_output->active_device = ATOM_DEVICE_CRT1_SUPPORT;
- else if (radeon_output->devices & ATOM_DEVICE_CRT2_SUPPORT)
- radeon_output->active_device = ATOM_DEVICE_CRT2_SUPPORT;
- else
- radeon_output->active_device = 0;
- } else if (radeon_output->MonType == MT_LCD) {
- if (radeon_output->devices & ATOM_DEVICE_LCD1_SUPPORT)
- radeon_output->active_device = ATOM_DEVICE_LCD1_SUPPORT;
- else if (radeon_output->devices & ATOM_DEVICE_LCD2_SUPPORT)
- radeon_output->active_device = ATOM_DEVICE_LCD2_SUPPORT;
- else
- radeon_output->active_device = 0;
- } else if ((radeon_output->MonType == MT_STV) ||
- (radeon_output->MonType == MT_CTV)){
- if (radeon_output->devices & ATOM_DEVICE_TV1_SUPPORT)
- radeon_output->active_device = ATOM_DEVICE_TV1_SUPPORT;
- else if (radeon_output->devices & ATOM_DEVICE_TV2_SUPPORT)
- radeon_output->active_device = ATOM_DEVICE_TV2_SUPPORT;
- else
- radeon_output->active_device = 0;
- } else if (radeon_output->MonType == MT_CV) {
- if (radeon_output->devices & ATOM_DEVICE_CV_SUPPORT)
- radeon_output->active_device = ATOM_DEVICE_CV_SUPPORT;
- else
- radeon_output->active_device = 0;
- } else
- radeon_output->active_device = 0;
-
- if (radeon_output->MonType == MT_UNKNOWN) {
- output->subpixel_order = SubPixelUnknown;
- return XF86OutputStatusUnknown;
- } else {
-
- switch(radeon_output->MonType) {
- case MT_LCD:
- case MT_DFP:
- output->subpixel_order = SubPixelHorizontalRGB;
- break;
- default:
- output->subpixel_order = SubPixelNone;
- break;
- }
+ radeon_set_active_device(output);
- if (connected)
- return XF86OutputStatusConnected;
- else
- return XF86OutputStatusDisconnected;
- }
+ if (radeon_output->active_device & (ATOM_DEVICE_LCD_SUPPORT | ATOM_DEVICE_DFP_SUPPORT))
+ output->subpixel_order = SubPixelHorizontalRGB;
+ else
+ output->subpixel_order = SubPixelNone;
+ if (connected)
+ return XF86OutputStatusConnected;
+ else
+ return XF86OutputStatusDisconnected;
}
static DisplayModePtr