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.
This commit is contained in:
Eric Anholt 2007-01-18 11:37:14 -08:00
parent 92b0f3d201
commit d2ae2e2ccc
1 changed files with 22 additions and 8 deletions

View File

@ -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);