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
@@ -46,6 +46,8 @@
46 46
47#include "xf86xv.h" 47#include "xf86xv.h"
48 48
49#define NO_OUTPUT_DEFAULT_WIDTH 1024
50#define NO_OUTPUT_DEFAULT_HEIGHT 768
49/* 51/*
50 * Initialize xf86CrtcConfig structure 52 * Initialize xf86CrtcConfig structure
51 */ 53 */
@@ -1923,7 +1925,7 @@ xf86SetScrnInfoModes (ScrnInfoPtr scrn)
1923#endif 1925#endif
1924} 1926}
1925 1927
1926static void 1928static Bool
1927xf86CollectEnabledOutputs(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, 1929xf86CollectEnabledOutputs(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
1928 Bool *enabled) 1930 Bool *enabled)
1929{ 1931{
@@ -1938,8 +1940,10 @@ xf86CollectEnabledOutputs(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
1938 "No outputs definitely connected, trying again...\n"); 1940 "No outputs definitely connected, trying again...\n");
1939 1941
1940 for (o = 0; o < config->num_output; o++) 1942 for (o = 0; o < config->num_output; o++)
1941 enabled[o] = xf86OutputEnabled(config->output[o], FALSE); 1943 any_enabled |= enabled[o] = xf86OutputEnabled(config->output[o], FALSE);
1942 } 1944 }
1945
1946 return any_enabled;
1943} 1947}
1944 1948
1945static Bool 1949static Bool
@@ -2339,6 +2343,8 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
2339 Bool *enabled; 2343 Bool *enabled;
2340 int width, height; 2344 int width, height;
2341 int i = scrn->scrnIndex; 2345 int i = scrn->scrnIndex;
2346 Bool have_outputs = TRUE;
2347 Bool ret;
2342 2348
2343 /* Set up the device options */ 2349 /* Set up the device options */
2344 config->options = xnfalloc (sizeof (xf86DeviceOptions)); 2350 config->options = xnfalloc (sizeof (xf86DeviceOptions));
@@ -2364,18 +2370,23 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
2364 modes = xnfcalloc (config->num_output, sizeof (DisplayModePtr)); 2370 modes = xnfcalloc (config->num_output, sizeof (DisplayModePtr));
2365 enabled = xnfcalloc (config->num_output, sizeof (Bool)); 2371 enabled = xnfcalloc (config->num_output, sizeof (Bool));
2366 2372
2367 xf86CollectEnabledOutputs(scrn, config, enabled); 2373 ret = xf86CollectEnabledOutputs(scrn, config, enabled);
2368 2374 if (ret == FALSE && canGrow) {
2369 if (xf86TargetUserpref(scrn, config, modes, enabled, width, height)) 2375 xf86DrvMsg(i, X_WARNING, "Unable to find connected outputs - setting %dx%d initial framebuffer\n",
2370 xf86DrvMsg(i, X_INFO, "Using user preference for initial modes\n"); 2376 NO_OUTPUT_DEFAULT_WIDTH, NO_OUTPUT_DEFAULT_HEIGHT);
2371 else if (xf86TargetPreferred(scrn, config, modes, enabled, width, height)) 2377 have_outputs = FALSE;
2372 xf86DrvMsg(i, X_INFO, "Using exact sizes for initial modes\n"); 2378 } else {
2373 else if (xf86TargetAspect(scrn, config, modes, enabled, width, height)) 2379 if (xf86TargetUserpref(scrn, config, modes, enabled, width, height))
2374 xf86DrvMsg(i, X_INFO, "Using fuzzy aspect match for initial modes\n"); 2380 xf86DrvMsg(i, X_INFO, "Using user preference for initial modes\n");
2375 else if (xf86TargetFallback(scrn, config, modes, enabled, width, height)) 2381 else if (xf86TargetPreferred(scrn, config, modes, enabled, width, height))
2376 xf86DrvMsg(i, X_INFO, "Using sloppy heuristic for initial modes\n"); 2382 xf86DrvMsg(i, X_INFO, "Using exact sizes for initial modes\n");
2377 else 2383 else if (xf86TargetAspect(scrn, config, modes, enabled, width, height))
2378 xf86DrvMsg(i, X_WARNING, "Unable to find initial modes\n"); 2384 xf86DrvMsg(i, X_INFO, "Using fuzzy aspect match for initial modes\n");
2385 else if (xf86TargetFallback(scrn, config, modes, enabled, width, height))
2386 xf86DrvMsg(i, X_INFO, "Using sloppy heuristic for initial modes\n");
2387 else
2388 xf86DrvMsg(i, X_WARNING, "Unable to find initial modes\n");
2389 }
2379 2390
2380 for (o = -1; nextEnabledOutput(config, enabled, &o); ) { 2391 for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
2381 if (!modes[o]) 2392 if (!modes[o])
@@ -2406,7 +2417,7 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
2406 /* 2417 /*
2407 * Assign CRTCs to fit output configuration 2418 * Assign CRTCs to fit output configuration
2408 */ 2419 */
2409 if (!xf86PickCrtcs (scrn, crtcs, modes, 0, width, height)) 2420 if (have_outputs && !xf86PickCrtcs (scrn, crtcs, modes, 0, width, height))
2410 { 2421 {
2411 free(crtcs); 2422 free(crtcs);
2412 free(modes); 2423 free(modes);
@@ -2468,6 +2479,13 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
2468 */ 2479 */
2469 xf86DefaultScreenLimits (scrn, &width, &height, canGrow); 2480 xf86DefaultScreenLimits (scrn, &width, &height, canGrow);
2470 2481
2482 if (have_outputs == FALSE) {
2483 if (width < NO_OUTPUT_DEFAULT_WIDTH && height < NO_OUTPUT_DEFAULT_HEIGHT) {
2484 width = NO_OUTPUT_DEFAULT_WIDTH;
2485 height = NO_OUTPUT_DEFAULT_HEIGHT;
2486 }
2487 }
2488
2471 scrn->display->virtualX = width; 2489 scrn->display->virtualX = width;
2472 scrn->display->virtualY = height; 2490 scrn->display->virtualY = height;
2473 } 2491 }
@@ -2493,8 +2511,17 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
2493 width, height); 2511 width, height);
2494 } 2512 }
2495 2513
2496 /* Mirror output modes to scrn mode list */ 2514 if (have_outputs) {
2497 xf86SetScrnInfoModes (scrn); 2515 /* Mirror output modes to scrn mode list */
2516 xf86SetScrnInfoModes (scrn);
2517 } else {
2518 /* Clear any existing modes from scrn->modes */
2519 while (scrn->modes != NULL)
2520 xf86DeleteMode(&scrn->modes, scrn->modes);
2521 scrn->modes = xf86ModesAdd(scrn->modes,
2522 xf86CVTMode(width, height, 60, 0, 0));
2523 }
2524
2498 2525
2499 free(crtcs); 2526 free(crtcs);
2500 free(modes); 2527 free(modes);