summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Deucher <alex@botch2.com>2007-08-05 02:27:32 -0400
committerAlex Deucher <alex@botch2.com>2007-08-05 02:27:32 -0400
commitba5496ae7973786802962bf649dd91c219531749 (patch)
treebe9970aba3c7f011a7078d7a20120ff73276f709
parent2ec22783ddf4c522df9e5fd1b2003854486d7a2b (diff)
RADEON: refactor output init to handle multiple DVI or VGA
- refactor output init to handle multiple DVI or VGA with the new bios table parsing
-rw-r--r--src/radeon_output.c69
1 files changed, 46 insertions, 23 deletions
diff --git a/src/radeon_output.c b/src/radeon_output.c
index d0225aa..0cd1183 100644
--- a/src/radeon_output.c
+++ b/src/radeon_output.c
@@ -1701,7 +1701,8 @@ Bool RADEONSetupConnectors(ScrnInfoPtr pScrn)
xf86OutputPtr output;
char *optstr;
int i = 0;
-
+ int num_vga = 0;
+ int num_dvi = 0;
/* We first get the information about all connectors from BIOS.
* This is how the card is phyiscally wired up.
@@ -1795,6 +1796,27 @@ Bool RADEONSetupConnectors(ScrnInfoPtr pScrn)
for (i = 0 ; i < RADEON_MAX_BIOS_CONNECTOR; i++) {
if (info->BiosConnector[i].valid) {
+ if (info->IsAtomBios) {
+ if ((info->BiosConnector[i].ConnectorType == CONNECTOR_DVI_D_ATOM) ||
+ (info->BiosConnector[i].ConnectorType == CONNECTOR_DVI_I_ATOM) ||
+ (info->BiosConnector[i].ConnectorType == CONNECTOR_DVI_A_ATOM)) {
+ num_dvi++;
+ } else if (info->BiosConnector[i].ConnectorType == CONNECTOR_VGA_ATOM) {
+ num_vga++;
+ }
+ } else {
+ if ((info->BiosConnector[i].ConnectorType == CONNECTOR_DVI_D) ||
+ (info->BiosConnector[i].ConnectorType == CONNECTOR_DVI_I)) {
+ num_dvi++;
+ } else if (info->BiosConnector[i].ConnectorType == CONNECTOR_CRT) {
+ num_vga++;
+ }
+ }
+ }
+ }
+
+ for (i = 0 ; i < RADEON_MAX_BIOS_CONNECTOR; i++) {
+ if (info->BiosConnector[i].valid) {
RADEONOutputPrivatePtr radeon_output = xnfcalloc(sizeof(RADEONOutputPrivateRec), 1);
if (!radeon_output) {
return FALSE;
@@ -1825,39 +1847,40 @@ Bool RADEONSetupConnectors(ScrnInfoPtr pScrn)
}
RADEONSetOutputType(pScrn, radeon_output);
if (info->IsAtomBios) {
- if (((info->BiosConnector[0].ConnectorType == CONNECTOR_DVI_D_ATOM) ||
- (info->BiosConnector[0].ConnectorType == CONNECTOR_DVI_I_ATOM) ||
- (info->BiosConnector[0].ConnectorType == CONNECTOR_DVI_A_ATOM)) &&
- ((info->BiosConnector[1].ConnectorType == CONNECTOR_DVI_D_ATOM) ||
- (info->BiosConnector[1].ConnectorType == CONNECTOR_DVI_I_ATOM) ||
- (info->BiosConnector[1].ConnectorType == CONNECTOR_DVI_A_ATOM))) {
- if (i > 0)
+ if ((info->BiosConnector[i].ConnectorType == CONNECTOR_DVI_D_ATOM) ||
+ (info->BiosConnector[i].ConnectorType == CONNECTOR_DVI_I_ATOM) ||
+ (info->BiosConnector[i].ConnectorType == CONNECTOR_DVI_A_ATOM)) {
+ if (num_dvi > 1) {
output = xf86OutputCreate(pScrn, &radeon_output_funcs, "DVI-1");
- else
+ num_dvi--;
+ } else {
output = xf86OutputCreate(pScrn, &radeon_output_funcs, "DVI-0");
- } else if ((info->BiosConnector[0].ConnectorType == CONNECTOR_VGA_ATOM) &&
- (info->BiosConnector[1].ConnectorType == CONNECTOR_VGA_ATOM)) {
- if (i > 0)
+ }
+ } else if (info->BiosConnector[0].ConnectorType == CONNECTOR_VGA_ATOM) {
+ if (num_vga > 1) {
output = xf86OutputCreate(pScrn, &radeon_output_funcs, "VGA-1");
- else
+ num_vga--;
+ } else {
output = xf86OutputCreate(pScrn, &radeon_output_funcs, "VGA-0");
+ }
} else
output = xf86OutputCreate(pScrn, &radeon_output_funcs, OutputType[radeon_output->type]);
} else {
- if (((info->BiosConnector[0].ConnectorType == CONNECTOR_DVI_D) ||
- (info->BiosConnector[0].ConnectorType == CONNECTOR_DVI_I)) &&
- ((info->BiosConnector[1].ConnectorType == CONNECTOR_DVI_D) ||
- (info->BiosConnector[1].ConnectorType == CONNECTOR_DVI_I))) {
- if (i > 0)
+ if ((info->BiosConnector[i].ConnectorType == CONNECTOR_DVI_D) ||
+ (info->BiosConnector[i].ConnectorType == CONNECTOR_DVI_I)) {
+ if (num_dvi > 1) {
output = xf86OutputCreate(pScrn, &radeon_output_funcs, "DVI-1");
- else
+ num_dvi--;
+ } else {
output = xf86OutputCreate(pScrn, &radeon_output_funcs, "DVI-0");
- } else if ((info->BiosConnector[0].ConnectorType == CONNECTOR_CRT) &&
- (info->BiosConnector[1].ConnectorType == CONNECTOR_CRT)) {
- if (i > 0)
+ }
+ } else if (info->BiosConnector[0].ConnectorType == CONNECTOR_CRT) {
+ if (num_vga > 1) {
output = xf86OutputCreate(pScrn, &radeon_output_funcs, "VGA-1");
- else
+ num_vga--;
+ } else {
output = xf86OutputCreate(pScrn, &radeon_output_funcs, "VGA-0");
+ }
} else
output = xf86OutputCreate(pScrn, &radeon_output_funcs, OutputType[radeon_output->type]);
}