Replace custom, partially broken DPMS implementation with a generic one.
This commit is contained in:
parent
7ed1b05922
commit
41444183b5
|
|
@ -478,6 +478,12 @@ i830PipeInUse (xf86CrtcPtr crtc)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the power management mode of the pipe and plane.
|
||||
*
|
||||
* This code should probably grow support for turning the cursor off and back
|
||||
* on appropriately at the same time as we're turning the pipe off/on.
|
||||
*/
|
||||
static void
|
||||
i830_crtc_dpms(xf86CrtcPtr crtc, int mode)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -314,8 +314,6 @@ const char *i830_output_type_names[] = {
|
|||
"TVOUT",
|
||||
};
|
||||
|
||||
static void I830DisplayPowerManagementSet(ScrnInfoPtr pScrn,
|
||||
int PowerManagementMode, int flags);
|
||||
static void i830AdjustFrame(int scrnIndex, int x, int y, int flags);
|
||||
static Bool I830CloseScreen(int scrnIndex, ScreenPtr pScreen);
|
||||
static Bool I830SaveScreen(ScreenPtr pScreen, int unblack);
|
||||
|
|
@ -2863,7 +2861,7 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
xf86DPMSInit(pScreen, I830DisplayPowerManagementSet, 0);
|
||||
xf86DPMSInit(pScreen, xf86DPMSSet, 0);
|
||||
|
||||
#ifdef I830_XV
|
||||
/* Init video */
|
||||
|
|
@ -3319,55 +3317,6 @@ I830SaveScreen(ScreenPtr pScreen, int mode)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/* Use the VBE version when available. */
|
||||
static void
|
||||
I830DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode,
|
||||
int flags)
|
||||
{
|
||||
I830Ptr pI830 = I830PTR(pScrn);
|
||||
int i;
|
||||
CARD32 temp, ctrl, base;
|
||||
|
||||
for (i = 0; i < pI830->xf86_config.num_output; i++) {
|
||||
xf86OutputPtr output = pI830->xf86_config.output[i];
|
||||
|
||||
(*output->funcs->dpms) (output, PowerManagementMode);
|
||||
}
|
||||
|
||||
for (i = 0; i < pI830->xf86_config.num_crtc; i++)
|
||||
{
|
||||
xf86CrtcPtr crtc = pI830->xf86_config.crtc[i];
|
||||
|
||||
if (i == 0) {
|
||||
ctrl = DSPACNTR;
|
||||
base = DSPABASE;
|
||||
} else {
|
||||
ctrl = DSPBCNTR;
|
||||
base = DSPBADDR;
|
||||
}
|
||||
/* XXX pipe disable too? */
|
||||
if (crtc->enabled) {
|
||||
temp = INREG(ctrl);
|
||||
if (PowerManagementMode == DPMSModeOn)
|
||||
temp |= DISPLAY_PLANE_ENABLE;
|
||||
else
|
||||
temp &= ~DISPLAY_PLANE_ENABLE;
|
||||
OUTREG(ctrl, temp);
|
||||
/* Flush changes */
|
||||
temp = INREG(base);
|
||||
OUTREG(base, temp);
|
||||
}
|
||||
}
|
||||
|
||||
if (pI830->CursorInfoRec && !pI830->SWCursor && pI830->cursorOn) {
|
||||
if (PowerManagementMode == DPMSModeOn)
|
||||
pI830->CursorInfoRec->ShowCursor(pScrn);
|
||||
else
|
||||
pI830->CursorInfoRec->HideCursor(pScrn);
|
||||
pI830->cursorOn = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static Bool
|
||||
I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -590,3 +590,38 @@ xf86InitialConfiguration (ScrnInfoPtr pScrn)
|
|||
xfree (modes);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the DPMS power mode of all outputs and CRTCs.
|
||||
*
|
||||
* If the new mode is off, it will turn off outputs and then CRTCs.
|
||||
* Otherwise, it will affect CRTCs before outputs.
|
||||
*/
|
||||
void
|
||||
xf86DPMSSet(ScrnInfoPtr pScrn, int mode, int flags)
|
||||
{
|
||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||
int i;
|
||||
|
||||
if (mode == DPMSModeOff) {
|
||||
for (i = 0; i < config->num_output; i++) {
|
||||
xf86OutputPtr output = config->output[i];
|
||||
if (output->crtc != NULL)
|
||||
(*output->funcs->dpms) (output, mode);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < config->num_crtc; i++) {
|
||||
xf86CrtcPtr crtc = config->crtc[i];
|
||||
if (crtc->enabled)
|
||||
(*crtc->funcs->dpms) (crtc, mode);
|
||||
}
|
||||
|
||||
if (mode != DPMSModeOff) {
|
||||
for (i = 0; i < config->num_output; i++) {
|
||||
xf86OutputPtr output = config->output[i];
|
||||
if (output->crtc != NULL)
|
||||
(*output->funcs->dpms) (output, mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -378,4 +378,7 @@ xf86SetScrnInfoModes (ScrnInfoPtr pScrn);
|
|||
Bool
|
||||
xf86InitialConfiguration (ScrnInfoPtr pScrn);
|
||||
|
||||
void
|
||||
xf86DPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags);
|
||||
|
||||
#endif /* _XF86CRTC_H_ */
|
||||
|
|
|
|||
Loading…
Reference in New Issue