From 29ea6e5e4a25a08fda93ad2769d5dcaef041a95b Mon Sep 17 00:00:00 2001 From: Rostislav Pehlivanov Date: Tue, 31 May 2016 00:38:55 +0100 Subject: 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 --- video/out/wayland_common.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'video') 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; } -- cgit v1.2.3