diff options
author | Dave Airlie <airlied@linux.ie> | 2006-09-22 06:55:51 +1000 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2006-09-22 06:55:51 +1000 |
commit | e8d77b7c36fa791a2350a6f4b15728b15d8f3de0 (patch) | |
tree | a7b29094c0f61ba3ada806fee152501fa93d1707 /src/radeon_display.c | |
parent | 8534723f5710e2916b4a22efe22a6b7365cc8db6 (diff) |
radeon: refactor blank/unblank
Diffstat (limited to 'src/radeon_display.c')
-rw-r--r-- | src/radeon_display.c | 170 |
1 files changed, 118 insertions, 52 deletions
diff --git a/src/radeon_display.c b/src/radeon_display.c index 893bdf27..31e93ff6 100644 --- a/src/radeon_display.c +++ b/src/radeon_display.c @@ -1784,35 +1784,107 @@ void RADEONInitDispBandwidth(ScrnInfoPtr pScrn) } } +static void RADEONBlankSet(ScrnInfoPtr pScrn, int controller) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); + + switch(pRADEONEnt->Controller[controller].pPort->MonType) { + case MT_LCD: + OUTREGP(RADEON_LVDS_GEN_CNTL, RADEON_LVDS_DISPLAY_DIS, ~RADEON_LVDS_DISPLAY_DIS); + break; + + case MT_CRT: + if ((info->ChipFamily == CHIP_FAMILY_R200) && + (pRADEONEnt->Controller[controller].pPort->DACType == DAC_TVDAC)) + OUTREGP(RADEON_FP2_GEN_CNTL, RADEON_FP2_BLANK_EN, ~RADEON_FP2_BLANK_EN); + + break; + case MT_DFP: + if (pRADEONEnt->Controller[controller].pPort->TMDSType == TMDS_EXT) + OUTREGP(RADEON_FP2_GEN_CNTL, RADEON_FP2_BLANK_EN, ~RADEON_FP2_BLANK_EN); + else + OUTREGP(RADEON_FP_GEN_CNTL, RADEON_FP_BLANK_EN, ~RADEON_FP_BLANK_EN); + + break; + case MT_NONE: + default: + break; + } +} /* Blank screen */ void RADEONBlank(ScrnInfoPtr pScrn) { RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; + RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); - if (!info->IsSecondary) { - switch(info->DisplayType) { - case MT_LCD: - case MT_CRT: - case MT_DFP: - OUTREGP(RADEON_CRTC_EXT_CNTL, - RADEON_CRTC_DISPLAY_DIS, - ~(RADEON_CRTC_DISPLAY_DIS)); - break; - - case MT_NONE: - default: - break; + if (!pRADEONEnt->HasSecondary || + (pRADEONEnt->HasSecondary && !info->IsSwitching) || + (info->IsSwitching && (!info->IsSecondary))) { + + RADEONBlankSet(pScrn, 0); + OUTREGP (RADEON_CRTC_EXT_CNTL, + RADEON_CRTC_DISPLAY_DIS | + RADEON_CRTC_VSYNC_DIS | + RADEON_CRTC_HSYNC_DIS, + ~(RADEON_CRTC_DISPLAY_DIS | + RADEON_CRTC_VSYNC_DIS | + RADEON_CRTC_HSYNC_DIS)); + + if (!info->HasCRTC2) return; + + if (info->MergedFB) { + RADEONBlankSet(pScrn, 1); + OUTREGP (RADEON_CRTC2_GEN_CNTL, + RADEON_CRTC2_DISP_DIS | + RADEON_CRTC2_VSYNC_DIS | + RADEON_CRTC2_HSYNC_DIS, + ~(RADEON_CRTC2_DISP_DIS | + RADEON_CRTC2_VSYNC_DIS | + RADEON_CRTC2_HSYNC_DIS)); } - if (info->MergedFB) - OUTREGP(RADEON_CRTC2_GEN_CNTL, - RADEON_CRTC2_DISP_DIS, - ~(RADEON_CRTC2_DISP_DIS)); - } else { - OUTREGP(RADEON_CRTC2_GEN_CNTL, - RADEON_CRTC2_DISP_DIS, - ~(RADEON_CRTC2_DISP_DIS)); + } + + if ((pRADEONEnt->HasSecondary && !info->IsSwitching) || + (info->IsSwitching && info->IsSecondary)) { + RADEONBlankSet(pScrn, 1); + OUTREGP (RADEON_CRTC2_GEN_CNTL, + RADEON_CRTC2_DISP_DIS | + RADEON_CRTC2_VSYNC_DIS | + RADEON_CRTC2_HSYNC_DIS, + ~(RADEON_CRTC2_DISP_DIS | + RADEON_CRTC2_VSYNC_DIS | + RADEON_CRTC2_HSYNC_DIS)); + } +} + +static void RADEONUnblankSet(ScrnInfoPtr pScrn, int controller) +{ + RADEONInfoPtr info = RADEONPTR (pScrn); + unsigned char *RADEONMMIO = info->MMIO; + RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); + + switch(pRADEONEnt->Controller[controller].pPort->MonType) { + case MT_LCD: + OUTREGP(RADEON_LVDS_GEN_CNTL, 0, ~RADEON_LVDS_DISPLAY_DIS); + break; + case MT_CRT: + if ((info->ChipFamily == CHIP_FAMILY_R200) && + (pRADEONEnt->Controller[controller].pPort->DACType == DAC_TVDAC)) + OUTREGP(RADEON_FP2_GEN_CNTL, 0, ~RADEON_FP2_BLANK_EN); + break; + case MT_DFP: + if (pRADEONEnt->Controller[controller].pPort->TMDSType == TMDS_EXT) + OUTREGP(RADEON_FP2_GEN_CNTL, 0, ~RADEON_FP2_BLANK_EN); + else + OUTREGP(RADEON_FP_GEN_CNTL, 0, ~RADEON_FP_BLANK_EN); + break; + case MT_NONE: + default: + break; } } @@ -1821,39 +1893,33 @@ void RADEONUnblank(ScrnInfoPtr pScrn) { RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; + RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); - if (!info->IsSecondary) { - switch (info->DisplayType) { - case MT_LCD: - case MT_CRT: - case MT_DFP: - OUTREGP(RADEON_CRTC_EXT_CNTL, - RADEON_CRTC_CRT_ON, - ~(RADEON_CRTC_DISPLAY_DIS)); - break; - - case MT_NONE: - default: - break; - } - if (info->MergedFB) - OUTREGP(RADEON_CRTC2_GEN_CNTL, - 0, - ~(RADEON_CRTC2_DISP_DIS)); - } else { - switch (info->DisplayType) { - case MT_LCD: - case MT_DFP: - case MT_CRT: - OUTREGP(RADEON_CRTC2_GEN_CNTL, - 0, - ~(RADEON_CRTC2_DISP_DIS)); - break; + if (!pRADEONEnt->HasSecondary || (info->IsSwitching && !info->IsSecondary)) { + RADEONUnblankSet(pScrn, 0); + OUTREGP(RADEON_CRTC_EXT_CNTL, + 0, + ~(RADEON_CRTC_DISPLAY_DIS | + RADEON_CRTC_VSYNC_DIS | + RADEON_CRTC_HSYNC_DIS)); + + if (!info->HasCRTC2) return; + + if (info->MergedFB) { + RADEONUnblankSet(pScrn, 1); + OUTREGP(RADEON_CRTC2_GEN_CNTL, 0, + ~(RADEON_CRTC2_DISP_DIS | + RADEON_CRTC2_VSYNC_DIS | + RADEON_CRTC2_HSYNC_DIS)); + } + } - case MT_NONE: - default: - break; - } + if (info->IsSwitching && info->IsSecondary) { + RADEONUnblankSset(pScrn, 1); + OUTREGP(RADEON_CRTC2_GEN_CNTL, 0, + ~(RADEON_CRTC2_DISP_DIS | + RADEON_CRTC2_VSYNC_DIS | + RADEON_CRTC2_HSYNC_DIS)); } } |