diff --git a/src/client/vid/glimp_sdl.c b/src/client/vid/glimp_sdl.c index c072d1bc..774a26f8 100644 --- a/src/client/vid/glimp_sdl.c +++ b/src/client/vid/glimp_sdl.c @@ -377,7 +377,7 @@ GLimp_GetRefreshRate(void) if (vid_displayrefreshrate->value > -1) { - glimp_refreshRate = floor(vid_displayrefreshrate->value); + glimp_refreshRate = ceil(vid_displayrefreshrate->value); } /* Do this only once. We asume that no one will change their @@ -389,7 +389,7 @@ GLimp_GetRefreshRate(void) int i = SDL_GetWindowDisplayIndex(window); - if (i >= 0 && SDL_GetCurrentDisplayMode(i, &mode) == 0) + if(i >= 0 && SDL_GetCurrentDisplayMode(i, &mode) == 0) { glimp_refreshRate = mode.refresh_rate; } @@ -401,5 +401,12 @@ GLimp_GetRefreshRate(void) } } + /* The value reported by SDL may be one frame too low, for example + on my old Radeon R7 360 the driver returns 59hz for my 59.95hz + display. And Quake II isn't that accurate, we loose a little bit + here and there. Since it doesn't really hurt if we're running a + litte bit too fast just return one frame more than we really have. */ + glimp_refreshRate++; + return glimp_refreshRate; }