diff options
author | Alex Deucher <alex@samba.(none)> | 2008-01-10 14:49:48 -0500 |
---|---|---|
committer | Alex Deucher <alex@samba.(none)> | 2008-01-10 14:49:48 -0500 |
commit | 000741e250e54122b0adc91694eb4bfa320a70fb (patch) | |
tree | 214947d1626755f985d63e54e0d301c9b8ac9dd5 | |
parent | 10e7636c02478b8ffe183bb0c46229ca0d6584e1 (diff) |
RADEON: clean up output handling
-rw-r--r-- | src/atombios_output.c | 60 | ||||
-rw-r--r-- | src/radeon_atombios.c | 8 | ||||
-rw-r--r-- | src/radeon_bios.c | 115 | ||||
-rw-r--r-- | src/radeon_output.c | 42 | ||||
-rw-r--r-- | src/radeon_probe.h | 16 |
5 files changed, 84 insertions, 157 deletions
diff --git a/src/atombios_output.c b/src/atombios_output.c index 5ec30987..1a6277e8 100644 --- a/src/atombios_output.c +++ b/src/atombios_output.c @@ -382,15 +382,17 @@ atombios_display_device_control(atomBiosHandlePtr atomBIOS, int device, Bool sta static void atombios_device_dpms(xf86OutputPtr output, int device, int mode) { + RADEONOutputPrivatePtr radeon_output = output->driver_private; RADEONInfoPtr info = RADEONPTR(output->scrn); - int index; + int index = 0; switch (device) { case ATOM_DEVICE_CRT1_SUPPORT: - index = GetIndexIntoMasterTable(COMMAND, DAC1OutputControl); - break; case ATOM_DEVICE_CRT2_SUPPORT: - index = GetIndexIntoMasterTable(COMMAND, DAC2OutputControl); + if (radeon_output->DACType == DAC_PRIMARY) + index = GetIndexIntoMasterTable(COMMAND, DAC1OutputControl); + else if (radeon_output->DACType == DAC_TVDAC) + index = GetIndexIntoMasterTable(COMMAND, DAC2OutputControl); break; case ATOM_DEVICE_DFP1_SUPPORT: index = GetIndexIntoMasterTable(COMMAND, TMDSAOutputControl); @@ -440,9 +442,9 @@ atombios_output_dpms(xf86OutputPtr output, int mode) * assume we can process. */ count = 0; - tmp = INREG(0x0028); + tmp = INREG(RADEON_BIOS_6_SCRATCH); while((tmp & 0x100) && (count < 5)) { - tmp = INREG(0x0028); + tmp = INREG(RADEON_BIOS_6_SCRATCH); count++; usleep(1000); } @@ -451,7 +453,7 @@ atombios_output_dpms(xf86OutputPtr output, int mode) "%s (WARNING) failed to grab card lock process anyway.\n", __func__); } - OUTREG(0x0028, tmp | 0x100); + OUTREG(RADEON_BIOS_6_SCRATCH, tmp | 0x100); #endif ErrorF("AGD: output dpms %d\n", mode); @@ -484,8 +486,8 @@ atombios_output_dpms(xf86OutputPtr output, int mode) } #if 1 /* release card lock */ - tmp = INREG(0x0028); - OUTREG(0x0028, tmp & (~0x100)); + tmp = INREG(RADEON_BIOS_6_SCRATCH); + OUTREG(RADEON_BIOS_6_SCRATCH, tmp & (~0x100)); #endif } @@ -570,10 +572,13 @@ atombios_output_mode_set(xf86OutputPtr output, atombios_set_output_crtc_source(output); if (radeon_output->MonType == MT_CRT) { - if (radeon_output->devices & ATOM_DEVICE_CRT1_SUPPORT) - atombios_output_dac1_setup(output, adjusted_mode); - else if (radeon_output->devices & ATOM_DEVICE_CRT2_SUPPORT) - atombios_output_dac2_setup(output, adjusted_mode); + if (radeon_output->devices & ATOM_DEVICE_CRT1_SUPPORT || + radeon_output->devices & ATOM_DEVICE_CRT2_SUPPORT) { + if (radeon_output->DACType == DAC_PRIMARY) + atombios_output_dac1_setup(output, adjusted_mode); + else if (radeon_output->DACType == DAC_TVDAC) + atombios_output_dac2_setup(output, adjusted_mode); + } } else if (radeon_output->MonType == MT_DFP) { if (radeon_output->devices & ATOM_DEVICE_DFP1_SUPPORT) atombios_output_tmds1_setup(output, adjusted_mode); @@ -582,10 +587,13 @@ atombios_output_mode_set(xf86OutputPtr output, else if (radeon_output->devices & ATOM_DEVICE_DFP3_SUPPORT) atombios_output_tmds2_setup(output, adjusted_mode); } else if (radeon_output->MonType == MT_LCD) { - if (radeon_output->devices & ATOM_DEVICE_LCD1_SUPPORT) - atombios_output_lvds_setup(output, adjusted_mode); + if (radeon_output->devices & ATOM_DEVICE_LCD1_SUPPORT) + atombios_output_lvds_setup(output, adjusted_mode); } else if (OUTPUT_IS_TV || (radeon_output->MonType == MT_CV)) { - atombios_output_dac2_setup(output, adjusted_mode); + if (radeon_output->DACType == DAC_PRIMARY) + atombios_output_dac1_setup(output, adjusted_mode); + else if (radeon_output->DACType == DAC_TVDAC) + atombios_output_dac2_setup(output, adjusted_mode); atombios_output_tv1_setup(output, adjusted_mode); } @@ -601,16 +609,28 @@ atom_bios_dac_load_detect(atomBiosHandlePtr atomBIOS, xf86OutputPtr output) if (radeon_output->devices & ATOM_DEVICE_CRT1_SUPPORT) { dac_data.sDacload.usDeviceID = ATOM_DEVICE_CRT1_SUPPORT; - dac_data.sDacload.ucDacType = ATOM_DAC_A; + if (radeon_output->DACType == DAC_PRIMARY) + dac_data.sDacload.ucDacType = ATOM_DAC_A; + else if (radeon_output->DACType == DAC_TVDAC) + dac_data.sDacload.ucDacType = ATOM_DAC_B; } else if (radeon_output->devices & ATOM_DEVICE_CRT2_SUPPORT) { dac_data.sDacload.usDeviceID = ATOM_DEVICE_CRT2_SUPPORT; - dac_data.sDacload.ucDacType = ATOM_DAC_B; + if (radeon_output->DACType == DAC_PRIMARY) + dac_data.sDacload.ucDacType = ATOM_DAC_A; + else if (radeon_output->DACType == DAC_TVDAC) + dac_data.sDacload.ucDacType = ATOM_DAC_B; } else if (radeon_output->devices & ATOM_DEVICE_CV_SUPPORT) { dac_data.sDacload.usDeviceID = ATOM_DEVICE_CV_SUPPORT; - dac_data.sDacload.ucDacType = ATOM_DAC_B; + if (radeon_output->DACType == DAC_PRIMARY) + dac_data.sDacload.ucDacType = ATOM_DAC_A; + else if (radeon_output->DACType == DAC_TVDAC) + dac_data.sDacload.ucDacType = ATOM_DAC_B; } else if (radeon_output->devices & ATOM_DEVICE_TV1_SUPPORT) { dac_data.sDacload.usDeviceID = ATOM_DEVICE_TV1_SUPPORT; - dac_data.sDacload.ucDacType = ATOM_DAC_B; + if (radeon_output->DACType == DAC_PRIMARY) + dac_data.sDacload.ucDacType = ATOM_DAC_A; + else if (radeon_output->DACType == DAC_TVDAC) + dac_data.sDacload.ucDacType = ATOM_DAC_B; } 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 bff164d7..b956b9a2 100644 --- a/src/radeon_atombios.c +++ b/src/radeon_atombios.c @@ -1525,7 +1525,7 @@ RADEONGetATOMConnectorInfoFromBIOSObject (ScrnInfoPtr pScrn) break; case ENCODER_OBJECT_ID_INTERNAL_LVTM1: info->BiosConnector[i].devices |= (1 << ATOM_DEVICE_DFP3_INDEX); - info->BiosConnector[i].TMDSType = TMDS_EXT; + info->BiosConnector[i].TMDSType = TMDS_LVTMA; break; case ENCODER_OBJECT_ID_INTERNAL_DAC1: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: @@ -1715,7 +1715,7 @@ RADEONGetATOMConnectorInfoFromBIOSConnectorTable (ScrnInfoPtr pScrn) info->BiosConnector[i].output_id = ci.sucI2cId.sbfAccess.bfI2C_LineMux; info->BiosConnector[i].devices = (1 << i); info->BiosConnector[i].ConnectorType = ci.sucConnectorInfo.sbfAccess.bfConnectorType; - info->BiosConnector[i].DACType = ci.sucConnectorInfo.sbfAccess.bfAssociatedDAC - 1; + info->BiosConnector[i].DACType = ci.sucConnectorInfo.sbfAccess.bfAssociatedDAC; /* don't assign a gpio for tv */ if ((i == ATOM_DEVICE_TV1_INDEX) || @@ -1731,9 +1731,9 @@ RADEONGetATOMConnectorInfoFromBIOSConnectorTable (ScrnInfoPtr pScrn) else if (i == ATOM_DEVICE_DFP2_INDEX) info->BiosConnector[i].TMDSType = TMDS_EXT; else if (i == ATOM_DEVICE_DFP3_INDEX) - info->BiosConnector[i].TMDSType = TMDS_EXT; + info->BiosConnector[i].TMDSType = TMDS_LVTMA; else - info->BiosConnector[i].TMDSType = TMDS_UNKNOWN; + info->BiosConnector[i].TMDSType = TMDS_NONE; /* Always set the connector type to VGA for CRT1/CRT2. if they are * shared with a DVI port, we'll pick up the DVI connector below when we diff --git a/src/radeon_bios.c b/src/radeon_bios.c index 335bdfee..92a49278 100644 --- a/src/radeon_bios.c +++ b/src/radeon_bios.c @@ -203,7 +203,6 @@ Bool RADEONGetBIOSInfo(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) static Bool RADEONGetATOMConnectorInfoFromBIOS (ScrnInfoPtr pScrn) { RADEONInfoPtr info = RADEONPTR (pScrn); - int offset, i, j, tmp, tmp0, id, portinfo, gpio; if (!info->VBIOS) return FALSE; @@ -213,104 +212,7 @@ static Bool RADEONGetATOMConnectorInfoFromBIOS (ScrnInfoPtr pScrn) if (RADEONGetATOMConnectorInfoFromBIOSConnectorTable(pScrn)) return TRUE; - offset = RADEON_BIOS16(info->MasterDataStart + 22); - - if (offset) { - tmp = RADEON_BIOS16(offset + 4); - for (i = 0; i < RADEON_MAX_BIOS_CONNECTOR; i++) { - if (tmp & (1 << i)) { - - if (i == ATOM_DEVICE_CV_INDEX) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Skipping Component Video\n"); - info->BiosConnector[i].valid = FALSE; - continue; - } - - info->BiosConnector[i].valid = TRUE; - portinfo = RADEON_BIOS16(offset + 6 + i * 2); - info->BiosConnector[i].DACType = (portinfo & 0xf) - 1; - info->BiosConnector[i].ConnectorType = (portinfo >> 4) & 0xf; - id = (portinfo >> 8) & 0xf; - tmp0 = RADEON_BIOS16(info->MasterDataStart + 24); - gpio = RADEON_BIOS16(tmp0 + 4 + 27 * id) * 4; - /* don't assign a gpio for tv */ - if ((i == ATOM_DEVICE_TV1_INDEX) || - (i == ATOM_DEVICE_TV2_INDEX) || - (i == ATOM_DEVICE_CV_INDEX)) - info->BiosConnector[i].ddc_line = 0; - else - info->BiosConnector[i].ddc_line = gpio; - - info->BiosConnector[i].output_id = id; - info->BiosConnector[i].devices = (1 << i); - - if (i == ATOM_DEVICE_DFP1_INDEX) - info->BiosConnector[i].TMDSType = TMDS_INT; - else if (i == ATOM_DEVICE_DFP2_INDEX) - info->BiosConnector[i].TMDSType = TMDS_EXT; - else if (i == ATOM_DEVICE_DFP3_INDEX) - info->BiosConnector[i].TMDSType = TMDS_EXT; - else - info->BiosConnector[i].TMDSType = TMDS_UNKNOWN; - - /* Always set the connector type to VGA for CRT1/CRT2. if they are - * shared with a DVI port, we'll pick up the DVI connector below when we - * merge the outputs - */ - if ((i == ATOM_DEVICE_CRT1_INDEX || i == ATOM_DEVICE_CRT2_INDEX) && - (info->BiosConnector[i].ConnectorType == CONNECTOR_DVI_I || - info->BiosConnector[i].ConnectorType == CONNECTOR_DVI_D || - info->BiosConnector[i].ConnectorType == CONNECTOR_DVI_A)) { - info->BiosConnector[i].ConnectorType = CONNECTOR_VGA; - } - - } else { - info->BiosConnector[i].valid = FALSE; - } - } - } else { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "No Device Info Table found!\n"); - return FALSE; - } - - /* CRTs/DFPs may share a port */ - for (i = 0; i < RADEON_MAX_BIOS_CONNECTOR; i++) { - if (info->BiosConnector[i].valid) { - for (j = 0; j < RADEON_MAX_BIOS_CONNECTOR; j++) { - if (info->BiosConnector[j].valid && (i != j) ) { - if (info->BiosConnector[i].output_id == info->BiosConnector[j].output_id) { - if (((i == ATOM_DEVICE_DFP1_INDEX) || - (i == ATOM_DEVICE_DFP2_INDEX) || - (i == ATOM_DEVICE_DFP3_INDEX)) && - ((j == ATOM_DEVICE_CRT1_INDEX) || (j == ATOM_DEVICE_CRT2_INDEX))) { - info->BiosConnector[i].DACType = info->BiosConnector[j].DACType; - info->BiosConnector[i].devices |= info->BiosConnector[j].devices; - info->BiosConnector[j].valid = FALSE; - } else if (((j == ATOM_DEVICE_DFP1_INDEX) || - (j == ATOM_DEVICE_DFP2_INDEX) || - (j == ATOM_DEVICE_DFP3_INDEX)) && - ((i == ATOM_DEVICE_CRT1_INDEX) || (i == ATOM_DEVICE_CRT2_INDEX))) { - info->BiosConnector[j].DACType = info->BiosConnector[i].DACType; - info->BiosConnector[j].devices |= info->BiosConnector[i].devices; - info->BiosConnector[i].valid = FALSE; - } - /* other possible combos? */ - } - } - } - } - } - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Bios Connector table: \n"); - for (i = 0; i < RADEON_MAX_BIOS_CONNECTOR; i++) { - if (info->BiosConnector[i].valid) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Port%d: DDCType-0x%x, DACType-%d, TMDSType-%d, ConnectorType-%d\n", - i, (unsigned int)info->BiosConnector[i].ddc_line, info->BiosConnector[i].DACType, - info->BiosConnector[i].TMDSType, info->BiosConnector[i].ConnectorType); - } - } - - return TRUE; + return FALSE; } static Bool RADEONGetLegacyConnectorInfoFromBIOS (ScrnInfoPtr pScrn) @@ -382,8 +284,19 @@ static Bool RADEONGetLegacyConnectorInfoFromBIOS (ScrnInfoPtr pScrn) xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Unknown DDC Type: %d\n", DDCType); break; } - info->BiosConnector[i].DACType = tmp & 0x1; - info->BiosConnector[i].TMDSType = (tmp >> 4) & 0x1; + if (tmp & 0x1) + info->BiosConnector[i].DACType = DAC_TVDAC; + else + info->BiosConnector[i].DACType = DAC_PRIMARY; + + /* For RS300/RS350/RS400 chips, there is no primary DAC. Force VGA port to use TVDAC*/ + if (info->IsIGP) + info->BiosConnector[i].DACType = DAC_TVDAC; + + if ((tmp >> 4) & 0x1) + info->BiosConnector[i].TMDSType = TMDS_EXT; + else + info->BiosConnector[i].TMDSType = TMDS_INT; /* most XPRESS chips seem to specify DDC_CRT2 for their * VGA DDC port, however DDC never seems to work on that diff --git a/src/radeon_output.c b/src/radeon_output.c index 59e01bb3..be28110a 100644 --- a/src/radeon_output.c +++ b/src/radeon_output.c @@ -75,17 +75,17 @@ const RADEONMonitorType MonTypeID[10] = { }; const char *TMDSTypeName[4] = { - "Unknown", + "None", "Internal", "External", - "None" + "LVTMA", }; const char *DACTypeName[4] = { - "Unknown", + "None", "Primary", "TVDAC/ExtDAC", - "None" + "ExtDac" }; const char *ConnectorTypeName[17] = { @@ -204,8 +204,8 @@ void RADEONPrintPortMap(ScrnInfoPtr pScrn) o, MonTypeName[radeon_output->MonType+1], ConnectorTypeName[radeon_output->ConnectorType], - DACTypeName[radeon_output->DACType+1], - TMDSTypeName[radeon_output->TMDSType+1], + DACTypeName[radeon_output->DACType], + TMDSTypeName[radeon_output->TMDSType], (unsigned int)radeon_output->ddc_line); } @@ -1985,8 +1985,8 @@ static void RADEONSetupGenericConnectors(ScrnInfoPtr pScrn) /* Below is the most common setting, but may not be true */ if (info->IsIGP) { info->BiosConnector[0].ddc_line = RADEON_LCD_GPIO_MASK; - info->BiosConnector[0].DACType = DAC_UNKNOWN; - info->BiosConnector[0].TMDSType = TMDS_UNKNOWN; + info->BiosConnector[0].DACType = DAC_NONE; + info->BiosConnector[0].TMDSType = TMDS_NONE; info->BiosConnector[0].ConnectorType = CONNECTOR_LVDS; info->BiosConnector[0].valid = TRUE; @@ -1996,7 +1996,7 @@ static void RADEONSetupGenericConnectors(ScrnInfoPtr pScrn) else info->BiosConnector[1].ddc_line = RADEON_GPIO_VGA_DDC; info->BiosConnector[1].DACType = DAC_TVDAC; - info->BiosConnector[1].TMDSType = TMDS_UNKNOWN; + info->BiosConnector[1].TMDSType = TMDS_NONE; info->BiosConnector[1].ConnectorType = CONNECTOR_VGA; info->BiosConnector[1].valid = TRUE; } else { @@ -2005,14 +2005,14 @@ static void RADEONSetupGenericConnectors(ScrnInfoPtr pScrn) #else info->BiosConnector[0].ddc_line = RADEON_LCD_GPIO_MASK; #endif - info->BiosConnector[0].DACType = DAC_UNKNOWN; - info->BiosConnector[0].TMDSType = TMDS_UNKNOWN; + info->BiosConnector[0].DACType = DAC_NONE; + info->BiosConnector[0].TMDSType = TMDS_NONE; info->BiosConnector[0].ConnectorType = CONNECTOR_LVDS; info->BiosConnector[0].valid = TRUE; info->BiosConnector[1].ddc_line = RADEON_GPIO_VGA_DDC; info->BiosConnector[1].DACType = DAC_PRIMARY; - info->BiosConnector[1].TMDSType = TMDS_UNKNOWN; + info->BiosConnector[1].TMDSType = TMDS_NONE; info->BiosConnector[1].ConnectorType = CONNECTOR_VGA; info->BiosConnector[1].valid = TRUE; } @@ -2024,7 +2024,7 @@ static void RADEONSetupGenericConnectors(ScrnInfoPtr pScrn) else info->BiosConnector[0].ddc_line = RADEON_GPIO_VGA_DDC; info->BiosConnector[0].DACType = DAC_TVDAC; - info->BiosConnector[0].TMDSType = TMDS_UNKNOWN; + info->BiosConnector[0].TMDSType = TMDS_NONE; info->BiosConnector[0].ConnectorType = CONNECTOR_VGA; info->BiosConnector[0].valid = TRUE; @@ -2032,7 +2032,7 @@ static void RADEONSetupGenericConnectors(ScrnInfoPtr pScrn) * IGP desktop chips is */ info->BiosConnector[1].ddc_line = RADEON_GPIO_MONID; /* DDC_DVI? */ - info->BiosConnector[1].DACType = DAC_UNKNOWN; + info->BiosConnector[1].DACType = DAC_NONE; info->BiosConnector[1].TMDSType = TMDS_EXT; info->BiosConnector[1].ConnectorType = CONNECTOR_DVI_D; info->BiosConnector[1].valid = TRUE; @@ -2213,8 +2213,8 @@ Bool RADEONSetupConnectors(ScrnInfoPtr pScrn) for (i = 0; i < RADEON_MAX_BIOS_CONNECTOR; i++) { info->BiosConnector[i].valid = FALSE; info->BiosConnector[i].ddc_line = 0; - info->BiosConnector[i].DACType = DAC_UNKNOWN; - info->BiosConnector[i].TMDSType = TMDS_UNKNOWN; + info->BiosConnector[i].DACType = DAC_NONE; + info->BiosConnector[i].TMDSType = TMDS_NONE; info->BiosConnector[i].ConnectorType = CONNECTOR_NONE; } @@ -2263,13 +2263,7 @@ Bool RADEONSetupConnectors(ScrnInfoPtr pScrn) RADEONSetupGenericConnectors(pScrn); } - if (info->HasSingleDAC) { - /* For RS300/RS350/RS400 chips, there is no primary DAC. Force VGA port to use TVDAC*/ - for (i = 0; i < RADEON_MAX_BIOS_CONNECTOR; i++) { - if (info->BiosConnector[i].ConnectorType == CONNECTOR_VGA) - info->BiosConnector[i].DACType = DAC_TVDAC; - } - } else if (!pRADEONEnt->HasCRTC2) { + if (!pRADEONEnt->HasCRTC2) { for (i = 0; i < RADEON_MAX_BIOS_CONNECTOR; i++) { if (info->BiosConnector[i].ConnectorType == CONNECTOR_VGA) info->BiosConnector[i].DACType = DAC_PRIMARY; @@ -2287,7 +2281,7 @@ Bool RADEONSetupConnectors(ScrnInfoPtr pScrn) } info->BiosConnector[0].valid = TRUE; info->BiosConnector[1].valid = TRUE; - if (sscanf(optstr, "%u,%d,%d,%u,%u,%d,%d,%u", + if (sscanf(optstr, "%u,%u,%u,%u,%u,%u,%u,%u", &ddc_line[0], &info->BiosConnector[0].DACType, &info->BiosConnector[0].TMDSType, diff --git a/src/radeon_probe.h b/src/radeon_probe.h index 2ee5428f..a9ac5f6b 100644 --- a/src/radeon_probe.h +++ b/src/radeon_probe.h @@ -90,18 +90,18 @@ typedef enum typedef enum { - DAC_UNKNOWN = -1, - DAC_PRIMARY = 0, - DAC_TVDAC = 1, - DAC_NONE = 2 + DAC_NONE = 0, + DAC_PRIMARY = 1, + DAC_TVDAC = 2, + DAC_EXT = 3 } RADEONDacType; typedef enum { - TMDS_UNKNOWN = -1, - TMDS_INT = 0, - TMDS_EXT = 1, - TMDS_NONE = 2 + TMDS_NONE = 0, + TMDS_INT = 1, + TMDS_EXT = 2, + TMDS_LVTMA = 3 } RADEONTmdsType; typedef enum |