modes: add commit/prepare hooks

This commit is contained in:
Dave Airlie 2007-02-26 09:40:00 +11:00
parent 06b01186f6
commit 2e31872e05
2 changed files with 29 additions and 5 deletions

View File

@ -282,7 +282,7 @@ xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
goto done; goto done;
} }
/* Disable the outputs and CRTCs before setting the mode. */ /* Prepare the outputs and CRTCs before setting the mode. */
for (i = 0; i < xf86_config->num_output; i++) { for (i = 0; i < xf86_config->num_output; i++) {
xf86OutputPtr output = xf86_config->output[i]; xf86OutputPtr output = xf86_config->output[i];
@ -290,10 +290,10 @@ xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
continue; continue;
/* Disable the output as the first thing we do. */ /* Disable the output as the first thing we do. */
output->funcs->dpms(output, DPMSModeOff); output->funcs->prepare(output);
} }
crtc->funcs->dpms(crtc, DPMSModeOff); crtc->funcs->prepare(crtc);
/* Set up the DPLL and any output state that needs to adjust or depend /* Set up the DPLL and any output state that needs to adjust or depend
* on the DPLL. * on the DPLL.
@ -307,12 +307,12 @@ xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
} }
/* Now, enable the clocks, plane, pipe, and outputs that we set up. */ /* Now, enable the clocks, plane, pipe, and outputs that we set up. */
crtc->funcs->dpms(crtc, DPMSModeOn); crtc->funcs->commit(crtc);
for (i = 0; i < xf86_config->num_output; i++) for (i = 0; i < xf86_config->num_output; i++)
{ {
xf86OutputPtr output = xf86_config->output[i]; xf86OutputPtr output = xf86_config->output[i];
if (output->crtc == crtc) if (output->crtc == crtc)
output->funcs->dpms(output, DPMSModeOn); output->funcs->commit(output);
} }
/* XXX free adjustedmode */ /* XXX free adjustedmode */

View File

@ -96,6 +96,12 @@ typedef struct _xf86CrtcFuncs {
DisplayModePtr mode, DisplayModePtr mode,
DisplayModePtr adjusted_mode); DisplayModePtr adjusted_mode);
/**
* Prepare CRTC for an upcoming mode set.
*/
void
(*prepare)(xf86CrtcPtr crtc);
/** /**
* Callback for setting up a video mode after fixups have been made. * Callback for setting up a video mode after fixups have been made.
*/ */
@ -105,6 +111,12 @@ typedef struct _xf86CrtcFuncs {
DisplayModePtr adjusted_mode, DisplayModePtr adjusted_mode,
int x, int y); int x, int y);
/**
* Commit mode changes to a CRTC
*/
void
(*commit)(xf86CrtcPtr crtc);
/* Set the color ramps for the CRTC to the given values. */ /* Set the color ramps for the CRTC to the given values. */
void void
(*gamma_set)(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue, (*gamma_set)(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue,
@ -263,6 +275,18 @@ typedef struct _xf86OutputFuncs {
DisplayModePtr mode, DisplayModePtr mode,
DisplayModePtr adjusted_mode); DisplayModePtr adjusted_mode);
/**
* Callback for preparing mode changes on an output
*/
void
(*prepare)(xf86OutputPtr output);
/**
* Callback for committing mode changes on an output
*/
void
(*commit)(xf86OutputPtr output);
/** /**
* Callback for setting up a video mode after fixups have been made. * Callback for setting up a video mode after fixups have been made.
* *