From 951ee8825f2efb34dc4350c26dacd458067b5954 Mon Sep 17 00:00:00 2001 From: Felix Kuehling Date: Wed, 20 Oct 2004 21:30:56 +0000 Subject: Take doublescan and interlace flags into account when choosing a BIOS mode. Otherwise it choses modes with double refresh rates for double scan modes or half refresh rates for interlaced modes. --- src/savage_driver.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/savage_driver.c b/src/savage_driver.c index 012c0ee..d794812 100644 --- a/src/savage_driver.c +++ b/src/savage_driver.c @@ -3156,6 +3156,19 @@ static int SavageInternalScreenInit(int scrnIndex, ScreenPtr pScreen) } +static int SavageGetRefresh(DisplayModePtr mode) +{ + int refresh = (mode->Clock * 1000) / (mode->HTotal * mode->VTotal); + if (mode->Flags & V_INTERLACE) + refresh *= 2.0; + if (mode->Flags & V_DBLSCAN) + refresh /= 2.0; + if (mode->VScan > 1) + refresh /= mode->VScan; + return refresh; +} + + static ModeStatus SavageValidMode(int index, DisplayModePtr pMode, Bool verbose, int flags) { @@ -3184,7 +3197,7 @@ static ModeStatus SavageValidMode(int index, DisplayModePtr pMode, return MODE_PANEL; if (psav->UseBIOS) { - refresh = (pMode->Clock * 1000) / (pMode->HTotal * pMode->VTotal); + refresh = SavageGetRefresh(pMode); return (SavageMatchBiosMode(pScrn,pMode->HDisplay, pMode->VDisplay, refresh,NULL,NULL)); @@ -3233,7 +3246,7 @@ static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) #endif if (psav->IsSecondary) { - refresh = (mode->Clock * 1000) / (mode->HTotal * mode->VTotal); + refresh = SavageGetRefresh(mode); SavageMatchBiosMode(pScrn,mode->HDisplay,mode->VDisplay,refresh, &newmode,&newrefresh); @@ -3317,7 +3330,7 @@ static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) int refresh; unsigned int newmode=0, newrefresh=0; - refresh = (mode->Clock * 1000) / (mode->HTotal * mode->VTotal); + refresh = SavageGetRefresh(mode); SavageMatchBiosMode(pScrn,mode->HDisplay,mode->VDisplay,refresh, &newmode,&newrefresh); -- cgit v1.2.3