fix rounding on result of SiSCalcVRate()

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2026-01-22 13:16:25 +01:00
committed by Enrico Weigelt
parent 9bd48ad4cb
commit c344e60c9a
3 changed files with 12 additions and 6 deletions

View File

@@ -44,6 +44,8 @@
*/
#include "config.h"
#include <math.h>
#include "sis.h"
#include "extinit.h"
@@ -1148,7 +1150,7 @@ SiSCopyModeNLink(ScrnInfoPtr pScrn, DisplayModePtr dest,
* simply set this to the refresh rate for the CRT1 mode (since CRT2 will
* mostly be LCD or TV anyway).
*/
mode->VRefresh = SiSCalcVRate(i);
mode->VRefresh = roundf(SiSCalcVRate(i));
if( ((mode->HDisplay * ((pScrn->bitsPerPixel + 7) / 8) * mode->VDisplay) > pSiS->maxxfbmem) ||
(mode->HDisplay > 4088) ||
@@ -13102,7 +13104,7 @@ SISSearchCRT1Rate(ScrnInfoPtr pScrn, DisplayModePtr mode)
defindex = (xres == 800 || xres == 1024 || xres == 1280) ? 0x02 : 0x01;
irefresh = (int)SiSCalcVRate(mode);
irefresh = roundf(SiSCalcVRate(mode));
if(!irefresh) return defindex;
/* SiS730 has troubles on CRT2 if CRT1 is at 32bpp */

View File

@@ -30,8 +30,10 @@
*/
#include "config.h"
#include "sis.h"
#include <math.h>
#include <X11/X.h>
#include "sis.h"
#include "dixstruct.h"
#include "sis_videostr.h"
@@ -784,12 +786,12 @@ SISGetMergedModeDetails(ScrnInfoPtr pScrn,
tmode = ((SiSMergedDisplayModePtr)mode->Private)->CRT1;
*crt1x = tmode->HDisplay;
*crt1y = tmode->VDisplay;
*crt1clk = (unsigned int)SiSCalcVRate(tmode);
*crt1clk = roundf(SiSCalcVRate(tmode));
tmode = ((SiSMergedDisplayModePtr)mode->Private)->CRT2;
*crt2x = tmode->HDisplay;
*crt2y = tmode->VDisplay;
*crt2clk = (unsigned int)SiSCalcVRate(tmode);
*crt2clk = roundf(SiSCalcVRate(tmode));
}
/***********************************

View File

@@ -35,6 +35,8 @@
*/
#include "config.h"
#include <math.h>
#include "sis.h"
#define SIS_NEED_inSISREG
#define SIS_NEED_outSISREG
@@ -179,7 +181,7 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
int clock = mode->Clock;
int width = mode->HDisplay;
int height = mode->VDisplay;
int rate = (int)SiSCalcVRate(mode);
int rate = roundf(SiSCalcVRate(mode));
int buswidth = pSiS->BusWidth;
unsigned int vclk[5];
UShort CRT_CPUthresholdLow, CRT_CPUthresholdHigh, CRT_ENGthreshold;