From 7fa190715c63ad1e8a703348165959bc9ceb07cb Mon Sep 17 00:00:00 2001 From: Hans-Juergen Mauser Date: Wed, 9 May 2012 10:01:25 +0200 Subject: savage_video.c: Check current output configuration before doing expansion When playing video, the driver should check the output config which could have been modified due to Fn+Output key or s3switch. If TV or CRT is on, the LCD expansion must be avoided, otherwise, video image on TV is cropped due to false expansion. Use new SavageUpdateDevices() function. Tormod comment: We should also mask with ACTIVE_DEVICES here also for detecting CrtOnly, no? Tormod comment: Do we need to run these BIOS calls for every video frame? Would it be enough to update this on mode changes? Signed-off-by: Hans-Juergen Mauser [Tormod: patch split out from a big diff] Signed-off-by: Tormod Volden --- src/savage_driver.h | 1 + src/savage_vbe.c | 12 ++++++++++++ src/savage_video.c | 3 +++ 3 files changed, 16 insertions(+) diff --git a/src/savage_driver.h b/src/savage_driver.h index 355a0f0..aa05b9d 100644 --- a/src/savage_driver.h +++ b/src/savage_driver.h @@ -620,6 +620,7 @@ void SavageSetVESAMode( SavagePtr psav, int n, int Refresh ); void SavageSetPanelEnabled( SavagePtr psav, Bool active ); void SavageFreeBIOSModeTable( SavagePtr psav, SavageModeTablePtr* ppTable ); int SavageGetTV( SavagePtr psav ); +void SavageUpdateDevices(ScrnInfoPtr pScrn); int SavageCorrectDuoViewFlag(int iDevInfo, Bool bEnableActivate, Bool bEnableDeactivate); SavageModeTablePtr SavageGetBIOSModeTable( SavagePtr psav, int iDepth ); ModeStatus SavageMatchBiosMode(ScrnInfoPtr pScrn,int width,int height,int refresh, diff --git a/src/savage_vbe.c b/src/savage_vbe.c index 5576496..1528896 100644 --- a/src/savage_vbe.c +++ b/src/savage_vbe.c @@ -307,6 +307,18 @@ int SavageGetTV( SavagePtr psav ) return ((psav->pVbe->pInt10->cx) & 0xc); /* TV mode bits are bits 2 and 3 */ } +/* function for online update of current devices and TV format */ +void SavageUpdateDevices(ScrnInfoPtr pScrn) +{ + SavagePtr psav; + + psav = SAVPTR(pScrn); + psav->iDevInfo = SavageGetDevice(psav); + psav->PAL = ((SavageGetTV(psav) & BIOS_TV_PAL) != 0); + psav->TvOn = ((psav->iDevInfo & TV_ACTIVE) != 0); + psav->CrtOnly = ((psav->iDevInfo & (unsigned char) ~CRT_ACTIVE) == 0); +} + /* Function to correct the DuoView flag in the case of a single display */ int SavageCorrectDuoViewFlag(int iDevInfo, Bool bEnableActivate, diff --git a/src/savage_video.c b/src/savage_video.c index 2124032..d7546d2 100644 --- a/src/savage_video.c +++ b/src/savage_video.c @@ -1662,6 +1662,9 @@ SavageDisplayVideoNew( /* Calculate horizontal and vertical scale factors. */ + /* update device list to get the correct prerequisites for the following calculations */ + SavageUpdateDevices(pScrn); + if ( S3_SAVAGE_MOBILE_SERIES(psav->Chipset) && (psav->DisplayType == MT_LCD) && !psav->CrtOnly && -- cgit v1.2.3