mirror of
https://github.com/mpv-player/mpv
synced 2024-12-25 16:33:02 +00:00
x11: fix display FPS detection for interlaced modes
In interlaced modes, we output fields, not complete frames, so the framerate doubles. The method to calculate this was borrowed from xrandr code. Hopefully fixes #1224.
This commit is contained in:
parent
a95ce07273
commit
fcc360ccad
@ -365,10 +365,15 @@ static void xrandr_read(struct vo_x11_state *x11)
|
||||
continue;
|
||||
if (x11->num_displays >= MAX_DISPLAYS)
|
||||
continue;
|
||||
double vTotal = m.vTotal;
|
||||
if (m.modeFlags & RR_DoubleScan)
|
||||
vTotal *= 2;
|
||||
if (m.modeFlags & RR_Interlace)
|
||||
vTotal /= 2;
|
||||
struct xrandr_display d = {
|
||||
.rc = { crtc->x, crtc->y,
|
||||
crtc->x + crtc->width, crtc->y + crtc->height },
|
||||
.fps = m.dotClock / (m.hTotal * (double)m.vTotal),
|
||||
.fps = m.dotClock / (m.hTotal * vTotal),
|
||||
};
|
||||
int num = x11->num_displays++;
|
||||
MP_VERBOSE(x11, "Display %d: [%d, %d, %d, %d] @ %f FPS\n",
|
||||
|
Loading…
Reference in New Issue
Block a user