diff options
author | Keith Packard <keithp@neko.keithp.com> | 2007-02-01 21:30:19 -0800 |
---|---|---|
committer | Keith Packard <keithp@neko.keithp.com> | 2007-02-01 21:30:19 -0800 |
commit | 16f30b2e6c72e228c66946ff9efadd7278379745 (patch) | |
tree | bc80b294026fc48eee8ca863e23085072e7a1655 | |
parent | 9f0acf1eb01ad8320f4da4cc5e498af25c0ecc5e (diff) |
Add "Ignore" option to per-output monitor, removes output from server.
Setting option "Ignore" "Yes" will cause the server to pretend as if the
specified output does not exist at all. It will not be listed by the
RandR1.2 extension, and the server will not attempt to detect monitors at
startup time.
-rw-r--r-- | src/i830_sdvo.c | 3 | ||||
-rw-r--r-- | src/i830_xf86Crtc.c | 48 |
2 files changed, 40 insertions, 11 deletions
diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c index ea62ad96..46a35f1c 100644 --- a/src/i830_sdvo.c +++ b/src/i830_sdvo.c @@ -1079,8 +1079,7 @@ i830_sdvo_init(ScrnInfoPtr pScrn, int output_device) char *name_prefix; char *name_suffix; - output = xf86OutputCreate (pScrn, &i830_sdvo_output_funcs, - "ADD2 PCIE card"); + output = xf86OutputCreate (pScrn, &i830_sdvo_output_funcs,NULL); if (!output) return; intel_output = xnfcalloc (sizeof (I830OutputPrivateRec) + diff --git a/src/i830_xf86Crtc.c b/src/i830_xf86Crtc.c index a2099149..0ea0cedd 100644 --- a/src/i830_xf86Crtc.c +++ b/src/i830_xf86Crtc.c @@ -273,6 +273,7 @@ typedef enum { OPTION_DISABLE, OPTION_MIN_CLOCK, OPTION_MAX_CLOCK, + OPTION_IGNORE, } OutputOpts; static OptionInfoRec xf86OutputOptions[] = { @@ -286,6 +287,7 @@ static OptionInfoRec xf86OutputOptions[] = { {OPTION_DISABLE, "Disable", OPTV_BOOLEAN, {0}, FALSE }, {OPTION_MIN_CLOCK, "MinClock", OPTV_FREQ, {0}, FALSE }, {OPTION_MAX_CLOCK, "MaxClock", OPTV_FREQ, {0}, FALSE }, + {OPTION_IGNORE, "Ignore", OPTV_BOOLEAN, {0}, FALSE }, {-1, NULL, OPTV_NONE, {0}, FALSE }, }; @@ -296,6 +298,9 @@ xf86OutputSetMonitor (xf86OutputPtr output) static const char monitor_prefix[] = "monitor-"; char *monitor; + if (!output->name) + return; + if (output->options) xfree (output->options); @@ -332,6 +337,12 @@ xf86OutputEnabled (xf86OutputPtr output) return TRUE; } +static Bool +xf86OutputIgnored (xf86OutputPtr output) +{ + return xf86ReturnOptValBool (output->options, OPTION_IGNORE, FALSE); +} + xf86OutputPtr xf86OutputCreate (ScrnInfoPtr scrn, const xf86OutputFuncsRec *funcs, @@ -339,20 +350,37 @@ xf86OutputCreate (ScrnInfoPtr scrn, { xf86OutputPtr output, *outputs; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); - int len = strlen (name); + int len; + + if (name) + len = strlen (name) + 1; + else + len = 0; - output = xcalloc (sizeof (xf86OutputRec) + len + 1, 1); + output = xcalloc (sizeof (xf86OutputRec) + len, 1); if (!output) return NULL; output->scrn = scrn; output->funcs = funcs; - output->name = (char *) (output + 1); + if (name) + { + output->name = (char *) (output + 1); + strcpy (output->name, name); + } output->subpixel_order = SubPixelUnknown; - strcpy (output->name, name); #ifdef RANDR_12_INTERFACE output->randr_output = NULL; #endif - xf86OutputSetMonitor (output); + if (name) + { + xf86OutputSetMonitor (output); + if (xf86OutputIgnored (output)) + { + xfree (output); + return FALSE; + } + } + if (xf86_config->output) outputs = xrealloc (xf86_config->output, @@ -374,17 +402,19 @@ xf86OutputCreate (ScrnInfoPtr scrn, Bool xf86OutputRename (xf86OutputPtr output, const char *name) { - int len = strlen(name); - char *newname = xalloc (len + 1); + int len = strlen(name) + 1; + char *newname = xalloc (len); if (!newname) return FALSE; /* so sorry... */ strcpy (newname, name); - if (output->name != (char *) (output + 1)) + if (output->name && output->name != (char *) (output + 1)) xfree (output->name); output->name = newname; xf86OutputSetMonitor (output); + if (xf86OutputIgnored (output)) + return FALSE; return TRUE; } @@ -407,7 +437,7 @@ xf86OutputDestroy (xf86OutputPtr output) xf86_config->num_output--; break; } - if (output->name != (char *) (output + 1)) + if (output->name && output->name != (char *) (output + 1)) xfree (output->name); xfree (output); } |