compositor: Emit frame_signal from weston_output_do_read_pixels()
authorKristian Høgsberg <krh@bitplanet.net>
Wed, 20 Jun 2012 03:54:26 +0000 (23:54 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Wed, 20 Jun 2012 03:54:26 +0000 (23:54 -0400)
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
src/compositor.h
src/screenshooter.c

index 00b8f3e..a65dd84 100644 (file)
@@ -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,
index 22e5eb8..9131e46 100644 (file)
@@ -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;
index ecb8db0..765369c 100644 (file)
@@ -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;