From e9d04924198102025726b743489a50825ef55ee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Tue, 19 Jun 2012 23:54:26 -0400 Subject: [PATCH] compositor: Emit frame_signal from weston_output_do_read_pixels() This is the point where we have just finished rendering the new scene but before we swap it to the front buffer. At this point, the output->previous_damage region exactly corresponds to what was just renders, as compared to previous frame. --- src/compositor.c | 5 +++-- src/compositor.h | 1 + src/screenshooter.c | 5 ----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/compositor.c b/src/compositor.c index 00b8f3e2..a65dd84a 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -1142,8 +1142,7 @@ weston_output_finish_frame(struct weston_output *output, int msecs) wl_display_get_event_loop(compositor->wl_display); int fd; - wl_signal_emit(&output->frame_signal, &msecs); - + output->frame_time = msecs; if (output->repaint_needed) { weston_output_repaint(output, msecs); return; @@ -2871,6 +2870,8 @@ weston_output_do_read_pixels(struct weston_output *output) { struct weston_read_pixels *r, *next; + wl_signal_emit(&output->frame_signal, &output->frame_time); + glPixelStorei(GL_PACK_ALIGNMENT, 1); wl_list_for_each_safe(r, next, &output->read_pixels_list, link) { glReadPixels(r->x, r->y, r->width, r->height, diff --git a/src/compositor.h b/src/compositor.h index 22e5eb83..9131e46a 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -172,6 +172,7 @@ struct weston_output { int dirty; struct wl_list read_pixels_list; struct wl_signal frame_signal; + uint32_t frame_time; char *make, *model; uint32_t subpixel; diff --git a/src/screenshooter.c b/src/screenshooter.c index ecb8db0a..765369cb 100644 --- a/src/screenshooter.c +++ b/src/screenshooter.c @@ -275,11 +275,6 @@ weston_recorder_frame_notify(struct wl_listener *listener, void *data) r = pixman_region32_rectangles(&damage, &n); if (n == 0) return; - if (recorder->count++ == 0) - /* The first callback gives us the frame immediately - * before the weston_output_damage() call, and - * typically doesn't give us a full frame of damage.*/ - return; header.msecs = msecs; header.nrects = n;