From eb6d769a087b2ed5952f477fc3f0b0625810a287 Mon Sep 17 00:00:00 2001 From: Egbert Eich Date: Tue, 15 Nov 2011 18:50:56 +0100 Subject: DPMS: Split non-modeset CRTC DPMS function. RADEONRestore() calls crtc->funcs->dpms() after most of the mode setting subsystems have been restored. This function enables the CRTCs but does more: it calls DRM pre- and post-modeset ioctls and sets up the palettes (LUTs). None of these two things are needed. Accessing the palette registers after restoring the PLLs can even lead to lockups. Thus the CRTC DPMS function is split into two parts: one that just enables /disables the CRTC and one which wraps this function and does the rest. Now the inner function can be called directly from RADEONRestore() as there is no need to go thru the RandR hooks in this function while the RandR hook uses the wrappering function so the full functionality is preserved from an RandR point of view. Signed-off-by: Egbert Eich Reviewed-by: Alex Deucher --- src/radeon.h | 1 + src/radeon_crtc.c | 25 ++++++++++++++++--------- src/radeon_driver.c | 4 ++-- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/radeon.h b/src/radeon.h index 3f7ad4e6..d99fe3a2 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -1147,6 +1147,7 @@ extern void RADEONWaitForVLineMMIO(ScrnInfoPtr pScrn, PixmapPtr pPix, /* radeon_crtc.c */ extern void radeon_crtc_dpms(xf86CrtcPtr crtc, int mode); +extern void radeon_do_crtc_dpms(xf86CrtcPtr crtc, int mode); extern void radeon_crtc_load_lut(xf86CrtcPtr crtc); extern void radeon_crtc_modeset_ioctl(xf86CrtcPtr crtc, Bool post); extern Bool RADEONAllocateControllers(ScrnInfoPtr pScrn, int mask); diff --git a/src/radeon_crtc.c b/src/radeon_crtc.c index 9821ab60..d48cbc1e 100644 --- a/src/radeon_crtc.c +++ b/src/radeon_crtc.c @@ -69,18 +69,12 @@ RADEONInitDispBandwidthAVIVO(ScrnInfoPtr pScrn, DisplayModePtr mode2, int pixel_bytes2); void -radeon_crtc_dpms(xf86CrtcPtr crtc, int mode) +radeon_do_crtc_dpms(xf86CrtcPtr crtc, int mode) { RADEONInfoPtr info = RADEONPTR(crtc->scrn); RADEONEntPtr pRADEONEnt = RADEONEntPriv(crtc->scrn); - RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private; xf86CrtcPtr crtc0 = pRADEONEnt->pCrtc[0]; - - if ((mode == DPMSModeOn) && radeon_crtc->enabled) - return; - - if (mode == DPMSModeOff) - radeon_crtc_modeset_ioctl(crtc, FALSE); + RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private; if (IS_AVIVO_VARIANT || info->r4xx_atom) { atombios_crtc_dpms(crtc, mode); @@ -101,6 +95,20 @@ radeon_crtc_dpms(xf86CrtcPtr crtc, int mode) legacy_crtc_dpms(crtc0, mode); } } +} + +void +radeon_crtc_dpms(xf86CrtcPtr crtc, int mode) +{ + RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private; + + if ((mode == DPMSModeOn) && radeon_crtc->enabled) + return; + + if (mode == DPMSModeOff) + radeon_crtc_modeset_ioctl(crtc, FALSE); + + radeon_do_crtc_dpms(crtc, mode); if (mode != DPMSModeOff) { radeon_crtc_modeset_ioctl(crtc, TRUE); @@ -560,7 +568,6 @@ radeon_crtc_load_lut(xf86CrtcPtr crtc) if (IS_AVIVO_VARIANT) OUTREG(AVIVO_D1GRPH_LUT_SEL + radeon_crtc->crtc_offset, radeon_crtc->crtc_id); } - } static void diff --git a/src/radeon_driver.c b/src/radeon_driver.c index 04a242a7..077f9a46 100644 --- a/src/radeon_driver.c +++ b/src/radeon_driver.c @@ -5895,12 +5895,12 @@ static void RADEONRestore(ScrnInfoPtr pScrn) if (pRADEONEnt->HasCRTC2 && !info->IsSecondary) { if (info->crtc2_on && xf86_config->num_crtc > 1) { crtc = xf86_config->crtc[1]; - crtc->funcs->dpms(crtc, DPMSModeOn); + radeon_do_crtc_dpms(crtc, DPMSModeOn); } } if (info->crtc_on) { crtc = xf86_config->crtc[0]; - crtc->funcs->dpms(crtc, DPMSModeOn); + radeon_do_crtc_dpms(crtc, DPMSModeOn); } #ifdef WITH_VGAHW -- cgit v1.2.3