From 464d03f3eea591b22153ea7a0b581448f870fd2d Mon Sep 17 00:00:00 2001 From: Junghoon Date: Tue, 28 Jul 2015 13:19:06 +0900 Subject: [PATCH] fbdev: emit frame_signal Change-Id: Ic00131a61a5cc14b2171fdcf125c2b9ef154e49e --- src/lib/fbdev/fbdev-internal.h | 2 ++ src/lib/fbdev/fbdev-output.c | 23 +++++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/lib/fbdev/fbdev-internal.h b/src/lib/fbdev/fbdev-internal.h index b34fd66..3d9f3f6 100644 --- a/src/lib/fbdev/fbdev-internal.h +++ b/src/lib/fbdev/fbdev-internal.h @@ -55,6 +55,8 @@ struct fbdev_output struct wl_signal mode_change_signal; struct wl_signal frame_signal; + struct wl_event_source *frame_done_timer; + pepper_plane_t *primary_plane; /* TODO */ }; diff --git a/src/lib/fbdev/fbdev-output.c b/src/lib/fbdev/fbdev-output.c index eb68d9d..389d651 100644 --- a/src/lib/fbdev/fbdev-output.c +++ b/src/lib/fbdev/fbdev-output.c @@ -91,6 +91,9 @@ fbdev_output_destroy(void *o) wl_signal_emit(&output->destroy_signal, NULL); wl_list_remove(&output->link); + if (output->frame_done_timer) + wl_event_source_remove(output->frame_done_timer); + if (output->render_target) pepper_render_target_destroy(output->render_target); @@ -202,9 +205,9 @@ fbdev_output_repaint(void *o, const pepper_list_t *plane_list) output->frame_buffer_image, 0, 0, 0, 0, 0, 0, output->w, output->h); } - - /* TODO: No overlays on fbdev??? */ } + + wl_event_source_timer_update(output->frame_done_timer, 16); } static void @@ -274,6 +277,15 @@ init_renderer(fbdev_output_t *output, const char *renderer) return init_pixman_renderer(output); } +static int +frame_done_handler(void* data) +{ + fbdev_output_t *output = (fbdev_output_t *)data; + wl_signal_emit(&output->frame_signal, NULL); + + return 1; +} + pepper_bool_t pepper_fbdev_output_create(pepper_fbdev_t *fbdev, const char *renderer) { @@ -282,6 +294,9 @@ pepper_fbdev_output_create(pepper_fbdev_t *fbdev, const char *renderer) struct fb_fix_screeninfo fixed_info; struct fb_var_screeninfo var_info; + struct wl_display *display; + struct wl_event_loop *loop; + /* fbdev open */ fd = open("/dev/fb0"/*FIXME*/, O_RDWR | O_CLOEXEC); if (fd < 0) @@ -379,6 +394,10 @@ pepper_fbdev_output_create(pepper_fbdev_t *fbdev, const char *renderer) output->primary_plane = pepper_output_add_plane(output->base, NULL); wl_list_insert(&fbdev->output_list, &output->link); + display = pepper_compositor_get_display(fbdev->compositor); + loop = wl_display_get_event_loop(display); + output->frame_done_timer = wl_event_loop_add_timer(loop, frame_done_handler, output); + return PEPPER_TRUE; error: -- 2.7.4