]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blob - xorg-x11-server/patches/xserver-1.8-no-connected-outputs.patch
3ee85424354cb5b68d20bf4222274119969d34e1
[people/ms/ipfire-3.x.git] / xorg-x11-server / patches / xserver-1.8-no-connected-outputs.patch
1 From b27f93c6dbe0a6e416db2c65738e996c70a403c1 Mon Sep 17 00:00:00 2001
2 From: Fedora X Ninjas <airlied@redhat.com>
3 Date: Thu, 6 May 2010 12:55:34 +1000
4 Subject: [PATCH] xf86: allow for no outputs connected at startup operation.
5
6 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.
7
8 Signed-off-by: Dave Airlie <airlied@redhat.com>
9 ---
10 hw/xfree86/modes/xf86Crtc.c | 66 ++++++++++++++++++++++++++++++------------
11 1 files changed, 47 insertions(+), 19 deletions(-)
12
13 diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
14 index 571ffd0..99082ec 100644
15 --- a/hw/xfree86/modes/xf86Crtc.c
16 +++ b/hw/xfree86/modes/xf86Crtc.c
17 @@ -48,6 +48,8 @@
18
19 #include "xf86xv.h"
20
21 +#define NO_OUTPUT_DEFAULT_WIDTH 1024
22 +#define NO_OUTPUT_DEFAULT_HEIGHT 768
23 /*
24 * Initialize xf86CrtcConfig structure
25 */
26 @@ -1946,7 +1948,7 @@ xf86SetScrnInfoModes (ScrnInfoPtr scrn)
27 #endif
28 }
29
30 -static void
31 +static Bool
32 xf86CollectEnabledOutputs(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
33 Bool *enabled)
34 {
35 @@ -1961,8 +1963,10 @@ xf86CollectEnabledOutputs(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
36 "No outputs definitely connected, trying again...\n");
37
38 for (o = 0; o < config->num_output; o++)
39 - enabled[o] = xf86OutputEnabled(config->output[o], FALSE);
40 + any_enabled |= enabled[o] = xf86OutputEnabled(config->output[o], FALSE);
41 }
42 +
43 + return any_enabled;
44 }
45
46 static Bool
47 @@ -2409,6 +2413,8 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
48 Bool *enabled;
49 int width, height;
50 int i = scrn->scrnIndex;
51 + Bool have_outputs = TRUE;
52 + Bool ret;
53
54 /* Set up the device options */
55 config->options = xnfalloc (sizeof (xf86DeviceOptions));
56 @@ -2433,20 +2439,26 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
57 modes = xnfcalloc (config->num_output, sizeof (DisplayModePtr));
58 enabled = xnfcalloc (config->num_output, sizeof (Bool));
59
60 - xf86CollectEnabledOutputs(scrn, config, enabled);
61 -
62 - if (xf86TargetUserpref(scrn, config, modes, enabled, width, height))
63 - xf86DrvMsg(i, X_INFO, "Using user preference for initial modes\n");
64 - else if (xf86TargetRightOf(scrn, config, modes, enabled, width, height))
65 - xf86DrvMsg(i, X_INFO, "Using spanning desktop for initial modes\n");
66 - else if (xf86TargetPreferred(scrn, config, modes, enabled, width, height))
67 - xf86DrvMsg(i, X_INFO, "Using exact sizes for initial modes\n");
68 - else if (xf86TargetAspect(scrn, config, modes, enabled, width, height))
69 - xf86DrvMsg(i, X_INFO, "Using fuzzy aspect match for initial modes\n");
70 - else if (xf86TargetFallback(scrn, config, modes, enabled, width, height))
71 - xf86DrvMsg(i, X_INFO, "Using sloppy heuristic for initial modes\n");
72 - else
73 - xf86DrvMsg(i, X_WARNING, "Unable to find initial modes\n");
74 + ret = xf86CollectEnabledOutputs(scrn, config, enabled);
75 + if (ret == FALSE && canGrow) {
76 + xf86DrvMsg(i, X_WARNING, "Unable to find connected outputs - setting %dx%d initial framebuffer\n",
77 + NO_OUTPUT_DEFAULT_WIDTH, NO_OUTPUT_DEFAULT_HEIGHT);
78 + have_outputs = FALSE;
79 + }
80 + else {
81 + if (xf86TargetUserpref(scrn, config, modes, enabled, width, height))
82 + xf86DrvMsg(i, X_INFO, "Using user preference for initial modes\n");
83 + else if (xf86TargetRightOf(scrn, config, modes, enabled, width, height))
84 + xf86DrvMsg(i, X_INFO, "Using spanning desktop for initial modes\n");
85 + else if (xf86TargetPreferred(scrn, config, modes, enabled, width, height))
86 + xf86DrvMsg(i, X_INFO, "Using exact sizes for initial modes\n");
87 + else if (xf86TargetAspect(scrn, config, modes, enabled, width, height))
88 + xf86DrvMsg(i, X_INFO, "Using fuzzy aspect match for initial modes\n");
89 + else if (xf86TargetFallback(scrn, config, modes, enabled, width, height))
90 + xf86DrvMsg(i, X_INFO, "Using sloppy heuristic for initial modes\n");
91 + else
92 + xf86DrvMsg(i, X_WARNING, "Unable to find initial modes\n");
93 + }
94
95 for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
96 if (!modes[o])
97 @@ -2479,7 +2491,7 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
98 /*
99 * Assign CRTCs to fit output configuration
100 */
101 - if (!xf86PickCrtcs (scrn, crtcs, modes, 0, width, height))
102 + if (have_outputs && !xf86PickCrtcs (scrn, crtcs, modes, 0, width, height))
103 {
104 xfree (crtcs);
105 xfree (modes);
106 @@ -2541,6 +2553,13 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
107 */
108 xf86DefaultScreenLimits (scrn, &width, &height, canGrow);
109
110 + if (have_outputs == FALSE) {
111 + if (width < NO_OUTPUT_DEFAULT_WIDTH && height < NO_OUTPUT_DEFAULT_HEIGHT) {
112 + width = NO_OUTPUT_DEFAULT_WIDTH;
113 + height = NO_OUTPUT_DEFAULT_HEIGHT;
114 + }
115 + }
116 +
117 scrn->display->virtualX = width;
118 scrn->display->virtualY = height;
119 }
120 @@ -2566,8 +2585,17 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
121 width, height);
122 }
123
124 - /* Mirror output modes to scrn mode list */
125 - xf86SetScrnInfoModes (scrn);
126 + if (have_outputs) {
127 + /* Mirror output modes to scrn mode list */
128 + xf86SetScrnInfoModes (scrn);
129 + } else {
130 + /* Clear any existing modes from scrn->modes */
131 + while (scrn->modes != NULL)
132 + xf86DeleteMode(&scrn->modes, scrn->modes);
133 + scrn->modes = xf86ModesAdd(scrn->modes,
134 + xf86CVTMode(width, height, 60, 0, 0));
135 + }
136 +
137
138 xfree (crtcs);
139 xfree (modes);
140 --
141 1.7.0.1
142