summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-08-10 19:44:00 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-08-10 19:44:00 +0100
commit6f3999f38c71689298ac44e5b64830f754199740 (patch)
treeeb2b457a486197c4f6ac693703a258b0d9222eaa /src
parent6cd366b79ad15be608f829e884b4880c311cf58b (diff)
sna: Avoid confusing conflicting CRTC probes vs a DRM race
Only bail we fail to find the CRTC for this output amongst the allowed set for this ZaphodHead - but allow us to find an invalid CRTC. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/sna/sna_display.c78
1 files changed, 35 insertions, 43 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index ad93d046..e2bebada 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -3033,27 +3033,17 @@ static bool sna_probe_initial_configuration(struct sna *sna)
continue;
DBG(("%s: CRTC:%d, pipe=%d: has mode?=%d\n", __FUNCTION__,
- sna_crtc->id, sna_crtc->pipe, mode.mode_valid));
+ sna_crtc->id, sna_crtc->pipe,
+ mode.mode_valid && mode.mode.clock));
+
if (!mode.mode_valid || mode.mode.clock == 0)
continue;
- memset(&crtc->desiredMode, 0, sizeof(crtc->desiredMode));
mode_from_kmode(scrn, &mode.mode, &crtc->desiredMode);
crtc->desiredRotation = RR_Rotate_0;
crtc->desiredX = mode.x;
crtc->desiredY = mode.y;
crtc->desiredTransformPresent = FALSE;
-
- crtc->mode = crtc->desiredMode;
- crtc->mode.name = NULL;
- crtc->x = mode.x;
- crtc->y = mode.y;
- crtc->rotation = RR_Rotate_0;
- crtc->transformPresent = FALSE;
-
- memset(&crtc->panningTotalArea, 0, sizeof(BoxRec));
- memset(&crtc->panningTrackingArea, 0, sizeof(BoxRec));
- memset(crtc->panningBorder, 0, 4 * sizeof(INT16));
}
/* Reconstruct outputs pointing to active CRTC */
@@ -3072,40 +3062,42 @@ static bool sna_probe_initial_configuration(struct sna *sna)
for (j = 0; j < config->num_crtc; j++) {
xf86CrtcPtr crtc = config->crtc[j];
- if (to_sna_crtc(crtc)->id == crtc_id) {
- if (crtc->desiredMode.status == MODE_OK) {
- DisplayModePtr M;
-
- xf86DrvMsg(scrn->scrnIndex, X_PROBED,
- "Output %s using initial mode %s on pipe %d\n",
- output->name,
- crtc->desiredMode.name,
- to_sna_crtc(crtc)->pipe);
-
- output->crtc = crtc;
- crtc->enabled = TRUE;
-
- if (output->mm_width == 0 ||
- output->mm_height == 0) {
- output->mm_height = (crtc->desiredMode.VDisplay * 254) / (10*DEFAULT_DPI);
- output->mm_width = (crtc->desiredMode.HDisplay * 254) / (10*DEFAULT_DPI);
- }
-
- set_initial_gamma(output, crtc);
-
- M = calloc(1, sizeof(DisplayModeRec));
- if (M) {
- *M = crtc->desiredMode;
- M->name = strdup(M->name);
- output->probed_modes =
- xf86ModesAdd(output->probed_modes, M);
- }
+ if (to_sna_crtc(crtc)->id != crtc_id)
+ continue;
+
+ if (crtc->desiredMode.status == MODE_OK) {
+ DisplayModePtr M;
+
+ xf86DrvMsg(scrn->scrnIndex, X_PROBED,
+ "Output %s using initial mode %s on pipe %d\n",
+ output->name,
+ crtc->desiredMode.name,
+ to_sna_crtc(crtc)->pipe);
+
+ output->crtc = crtc;
+ crtc->enabled = TRUE;
+
+ if (output->mm_width == 0 ||
+ output->mm_height == 0) {
+ output->mm_height = (crtc->desiredMode.VDisplay * 254) / (10*DEFAULT_DPI);
+ output->mm_width = (crtc->desiredMode.HDisplay * 254) / (10*DEFAULT_DPI);
+ }
+
+ set_initial_gamma(output, crtc);
+
+ M = calloc(1, sizeof(DisplayModeRec));
+ if (M) {
+ *M = crtc->desiredMode;
+ M->name = strdup(M->name);
+ output->probed_modes =
+ xf86ModesAdd(output->probed_modes, M);
}
- break;
}
+
+ break;
}
- if (output->crtc == NULL) {
+ if (j == config->num_crtc) {
/* Can not find the earlier associated CRTC, bail */
return false;
}