summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Ritger <aritger@nvidia.com>2019-02-13 13:20:52 -0800
committerAdam Jackson <ajax@redhat.com>2019-03-06 11:33:29 -0500
commite51ebc18a7fb5b30213b3b5e743cba1f2e7a0e83 (patch)
tree7824f632527fedba70c79f919574b3112d017d08
parent7e046b9467784451769af3a03db46e3c690063b0 (diff)
xfree86/modes: Add "NoOutputInitialSize" option
Normally, the X server infers the initial screen size based on any connected outputs. However, if no outputs are connected, the X server picks a default screen size of 1024 x 768. This option overrides the default screen size to use when no outputs are connected. In contrast to the "Virtual" Display SubSection entry, which applies unconditionally, "NoOutputInitialSize" is only used if no outputs are detected when the X server starts. Parse this option in the new exported helper function xf86AssignNoOutputInitialSize(), so that other XFree86 loadable drivers can use it, even if they don't use xf86InitialConfiguration(). Signed-off-by: Andy Ritger <aritger@nvidia.com> Reviewed-by: Keith Packard <keithp@keithp.com>
-rw-r--r--hw/xfree86/man/xorg.conf.man11
-rw-r--r--hw/xfree86/modes/xf86Crtc.c42
-rw-r--r--hw/xfree86/modes/xf86Crtc.h4
3 files changed, 52 insertions, 5 deletions
diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man
index 2c18252b7..621787bc7 100644
--- a/hw/xfree86/man/xorg.conf.man
+++ b/hw/xfree86/man/xorg.conf.man
@@ -1494,6 +1494,17 @@ option.
Enable printing of additional debugging information about modesetting to
the server log.
.TP 7
+.BI "Option \*qNoOutputInitialSize\*q \*q" width " " height \*q
+Normally, the X server infers the initial screen size based on any
+connected outputs.
+However, if no outputs are connected, the X server picks a default screen size
+of 1024 x 768.
+This option overrides the default screen size to use when no outputs are
+connected.
+In contrast to the \*qVirtual\*q Display SubSection entry, which applies
+unconditionally, \*qNoOutputInitialSize\*q is only used if no outputs are
+detected when the X server starts.
+.TP 7
.BI "Option \*qPreferCloneMode\*q \*q" boolean \*q
If enabled, bring up monitors of a screen in clone mode instead of horizontal
extended layout by default. (Defaults to off; the video driver can change the
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 37a45bb3a..b3b84cc13 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -500,11 +500,13 @@ static OptionInfoRec xf86OutputOptions[] = {
enum {
OPTION_MODEDEBUG,
OPTION_PREFER_CLONEMODE,
+ OPTION_NO_OUTPUT_INITIAL_SIZE,
};
static OptionInfoRec xf86DeviceOptions[] = {
{OPTION_MODEDEBUG, "ModeDebug", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_PREFER_CLONEMODE, "PreferCloneMode", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_NO_OUTPUT_INITIAL_SIZE, "NoOutputInitialSize", OPTV_STRING, {0}, FALSE},
{-1, NULL, OPTV_NONE, {0}, FALSE},
};
@@ -2484,6 +2486,32 @@ xf86TargetUserpref(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
return FALSE;
}
+void
+xf86AssignNoOutputInitialSize(ScrnInfoPtr scrn, const OptionInfoRec *options,
+ int *no_output_width, int *no_output_height)
+{
+ int width = 0, height = 0;
+ const char *no_output_size =
+ xf86GetOptValString(options, OPTION_NO_OUTPUT_INITIAL_SIZE);
+
+ *no_output_width = NO_OUTPUT_DEFAULT_WIDTH;
+ *no_output_height = NO_OUTPUT_DEFAULT_HEIGHT;
+
+ if (no_output_size == NULL) {
+ return;
+ }
+
+ if (sscanf(no_output_size, "%d %d", &width, &height) != 2) {
+ xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+ "\"NoOutputInitialSize\" string \"%s\" not of form "
+ "\"width height\"\n", no_output_size);
+ return;
+ }
+
+ *no_output_width = width;
+ *no_output_height = height;
+}
+
/**
* Construct default screen configuration
*
@@ -2507,6 +2535,7 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow)
DisplayModePtr *modes;
Bool *enabled;
int width, height;
+ int no_output_width, no_output_height;
int i = scrn->scrnIndex;
Bool have_outputs = TRUE;
Bool ret;
@@ -2528,6 +2557,9 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow)
else
height = config->maxHeight;
+ xf86AssignNoOutputInitialSize(scrn, config->options,
+ &no_output_width, &no_output_height);
+
xf86ProbeOutputModes(scrn, width, height);
crtcs = xnfcalloc(config->num_output, sizeof(xf86CrtcPtr));
@@ -2540,7 +2572,7 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow)
xf86DrvMsg(i, X_WARNING,
"Unable to find connected outputs - setting %dx%d "
"initial framebuffer\n",
- NO_OUTPUT_DEFAULT_WIDTH, NO_OUTPUT_DEFAULT_HEIGHT);
+ no_output_width, no_output_height);
have_outputs = FALSE;
}
else {
@@ -2641,10 +2673,10 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow)
xf86DefaultScreenLimits(scrn, &width, &height, canGrow);
if (have_outputs == FALSE) {
- if (width < NO_OUTPUT_DEFAULT_WIDTH &&
- height < NO_OUTPUT_DEFAULT_HEIGHT) {
- width = NO_OUTPUT_DEFAULT_WIDTH;
- height = NO_OUTPUT_DEFAULT_HEIGHT;
+ if (width < no_output_width &&
+ height < no_output_height) {
+ width = no_output_width;
+ height = no_output_height;
}
}
diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
index 1d1124a1b..427c6bff4 100644
--- a/hw/xfree86/modes/xf86Crtc.h
+++ b/hw/xfree86/modes/xf86Crtc.h
@@ -964,6 +964,10 @@ extern _X_EXPORT void
extern _X_EXPORT ScreenInitRetType xf86CrtcScreenInit(ScreenPtr pScreen);
+extern _X_EXPORT void
+xf86AssignNoOutputInitialSize(ScrnInfoPtr scrn, const OptionInfoRec *options,
+ int *no_output_width, int *no_output_height);
+
extern _X_EXPORT Bool
xf86InitialConfiguration(ScrnInfoPtr pScrn, Bool canGrow);