diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2010-10-24 11:45:19 -0400 |
---|---|---|
committer | Alex Deucher <alexdeucher@gmail.com> | 2010-10-24 11:45:19 -0400 |
commit | 5efdf514ab0e5439114e8dd7a49105812155eb69 (patch) | |
tree | 89725a3a59c57f65116edeb79a8e6501a56e1f13 /src | |
parent | 1e3ede62c39307d0210cb2044badd619a4f44fec (diff) |
UMS/radeon: fix screen dimming on VT switch
Save and restore the palettes on VT switch. The restore
has to be done after the vga restore to work properly as
determined by Jonathan Kollasch.
Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=18407
Diffstat (limited to 'src')
-rw-r--r-- | src/radeon_driver.c | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/src/radeon_driver.c b/src/radeon_driver.c index 9e72c2db..057f693b 100644 --- a/src/radeon_driver.c +++ b/src/radeon_driver.c @@ -4444,8 +4444,6 @@ static void RADEONSaveMemMapRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save) } } - -#if 0 /* Read palette data */ static void RADEONSavePalette(ScrnInfoPtr pScrn, RADEONSavePtr save) { @@ -4453,19 +4451,37 @@ static void RADEONSavePalette(ScrnInfoPtr pScrn, RADEONSavePtr save) unsigned char *RADEONMMIO = info->MMIO; int i; -#ifdef ENABLE_FLAT_PANEL - /* Select palette 0 (main CRTC) if using FP-enabled chip */ - /* if (info->Port1 == MT_DFP) PAL_SELECT(1); */ -#endif PAL_SELECT(1); INPAL_START(0); - for (i = 0; i < 256; i++) save->palette2[i] = INPAL_NEXT(); + for (i = 0; i < 256; i++) { + save->palette2[i] = INREG(RADEON_PALETTE_30_DATA); + } + PAL_SELECT(0); INPAL_START(0); - for (i = 0; i < 256; i++) save->palette[i] = INPAL_NEXT(); - save->palette_valid = TRUE; + for (i = 0; i < 256; i++) { + save->palette[i] = INREG(RADEON_PALETTE_30_DATA); + } +} + +static void RADEONRestorePalette(ScrnInfoPtr pScrn, RADEONSavePtr restore) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + int i; + + PAL_SELECT(1); + OUTPAL_START(0); + for (i = 0; i < 256; i++) { + OUTREG(RADEON_PALETTE_30_DATA, restore->palette2[i]); + } + + PAL_SELECT(0); + INPAL_START(0); + for (i = 0; i < 256; i++) { + OUTREG(RADEON_PALETTE_30_DATA, restore->palette[i]); + } } -#endif static void avivo_save(ScrnInfoPtr pScrn, RADEONSavePtr save) @@ -5338,6 +5354,8 @@ static void RADEONSave(ScrnInfoPtr pScrn) RADEONSaveCrtcRegisters(pScrn, save); RADEONSaveFPRegisters(pScrn, save); RADEONSaveDACRegisters(pScrn, save); + RADEONSavePalette(pScrn, save); + if (pRADEONEnt->HasCRTC2) { RADEONSaveCrtc2Registers(pScrn, save); RADEONSavePLL2Registers(pScrn, save); @@ -5459,24 +5477,15 @@ static void RADEONRestore(ScrnInfoPtr pScrn) if (IS_AVIVO_VARIANT) avivo_restore_vga_regs(pScrn, restore); - if (!IS_AVIVO_VARIANT) + if (!IS_AVIVO_VARIANT) { + RADEONRestorePalette(pScrn, restore); RADEONRestoreDACRegisters(pScrn, restore); - + } #if 0 RADEONWaitForVerticalSync(pScrn); #endif } -#if 0 -/* Define initial palette for requested video mode. This doesn't do - * anything for XFree86 4.0. - */ -static void RADEONInitPalette(RADEONSavePtr save) -{ - save->palette_valid = FALSE; -} -#endif - static Bool RADEONSaveScreen(ScreenPtr pScreen, int mode) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; |