From fcc360ccad4d611609c098db004cfbd58c8cd895 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 27 Oct 2014 16:17:46 +0100 Subject: 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. --- video/out/x11_common.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'video') diff --git a/video/out/x11_common.c b/video/out/x11_common.c index 0ce669df6f..04f475ec5f 100644 --- a/video/out/x11_common.c +++ b/video/out/x11_common.c @@ -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", -- cgit v1.2.3