libweston: Add functions to modify disable_planes counter for an output

The member disable_planes of weston_output signifies the recording
status of the output, and is incremented and decremented from various
places. This patch provides helper functions to increment and decrement
the counter. These functions can then be used to do processing, before
and after the recording has started or stopped.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
dev
Ankit Nautiyal 5 years ago
parent a344fe3245
commit 93dde245ee
  1. 4
      compositor/screen-share.c
  2. 4
      libweston/backend-drm/drm.c
  3. 12
      libweston/compositor.c
  4. 8
      libweston/libweston-internal.h
  5. 8
      libweston/screenshooter.c
  6. 4
      libweston/zoom.c
  7. 4
      tests/weston-test.c

@ -1010,7 +1010,7 @@ shared_output_create(struct weston_output *output, int parent_fd)
so->frame_listener.notify = shared_output_repainted;
wl_signal_add(&output->frame_signal, &so->frame_listener);
output->disable_planes++;
weston_output_disable_planes_incr(output);
weston_output_damage(output);
return so;
@ -1031,7 +1031,7 @@ shared_output_destroy(struct shared_output *so)
{
struct ss_shm_buffer *buffer, *bnext;
so->output->disable_planes--;
weston_output_disable_planes_decr(so->output);
wl_list_for_each_safe(buffer, bnext, &so->shm.buffers, link)
ss_shm_buffer_destroy(buffer);

@ -2942,7 +2942,7 @@ recorder_destroy(struct drm_output *output)
vaapi_recorder_destroy(output->recorder);
output->recorder = NULL;
output->base.disable_planes--;
weston_output_disable_planes_decr(&output->base);
wl_list_remove(&output->recorder_frame_listener.link);
weston_log("[libva recorder] done\n");
@ -3024,7 +3024,7 @@ recorder_binding(struct weston_keyboard *keyboard, const struct timespec *time,
return;
}
output->base.disable_planes++;
weston_output_disable_planes_incr(&output->base);
output->recorder_frame_listener.notify = recorder_frame_notify;
wl_signal_add(&output->base.frame_signal,

@ -7752,3 +7752,15 @@ weston_buffer_send_server_error(struct weston_buffer *buffer,
"server error with "
"wl_buffer@%u: %s", id, msg);
}
WL_EXPORT void
weston_output_disable_planes_incr(struct weston_output *output)
{
output->disable_planes++;
}
WL_EXPORT void
weston_output_disable_planes_decr(struct weston_output *output)
{
output->disable_planes--;
}

@ -148,6 +148,14 @@ weston_compositor_xkb_destroy(struct weston_compositor *ec);
int
weston_input_init(struct weston_compositor *compositor);
/* weston_output */
void
weston_output_disable_planes_incr(struct weston_output *output);
void
weston_output_disable_planes_decr(struct weston_output *output);
/* weston_plane */
void

@ -124,7 +124,7 @@ screenshooter_frame_notify(struct wl_listener *listener, void *data)
int32_t stride;
uint8_t *pixels, *d, *s;
output->disable_planes--;
weston_output_disable_planes_decr(output);
wl_list_remove(&listener->link);
stride = l->buffer->width * (PIXMAN_FORMAT_BPP(compositor->read_format) / 8);
pixels = malloc(stride * l->buffer->height);
@ -206,7 +206,7 @@ weston_screenshooter_shoot(struct weston_output *output,
l->data = data;
l->listener.notify = screenshooter_frame_notify;
wl_signal_add(&output->frame_signal, &l->listener);
output->disable_planes++;
weston_output_disable_planes_incr(output);
weston_output_damage(output);
return 0;
@ -445,7 +445,7 @@ weston_recorder_create(struct weston_output *output, const char *filename)
recorder->frame_listener.notify = weston_recorder_frame_notify;
wl_signal_add(&output->frame_signal, &recorder->frame_listener);
output->disable_planes++;
weston_output_disable_planes_incr(output);
weston_output_damage(output);
return recorder;
@ -460,7 +460,7 @@ weston_recorder_destroy(struct weston_recorder *recorder)
{
wl_list_remove(&recorder->frame_listener.link);
close(recorder->fd);
recorder->output->disable_planes--;
weston_output_disable_planes_decr(recorder->output);
weston_recorder_free(recorder);
}

@ -55,7 +55,7 @@ weston_zoom_frame_z(struct weston_animation *animation,
if (output->zoom.active && output->zoom.level <= 0.0) {
output->zoom.active = false;
output->zoom.seat = NULL;
output->disable_planes--;
weston_output_disable_planes_decr(output);
wl_list_remove(&output->zoom.motion_listener.link);
}
output->zoom.spring_z.current = output->zoom.level;
@ -161,7 +161,7 @@ weston_output_activate_zoom(struct weston_output *output,
output->zoom.active = true;
output->zoom.seat = seat;
output->disable_planes++;
weston_output_disable_planes_incr(output);
wl_signal_add(&pointer->motion_signal,
&output->zoom.motion_listener);
}

@ -443,7 +443,7 @@ test_screenshot_frame_notify(struct wl_listener *listener, void *data)
int32_t stride;
uint8_t *pixels, *d, *s;
output->disable_planes--;
weston_output_disable_planes_decr(output);
wl_list_remove(&listener->link);
stride = l->buffer->width * (PIXMAN_FORMAT_BPP(compositor->read_format) / 8);
pixels = malloc(stride * l->buffer->height);
@ -539,7 +539,7 @@ weston_test_screenshot_shoot(struct weston_output *output,
wl_signal_add(&output->frame_signal, &l->listener);
/* Fire off a repaint */
output->disable_planes++;
weston_output_disable_planes_incr(output);
weston_output_schedule_repaint(output);
return true;

Loading…
Cancel
Save