diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2008-07-14 13:21:38 -0400 |
---|---|---|
committer | Alex Deucher <alexdeucher@gmail.com> | 2008-07-14 13:23:16 -0400 |
commit | da41e71efd41907d9347a902720bce60b32550e5 (patch) | |
tree | 3a3ba22de0e11d01055dbab2abff52f92239650f | |
parent | a5e0cf13dc7ace6cf0e44e18b73b9a9266e740ab (diff) |
ATOM: Add support for UpdateCRTC_DoubleBufferRegisters cmd table
locks/unlocks the crtc/grph/mode regs before updating the crtc
-rw-r--r-- | src/atombios_crtc.c | 34 | ||||
-rw-r--r-- | src/radeon_output.c | 14 |
2 files changed, 35 insertions, 13 deletions
diff --git a/src/atombios_crtc.c b/src/atombios_crtc.c index b3b421c8..12a20bb8 100644 --- a/src/atombios_crtc.c +++ b/src/atombios_crtc.c @@ -48,6 +48,29 @@ #include "sarea.h" #endif +AtomBiosResult +atombios_lock_crtc(atomBiosHandlePtr atomBIOS, int crtc, int lock) +{ + ENABLE_CRTC_PS_ALLOCATION crtc_data; + AtomBiosArgRec data; + unsigned char *space; + + crtc_data.ucCRTC = crtc; + crtc_data.ucEnable = lock; + + data.exec.index = GetIndexIntoMasterTable(COMMAND, UpdateCRTC_DoubleBufferRegisters); + data.exec.dataSpace = (void *)&space; + data.exec.pspace = &crtc_data; + + if (RHDAtomBiosFunc(atomBIOS->scrnIndex, atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) { + ErrorF("%s CRTC %d success\n", lock? "Lock":"Unlock", crtc); + return ATOM_SUCCESS ; + } + + ErrorF("Lock CRTC failed\n"); + return ATOM_NOT_IMPLEMENTED; +} + static AtomBiosResult atombios_enable_crtc(atomBiosHandlePtr atomBIOS, int crtc, int state) { @@ -459,9 +482,6 @@ atombios_crtc_mode_set(xf86CrtcPtr crtc, fb_location = fb_location + (char *)crtc->rotatedData - (char *)info->FB; } - /* lock the grph regs */ - OUTREG(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset, AVIVO_D1GRPH_UPDATE_LOCK); - OUTREG(AVIVO_D1GRPH_PRIMARY_SURFACE_ADDRESS + radeon_crtc->crtc_offset, fb_location); OUTREG(AVIVO_D1GRPH_SECONDARY_SURFACE_ADDRESS + radeon_crtc->crtc_offset, fb_location); OUTREG(AVIVO_D1GRPH_CONTROL + radeon_crtc->crtc_offset, fb_format); @@ -476,19 +496,11 @@ atombios_crtc_mode_set(xf86CrtcPtr crtc, crtc->scrn->displayWidth); OUTREG(AVIVO_D1GRPH_ENABLE + radeon_crtc->crtc_offset, 1); - /* unlock the grph regs */ - OUTREG(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset, 0); - - /* lock the mode regs */ - OUTREG(AVIVO_D1SCL_UPDATE + radeon_crtc->crtc_offset, AVIVO_D1SCL_UPDATE_LOCK); - OUTREG(AVIVO_D1MODE_DESKTOP_HEIGHT + radeon_crtc->crtc_offset, mode->VDisplay); OUTREG(AVIVO_D1MODE_VIEWPORT_START + radeon_crtc->crtc_offset, (x << 16) | y); OUTREG(AVIVO_D1MODE_VIEWPORT_SIZE + radeon_crtc->crtc_offset, (mode->HDisplay << 16) | mode->VDisplay); - /* unlock the mode regs */ - OUTREG(AVIVO_D1SCL_UPDATE + radeon_crtc->crtc_offset, 0); } diff --git a/src/radeon_output.c b/src/radeon_output.c index ade0b00b..64f14c26 100644 --- a/src/radeon_output.c +++ b/src/radeon_output.c @@ -183,6 +183,8 @@ extern void atombios_output_mode_set(xf86OutputPtr output, extern void atombios_output_dpms(xf86OutputPtr output, int mode); extern RADEONMonitorType atombios_dac_detect(ScrnInfoPtr pScrn, xf86OutputPtr output); extern int atombios_external_tmds_setup(xf86OutputPtr output, DisplayModePtr mode); +extern AtomBiosResult +atombios_lock_crtc(atomBiosHandlePtr atomBIOS, int crtc, int lock); static void radeon_bios_output_dpms(xf86OutputPtr output, int mode); static void @@ -586,6 +588,7 @@ radeon_mode_fixup(xf86OutputPtr output, DisplayModePtr mode, static void radeon_mode_prepare(xf86OutputPtr output) { + RADEONInfoPtr info = RADEONPTR(output->scrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR (output->scrn); int o; @@ -595,9 +598,12 @@ radeon_mode_prepare(xf86OutputPtr output) continue; else if (loop_output->crtc) { xf86CrtcPtr other_crtc = loop_output->crtc; + RADEONCrtcPrivatePtr other_radeon_crtc = other_crtc->driver_private; if (other_crtc->enabled) { - radeon_dpms(loop_output, DPMSModeOff); radeon_crtc_dpms(other_crtc, DPMSModeOff); + if (IS_AVIVO_VARIANT) + atombios_lock_crtc(info->atomBIOS, other_radeon_crtc->crtc_id, 1); + radeon_dpms(loop_output, DPMSModeOff); } } } @@ -625,6 +631,7 @@ radeon_mode_set(xf86OutputPtr output, DisplayModePtr mode, static void radeon_mode_commit(xf86OutputPtr output) { + RADEONInfoPtr info = RADEONPTR(output->scrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR (output->scrn); int o; @@ -634,9 +641,12 @@ radeon_mode_commit(xf86OutputPtr output) continue; else if (loop_output->crtc) { xf86CrtcPtr other_crtc = loop_output->crtc; + RADEONCrtcPrivatePtr other_radeon_crtc = other_crtc->driver_private; if (other_crtc->enabled) { - radeon_dpms(loop_output, DPMSModeOn); radeon_crtc_dpms(other_crtc, DPMSModeOn); + if (IS_AVIVO_VARIANT) + atombios_lock_crtc(info->atomBIOS, other_radeon_crtc->crtc_id, 0); + radeon_dpms(loop_output, DPMSModeOn); } } } |