summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRostislav Pehlivanov <atomnuker@gmail.com>2016-05-31 00:38:55 +0100
committerwm4 <wm4@nowhere>2016-05-31 11:22:55 +0200
commit29ea6e5e4a25a08fda93ad2769d5dcaef041a95b (patch)
treebae25fae4af6a82e95475b3d5a6c59a567cec702
parent68c77d955f4d0c5269f8ea1be6e42e95110bbec0 (diff)
downloadmpv-29ea6e5e4a25a08fda93ad2769d5dcaef041a95b.tar.bz2
mpv-29ea6e5e4a25a08fda93ad2769d5dcaef041a95b.tar.xz
wayland: correctly report display refresh rate
This commit will cause the wayland backend and vo to correctly report the display frame rate. This didn't work as VOCTRL_GET_DISPLAY_FPS was received way too early, before the window was created (and thus current_output set). The VO will now signal VO_EVENT_WIN_STATE after window initialization and upon a resize. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
-rw-r--r--video/out/wayland_common.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index c27136f207..9ec3a4f65d 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -224,6 +224,8 @@ static void surface_handle_enter(void *data,
break;
}
}
+
+ wl->window.events |= VO_EVENT_WIN_STATE;
}
static void surface_handle_leave(void *data,
@@ -805,7 +807,7 @@ static void schedule_resize(struct vo_wayland_state *wl,
wl->window.sh_height = height;
wl->window.sh_x = x;
wl->window.sh_y = y;
- wl->window.events |= VO_EVENT_RESIZE;
+ wl->window.events |= VO_EVENT_WIN_STATE | VO_EVENT_RESIZE;
wl->vo->dwidth = width;
wl->vo->dheight = height;
}
@@ -1037,10 +1039,10 @@ int vo_wayland_init (struct vo *vo)
"\tmodel: %s\n"
"\tw: %d, h: %d\n"
"\tscale: %d\n"
- "\tHz: %d\n",
+ "\tHz: %f\n",
o->make, o->model,
o->width, o->height, o->scale,
- o->refresh_rate / 1000);
+ o->refresh_rate / 1000.0f);
}
vo->event_fd = wl->display.display_fd;
@@ -1290,7 +1292,7 @@ int vo_wayland_control (struct vo *vo, int *events, int request, void *arg)
break;
// refresh rate is stored in milli-Hertz (mHz)
- double fps = wl->display.current_output->refresh_rate / 1000;
+ double fps = wl->display.current_output->refresh_rate / 1000.0f;
*(double*) arg = fps;
return VO_TRUE;
}