From 8a8edfe4076ee08558c76eddbb68426e4563888c Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 10 Jan 2013 03:31:37 +0000 Subject: [PATCH] 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 --- src/sna/sna_driver.c | 48 +++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 23 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; + if (output && crtc) { + DisplayModePtr mode; - 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; + 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);