summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2010-05-24 09:31:51 +1000
committerKeith Packard <keithp@keithp.com>2010-05-23 17:30:09 -0700
commit5939e39a641773a36c22104e1184143678dca7a2 (patch)
tree744f1038b843be72390779e5c5473f0c0061478e
parentb9f48d60bc0c839bd323c582231e8e7e2b810af6 (diff)
xf86: allow for no outputs connected at startup operation.
When nothing is connected at startup and we canGrow, allow the server to start with a 1024x768 framebuffer, and when the drivers send hotplug events this will expand to the correct size dynamically. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--hw/xfree86/modes/xf86Crtc.c61
1 files changed, 44 insertions, 17 deletions
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 8b9ec4149..065ba480c 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -48,2 +48,4 @@
+#define NO_OUTPUT_DEFAULT_WIDTH 1024
+#define NO_OUTPUT_DEFAULT_HEIGHT 768
/*
@@ -1925,3 +1927,3 @@ xf86SetScrnInfoModes (ScrnInfoPtr scrn)
-static void
+static Bool
xf86CollectEnabledOutputs(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
@@ -1940,4 +1942,6 @@ xf86CollectEnabledOutputs(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
for (o = 0; o < config->num_output; o++)
- enabled[o] = xf86OutputEnabled(config->output[o], FALSE);
+ any_enabled |= enabled[o] = xf86OutputEnabled(config->output[o], FALSE);
}
+
+ return any_enabled;
}
@@ -2341,2 +2345,4 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
int i = scrn->scrnIndex;
+ Bool have_outputs = TRUE;
+ Bool ret;
@@ -2366,14 +2372,19 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
- xf86CollectEnabledOutputs(scrn, config, enabled);
-
- if (xf86TargetUserpref(scrn, config, modes, enabled, width, height))
- xf86DrvMsg(i, X_INFO, "Using user preference for initial modes\n");
- else if (xf86TargetPreferred(scrn, config, modes, enabled, width, height))
- xf86DrvMsg(i, X_INFO, "Using exact sizes for initial modes\n");
- else if (xf86TargetAspect(scrn, config, modes, enabled, width, height))
- xf86DrvMsg(i, X_INFO, "Using fuzzy aspect match for initial modes\n");
- else if (xf86TargetFallback(scrn, config, modes, enabled, width, height))
- xf86DrvMsg(i, X_INFO, "Using sloppy heuristic for initial modes\n");
- else
- xf86DrvMsg(i, X_WARNING, "Unable to find initial modes\n");
+ ret = xf86CollectEnabledOutputs(scrn, config, enabled);
+ if (ret == FALSE && canGrow) {
+ xf86DrvMsg(i, X_WARNING, "Unable to find connected outputs - setting %dx%d initial framebuffer\n",
+ NO_OUTPUT_DEFAULT_WIDTH, NO_OUTPUT_DEFAULT_HEIGHT);
+ have_outputs = FALSE;
+ } else {
+ if (xf86TargetUserpref(scrn, config, modes, enabled, width, height))
+ xf86DrvMsg(i, X_INFO, "Using user preference for initial modes\n");
+ else if (xf86TargetPreferred(scrn, config, modes, enabled, width, height))
+ xf86DrvMsg(i, X_INFO, "Using exact sizes for initial modes\n");
+ else if (xf86TargetAspect(scrn, config, modes, enabled, width, height))
+ xf86DrvMsg(i, X_INFO, "Using fuzzy aspect match for initial modes\n");
+ else if (xf86TargetFallback(scrn, config, modes, enabled, width, height))
+ xf86DrvMsg(i, X_INFO, "Using sloppy heuristic for initial modes\n");
+ else
+ xf86DrvMsg(i, X_WARNING, "Unable to find initial modes\n");
+ }
@@ -2408,3 +2419,3 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
*/
- if (!xf86PickCrtcs (scrn, crtcs, modes, 0, width, height))
+ if (have_outputs && !xf86PickCrtcs (scrn, crtcs, modes, 0, width, height))
{
@@ -2470,2 +2481,9 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool 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;
+ }
+ }
+
scrn->display->virtualX = width;
@@ -2495,4 +2513,13 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
- /* Mirror output modes to scrn mode list */
- xf86SetScrnInfoModes (scrn);
+ if (have_outputs) {
+ /* Mirror output modes to scrn mode list */
+ xf86SetScrnInfoModes (scrn);
+ } else {
+ /* Clear any existing modes from scrn->modes */
+ while (scrn->modes != NULL)
+ xf86DeleteMode(&scrn->modes, scrn->modes);
+ scrn->modes = xf86ModesAdd(scrn->modes,
+ xf86CVTMode(width, height, 60, 0, 0));
+ }
+