modegen: Round display clocks up instead of down
Fixes oboe getting 29fps for vrefresh or whatever Stops using floats here too, floats bad.
This commit is contained in:
parent
02e0086856
commit
9fa6fcd9ac
2 changed files with 7 additions and 9 deletions
|
@ -268,17 +268,15 @@ void generate_cvt_mode(drmModeModeInfo *mode, int hdisplay, int vdisplay,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void generate_fixed_mode(drmModeModeInfo *mode, const drmModeModeInfo *base, float vrefresh)
|
void generate_fixed_mode(drmModeModeInfo *mode, const drmModeModeInfo *base, int vrefresh)
|
||||||
{
|
{
|
||||||
*mode = *base;
|
*mode = *base;
|
||||||
|
|
||||||
if (!vrefresh) {
|
if (!vrefresh)
|
||||||
vrefresh = 60.0;
|
vrefresh = 60;
|
||||||
}
|
|
||||||
|
|
||||||
mode->clock = (mode->htotal * mode->vtotal) / 1000.0 * vrefresh;
|
mode->clock = ( ( mode->htotal * mode->vtotal * vrefresh ) + 499 ) / 1000;
|
||||||
mode->vrefresh = (1000.0 * ((float) mode->clock)) /
|
mode->vrefresh = (1000 * mode->clock) / (mode->htotal * mode->vtotal);
|
||||||
((float) (mode->htotal * mode->vtotal));
|
|
||||||
|
|
||||||
snprintf(mode->name, sizeof(mode->name), "%dx%d@%.2f", mode->hdisplay, mode->vdisplay, vrefresh);
|
snprintf(mode->name, sizeof(mode->name), "%dx%d@%d.00", mode->hdisplay, mode->vdisplay, vrefresh);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,4 +9,4 @@
|
||||||
void generate_cvt_mode(drmModeModeInfo *mode, int hdisplay, int vdisplay,
|
void generate_cvt_mode(drmModeModeInfo *mode, int hdisplay, int vdisplay,
|
||||||
float vrefresh, bool reduced, bool interlaced);
|
float vrefresh, bool reduced, bool interlaced);
|
||||||
void generate_fixed_mode(drmModeModeInfo *mode, const drmModeModeInfo *base,
|
void generate_fixed_mode(drmModeModeInfo *mode, const drmModeModeInfo *base,
|
||||||
float vrefresh);
|
int vrefresh);
|
||||||
|
|
Loading…
Reference in a new issue