diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2010-02-17 12:22:48 -0500 |
---|---|---|
committer | Alex Deucher <alexdeucher@gmail.com> | 2010-02-17 12:34:53 -0500 |
commit | 579cdcf9b4e38c791a497b747a055fc0a07d8dd6 (patch) | |
tree | ecb395794693564fcc77a9d77c2ab62777241f84 /src/radeon_driver.c | |
parent | 47136fa347d1756523239746b4c74cd5278a1118 (diff) |
radeon: add ZaphodHeads option
Allows users that want to use zaphod mode to select
which xrandr outputs are assigned to which head. E.g.,
Option "ZaphodHeads" "LVDS,VGA-0"
will assign LVDS to the first zaphod driver instance
and VGA-0 to the second instance.
Diffstat (limited to 'src/radeon_driver.c')
-rw-r--r-- | src/radeon_driver.c | 63 |
1 files changed, 57 insertions, 6 deletions
diff --git a/src/radeon_driver.c b/src/radeon_driver.c index c4d2ef5c..c97be4f9 100644 --- a/src/radeon_driver.c +++ b/src/radeon_driver.c @@ -206,6 +206,7 @@ static const OptionInfoRec RADEONOptions[] = { { OPTION_FORCE_LOW_POWER, "ForceLowPowerMode", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_DYNAMIC_PM, "DynamicPM", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_NEW_PLL, "NewPLL", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_ZAPHOD_HEADS, "ZaphodHeads", OPTV_STRING, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -2786,19 +2787,69 @@ RADEONPreInitBIOS(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) return TRUE; } +Bool +RADEONZaphodStringMatches(ScrnInfoPtr pScrn, Bool is_primary, + const char *s, char *output_name) +{ + int i = 0, second = 0; + char s1[20], s2[20]; + + do { + switch(*s) { + case ',': + s1[i] = '\0'; + i = 0; + second = 1; + break; + case ' ': + case '\t': + case '\n': + case '\r': + break; + default: + if (second) + s2[i] = *s; + else + s1[i] = *s; + i++; + break; + } + } while(*s++); + s2[i] = '\0'; + + if (is_primary) { + if (strcmp(s1, output_name) == 0) + return TRUE; + } else { + if (strcmp(s2, output_name) == 0) + return TRUE; + } + + return FALSE; +} + static void RADEONFixZaphodOutputs(ScrnInfoPtr pScrn) { RADEONInfoPtr info = RADEONPTR(pScrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); + int o; + char *s; - if (info->IsPrimary) { - xf86OutputDestroy(config->output[0]); - while(config->num_output > 1) { - xf86OutputDestroy(config->output[1]); + if ((s = xf86GetOptValString(info->Options, OPTION_ZAPHOD_HEADS))) { + for (o = 0; o < config->num_output; o++) { + if (!RADEONZaphodStringMatches(pScrn, info->IsPrimary, s, config->output[o]->name)) + xf86OutputDestroy(config->output[o]); } } else { - while(config->num_output > 1) { - xf86OutputDestroy(config->output[1]); + if (info->IsPrimary) { + xf86OutputDestroy(config->output[0]); + while(config->num_output > 1) { + xf86OutputDestroy(config->output[1]); + } + } else { + while(config->num_output > 1) { + xf86OutputDestroy(config->output[1]); + } } } } |