summaryrefslogtreecommitdiff
path: root/src/sna/sna_driver.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-01-10 03:31:37 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-01-10 03:34:04 +0000
commit8a8edfe4076ee08558c76eddbb68426e4563888c (patch)
tree6690a8627084d306c7dad243462ad5c4b70f9e86 /src/sna/sna_driver.c
parent5449e16c0c2b6ca5af4acf42703164b9d2b2d822 (diff)
sna: Make sure all outputs are disabled if no CompatOutput is defined
If we have to fallback and the configuration is wonky, make sure that all known outputs are disabled as we takeover the console. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_driver.c')
-rw-r--r--src/sna/sna_driver.c50
1 files changed, 26 insertions, 24 deletions
diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index 86c05e4b..dff29010 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -148,38 +148,40 @@ static void
sna_set_fallback_mode(ScrnInfoPtr scrn)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- xf86OutputPtr output;
- xf86CrtcPtr crtc;
- DisplayModePtr mode;
+ xf86OutputPtr output = NULL;
+ xf86CrtcPtr crtc = NULL;
int n;
- if ((unsigned)config->compat_output >= config->num_output)
- return;
-
- output = config->output[config->compat_output];
- crtc = output->crtc;
+ if ((unsigned)config->compat_output < config->num_output) {
+ output = config->output[config->compat_output];
+ crtc = output->crtc;
+ }
for (n = 0; n < config->num_output; n++)
config->output[n]->crtc = NULL;
for (n = 0; n < config->num_crtc; n++)
config->crtc[n]->enabled = FALSE;
- output->crtc = crtc;
-
- mode = xf86OutputFindClosestMode(output, scrn->currentMode);
- if (mode &&
- xf86CrtcSetModeTransform(crtc, mode, RR_Rotate_0, NULL, 0, 0)) {
- crtc->desiredMode = *mode;
- crtc->desiredMode.prev = crtc->desiredMode.next = NULL;
- crtc->desiredMode.name = NULL;
- crtc->desiredMode.PrivSize = 0;
- crtc->desiredMode.PrivFlags = 0;
- crtc->desiredMode.Private = NULL;
- crtc->desiredRotation = RR_Rotate_0;
- crtc->desiredTransformPresent = FALSE;
- crtc->desiredX = 0;
- crtc->desiredY = 0;
- crtc->enabled = TRUE;
+ if (output && crtc) {
+ DisplayModePtr mode;
+
+ output->crtc = crtc;
+
+ mode = xf86OutputFindClosestMode(output, scrn->currentMode);
+ if (mode &&
+ xf86CrtcSetModeTransform(crtc, mode, RR_Rotate_0, NULL, 0, 0)) {
+ crtc->desiredMode = *mode;
+ crtc->desiredMode.prev = crtc->desiredMode.next = NULL;
+ crtc->desiredMode.name = NULL;
+ crtc->desiredMode.PrivSize = 0;
+ crtc->desiredMode.PrivFlags = 0;
+ crtc->desiredMode.Private = NULL;
+ crtc->desiredRotation = RR_Rotate_0;
+ crtc->desiredTransformPresent = FALSE;
+ crtc->desiredX = 0;
+ crtc->desiredY = 0;
+ crtc->enabled = TRUE;
+ }
}
xf86DisableUnusedFunctions(scrn);