fix XRandR refresh rate calculation
parent
44a2c4d512
commit
5ba839e83b
|
@ -402,8 +402,21 @@ static SDL_bool CheckXRandR(Display *display, int *major, int *minor)
|
||||||
|
|
||||||
static float CalculateXRandRRefreshRate(const XRRModeInfo *info)
|
static float CalculateXRandRRefreshRate(const XRRModeInfo *info)
|
||||||
{
|
{
|
||||||
if (info->hTotal && info->vTotal) {
|
double vTotal = info->vTotal;
|
||||||
return ((100 * (Sint64)info->dotClock) / (info->hTotal * info->vTotal)) / 100.0f;
|
|
||||||
|
if (info->modeFlags & RR_DoubleScan) {
|
||||||
|
/* doublescan doubles the number of lines */
|
||||||
|
vTotal *= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info->modeFlags & RR_Interlace) {
|
||||||
|
/* interlace splits the frame into two fields */
|
||||||
|
/* the field rate is what is typically reported by monitors */
|
||||||
|
vTotal /= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info->hTotal && vTotal) {
|
||||||
|
return ((100 * (Sint64)info->dotClock) / (info->hTotal * vTotal)) / 100.0f;
|
||||||
}
|
}
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue