From 433c8617341f5768255826435a2b09afba684f02 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Thu, 25 Feb 2010 21:03:13 -0500 Subject: update ZaphodHeads option Now that the screen section mapping is fixed, Make the option per-instance and allow multiple outputs to be specified; e.g., DVI-0 and HDMI-0 associated with instance 0 and LVDS and VGA-0 associated with instance 1. --- man/radeon.man | 8 ++++---- src/drmmode_display.c | 2 +- src/radeon.h | 3 +-- src/radeon_driver.c | 39 ++++++++++++--------------------------- 4 files changed, 18 insertions(+), 34 deletions(-) diff --git a/man/radeon.man b/man/radeon.man index ca8ce60d..05b7d164 100644 --- a/man/radeon.man +++ b/man/radeon.man @@ -616,14 +616,14 @@ The default is .B on with > 32MB VRAM, off with < 32MB. .TP .BI "Option \*qZaphodHeads\*q \*q" string \*q -Specify the randr outputs to use with zaphod mode. If you do not specify -an outputs, the driver will pick them automatically. +Specify the randr output(s) to use with zaphod mode for a particular driver +instance. If you use this option you most use this option for all instances +of the driver. .br For example: .B Option \*qZaphodHeads\*q \*qLVDS,VGA-0\*q -will assign xrandr output LVDS to the first instance of the driver and -VGA-0 to the second instance. +will assign xrandr outputs LVDS and VGA-0 to this instance of the driver. .SH TEXTURED VIDEO ATTRIBUTES The driver supports the following X11 Xv attributes for Textured Video. diff --git a/src/drmmode_display.c b/src/drmmode_display.c index bb219cf9..ed3d9275 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -900,7 +900,7 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num) } if ((s = xf86GetOptValString(info->Options, OPTION_ZAPHOD_HEADS))) { - if (!RADEONZaphodStringMatches(pScrn, info->IsPrimary, s, name)) + if (!RADEONZaphodStringMatches(pScrn, s, name)) goto out_free_encoders; } diff --git a/src/radeon.h b/src/radeon.h index c0b5d7aa..56695f91 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -1231,8 +1231,7 @@ extern void RADEONInitMemMapRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save, extern void RADEONRestoreMemMapRegisters(ScrnInfoPtr pScrn, RADEONSavePtr restore); extern Bool -RADEONZaphodStringMatches(ScrnInfoPtr pScrn, Bool is_primary, - const char *s, char *output_name); +RADEONZaphodStringMatches(ScrnInfoPtr pScrn, 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 9a4cb9a5..e11c5e96 100644 --- a/src/radeon_driver.c +++ b/src/radeon_driver.c @@ -2788,18 +2788,18 @@ RADEONPreInitBIOS(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) } Bool -RADEONZaphodStringMatches(ScrnInfoPtr pScrn, Bool is_primary, - const char *s, char *output_name) +RADEONZaphodStringMatches(ScrnInfoPtr pScrn, const char *s, char *output_name) { - int i = 0, second = 0; - char s1[20], s2[20]; + int i = 0; + char s1[20]; do { switch(*s) { case ',': s1[i] = '\0'; i = 0; - second = 1; + if (strcmp(s1, output_name) == 0) + return TRUE; break; case ' ': case '\t': @@ -2807,23 +2807,15 @@ RADEONZaphodStringMatches(ScrnInfoPtr pScrn, Bool is_primary, case '\r': break; default: - if (second) - s2[i] = *s; - else - s1[i] = *s; + 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; - } + s1[i] = '\0'; + if (strcmp(s1, output_name) == 0) + return TRUE; return FALSE; } @@ -2832,20 +2824,13 @@ static void RADEONFixZaphodOutputs(ScrnInfoPtr pScrn) { RADEONInfoPtr info = RADEONPTR(pScrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); - xf86OutputPtr output; int o; char *s; 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)) - output = config->output[o]; - } - while (config->num_output > 1) { - if (config->output[0] != output) - xf86OutputDestroy(config->output[0]); - else if (config->output[1] != output) - xf86OutputDestroy(config->output[1]); + for (o = config->num_output; o > 0; o--) { + if (!RADEONZaphodStringMatches(pScrn, s, config->output[o - 1]->name)) + xf86OutputDestroy(config->output[o - 1]); } } else { if (info->IsPrimary) { -- cgit v1.2.3