In some cases STK was barely playable because of very low refresh rates (25-30Hz).

This may be caused by last changes in display drivers. I remember that previously refresh rates for resolution were in order from the lowest to the greatest. Now I see it in reversed order.
Irrlicht didn't check refresh rates and always set the last available for specified resolution.

Now we use the highest available refresh rate.

Perhaps we should use xrandr library instead of vidmode. It should be much smarter and maybe would solve some multimonitor issues.
This commit is contained in:
Deve 2014-05-12 18:31:43 +02:00
parent 23ba597a1c
commit e8b4926b0b

View File

@ -264,6 +264,7 @@ bool CIrrDeviceLinux::switchToFullscreen(bool reset)
// enumerate video modes
s32 modeCount;
XF86VidModeModeInfo** modes;
float refresh_rate;
XF86VidModeGetAllModeLines(display, screennr, &modeCount, &modes);
@ -271,14 +272,38 @@ bool CIrrDeviceLinux::switchToFullscreen(bool reset)
for (s32 i = 0; i<modeCount; ++i)
{
if (bestMode==-1 && modes[i]->hdisplay >= Width && modes[i]->vdisplay >= Height)
{
float pixels_per_second = modes[i]->dotclock * 1000.0;
float pixels_per_frame = modes[i]->htotal * modes[i]->vtotal;
refresh_rate = pixels_per_second / pixels_per_frame;
bestMode = i;
}
else if (bestMode!=-1 &&
modes[i]->hdisplay == modes[bestMode]->hdisplay &&
modes[i]->vdisplay == modes[bestMode]->vdisplay)
{
float pixels_per_second = modes[i]->dotclock * 1000.0;
float pixels_per_frame = modes[i]->htotal * modes[i]->vtotal;
float refresh_rate_tmp = pixels_per_second / pixels_per_frame;
if (refresh_rate_tmp > refresh_rate)
{
refresh_rate = refresh_rate_tmp;
bestMode = i;
}
}
else if (bestMode!=-1 &&
modes[i]->hdisplay >= Width &&
modes[i]->vdisplay >= Height &&
modes[i]->hdisplay <= modes[bestMode]->hdisplay &&
modes[i]->vdisplay <= modes[bestMode]->vdisplay)
{
float pixels_per_second = modes[i]->dotclock * 1000.0;
float pixels_per_frame = modes[i]->htotal * modes[i]->vtotal;
refresh_rate = pixels_per_second / pixels_per_frame;
bestMode = i;
}
}
if (bestMode != -1)
{
os::Printer::log("Starting vidmode fullscreen mode...", ELL_INFORMATION);