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.
@ -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,
@ -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;
@ -275,11 +275,6 @@ weston_recorder_frame_notify(struct wl_listener *listener, void *data)
r = pixman_region32_rectangles(&damage, &n);
if (n == 0)
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.*/
header.msecs = msecs;
header.nrects = n;