summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2007-01-18 11:37:14 -0800
committerEric Anholt <eric@anholt.net>2007-01-18 11:37:14 -0800
commitd2ae2e2ccc3a8e7dc84745c235836cba150754d8 (patch)
treeec891f3c7ae91a588c6573632ba6931e37386ad7 /src
parent92b0f3d2013c32d94fe57fe674da1b195288f347 (diff)
Update CRTC values first so they can be used by the driver in mode setting.
With this, the screen now gets rotated, though there are major issues.
Diffstat (limited to 'src')
-rw-r--r--src/i830_xf86Crtc.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/i830_xf86Crtc.c b/src/i830_xf86Crtc.c
index a926e9fb..c879d998 100644
--- a/src/i830_xf86Crtc.c
+++ b/src/i830_xf86Crtc.c
@@ -154,6 +154,9 @@ xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
Bool ret = FALSE;
Bool didLock = FALSE;
DisplayModePtr adjusted_mode;
+ DisplayModeRec saved_mode;
+ int saved_x, saved_y;
+ Rotation saved_rotation;
adjusted_mode = xf86DuplicateMode(mode);
@@ -167,6 +170,18 @@ xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
didLock = crtc->funcs->lock (crtc);
+ saved_mode = crtc->mode;
+ saved_x = crtc->x;
+ saved_y = crtc->y;
+ saved_rotation = crtc->rotation;
+ /* Update crtc values up front so the driver can rely on them for mode
+ * setting.
+ */
+ crtc->mode = *mode;
+ crtc->x = x;
+ crtc->y = y;
+ crtc->rotation = rotation;
+
/* XXX short-circuit changes to base location only */
/* Pass our mode to the outputs and the CRTC to give them a chance to
@@ -180,18 +195,15 @@ xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
continue;
if (!output->funcs->mode_fixup(output, mode, adjusted_mode)) {
- ret = FALSE;
goto done;
}
}
if (!crtc->funcs->mode_fixup(crtc, mode, adjusted_mode)) {
- ret = FALSE;
goto done;
}
if (!xf86CrtcRotate (crtc, mode, rotation)) {
- ret = FALSE;
goto done;
}
@@ -228,14 +240,16 @@ xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
output->funcs->dpms(output, DPMSModeOn);
}
- crtc->mode = *mode;
- crtc->x = x;
- crtc->y = y;
- crtc->rotation = rotation;
-
/* XXX free adjustedmode */
ret = TRUE;
done:
+ if (!ret) {
+ crtc->x = saved_x;
+ crtc->y = saved_y;
+ crtc->rotation = saved_rotation;
+ crtc->mode = saved_mode;
+ }
+
if (didLock)
crtc->funcs->unlock (crtc);