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 | |
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')
-rw-r--r-- | src/drmmode_display.c | 9 | ||||
-rw-r--r-- | src/radeon.h | 6 | ||||
-rw-r--r-- | src/radeon_driver.c | 63 | ||||
-rw-r--r-- | src/radeon_kms.c | 10 |
4 files changed, 77 insertions, 11 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c index b7a62189..bb29c251 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -854,6 +854,7 @@ const char *output_names[] = { "None", static void drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num) { + RADEONInfoPtr info = RADEONPTR(pScrn); xf86OutputPtr output; drmModeConnectorPtr koutput; drmModeEncoderPtr *kencoders = NULL; @@ -861,6 +862,7 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num) drmModePropertyPtr props; char name[32]; int i; + const char *s; koutput = drmModeGetConnector(drmmode->fd, drmmode->mode_res->connectors[num]); if (!koutput) @@ -870,7 +872,7 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num) if (!kencoders) { goto out_free_encoders; } - + for (i = 0; i < koutput->count_encoders; i++) { kencoders[i] = drmModeGetEncoder(drmmode->fd, koutput->encoders[i]); if (!kencoders[i]) { @@ -897,6 +899,11 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num) snprintf(name, 32, "%s-%d", output_names[koutput->connector_type], koutput->connector_type_id - 1); } + if ((s = xf86GetOptValString(info->Options, OPTION_ZAPHOD_HEADS))) { + if (!RADEONZaphodStringMatches(pScrn, info->IsPrimary, s, name)) + goto out_free_encoders; + } + output = xf86OutputCreate (pScrn, &drmmode_output_funcs, name); if (!output) { goto out_free_encoders; diff --git a/src/radeon.h b/src/radeon.h index f9c78ab2..36b2d8be 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -223,7 +223,8 @@ typedef enum { OPTION_R4XX_ATOM, OPTION_FORCE_LOW_POWER, OPTION_DYNAMIC_PM, - OPTION_NEW_PLL + OPTION_NEW_PLL, + OPTION_ZAPHOD_HEADS } RADEONOpts; @@ -1236,6 +1237,9 @@ extern void RADEONInitMemMapRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save, RADEONInfoPtr info); extern void RADEONRestoreMemMapRegisters(ScrnInfoPtr pScrn, RADEONSavePtr restore); +extern Bool +RADEONZaphodStringMatches(ScrnInfoPtr pScrn, Bool is_primary, + const char *s, char *output_name); Bool RADEONGetRec(ScrnInfoPtr pScrn); void RADEONFreeRec(ScrnInfoPtr pScrn); 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]); + } } } } diff --git a/src/radeon_kms.c b/src/radeon_kms.c index e9e5b5d6..00cea421 100644 --- a/src/radeon_kms.c +++ b/src/radeon_kms.c @@ -66,9 +66,10 @@ const OptionInfoRec RADEONOptions_KMS[] = { { OPTION_SUBPIXEL_ORDER, "SubPixelOrder", OPTV_ANYSTR, {0}, FALSE }, { OPTION_ACCELMETHOD, "AccelMethod", OPTV_STRING, {0}, FALSE }, { OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_TVSTD, "TVStandard", OPTV_STRING, {0}, FALSE }, - { OPTION_EXA_VSYNC, "EXAVSync", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_EXA_PIXMAPS, "EXAPixmaps", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_TVSTD, "TVStandard", OPTV_STRING, {0}, FALSE }, + { OPTION_EXA_VSYNC, "EXAVSync", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_EXA_PIXMAPS, "EXAPixmaps", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_ZAPHOD_HEADS, "ZaphodHeads", OPTV_STRING, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -369,6 +370,7 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags) int zaphod_mask = 0; char *bus_id; Gamma zeros = { 0.0, 0.0, 0.0 }; + const char *s; xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, "RADEONPreInit_KMS\n"); @@ -430,6 +432,8 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags) zaphod_mask = 0xd; if (info->IsSecondary) zaphod_mask = 0x2; + if ((s = xf86GetOptValString(info->Options, OPTION_ZAPHOD_HEADS))) + zaphod_mask = 0xf; info->allowColorTiling = xf86ReturnOptValBool(info->Options, OPTION_COLOR_TILING, FALSE); |