compositor: Fold weston_buffer_post_release into weston_buffer_reference

Nothing else calls weston_buffer_post_release and the ref-counting and
sending the release event is essentially what weston_buffer_reference is
all about.
dev
Kristian Høgsberg 12 years ago
parent 63093a35ea
commit 2034780cb2
  1. 17
      src/compositor.c
  2. 3
      src/compositor.h

@ -998,7 +998,12 @@ weston_buffer_reference(struct weston_buffer_reference *ref,
struct wl_buffer *buffer) struct wl_buffer *buffer)
{ {
if (ref->buffer && buffer != ref->buffer) { if (ref->buffer && buffer != ref->buffer) {
weston_buffer_post_release(ref->buffer); ref->buffer->busy_count--;
if (ref->buffer->busy_count == 0) {
assert(ref->buffer->resource.client != NULL);
wl_resource_queue_event(&ref->buffer->resource,
WL_BUFFER_RELEASE);
}
wl_list_remove(&ref->destroy_listener.link); wl_list_remove(&ref->destroy_listener.link);
} }
@ -1043,16 +1048,6 @@ weston_compositor_damage_all(struct weston_compositor *compositor)
weston_output_damage(output); weston_output_damage(output);
} }
WL_EXPORT void
weston_buffer_post_release(struct wl_buffer *buffer)
{
if (--buffer->busy_count > 0)
return;
assert(buffer->resource.client != NULL);
wl_resource_queue_event(&buffer->resource, WL_BUFFER_RELEASE);
}
WL_EXPORT void WL_EXPORT void
weston_output_damage(struct weston_output *output) weston_output_damage(struct weston_output *output)
{ {

@ -697,9 +697,6 @@ weston_surface_move_to_plane(struct weston_surface *surface,
void void
weston_surface_unmap(struct weston_surface *surface); weston_surface_unmap(struct weston_surface *surface);
void
weston_buffer_post_release(struct wl_buffer *buffer);
void void
weston_buffer_reference(struct weston_buffer_reference *ref, weston_buffer_reference(struct weston_buffer_reference *ref,
struct wl_buffer *buffer); struct wl_buffer *buffer);

Loading…
Cancel
Save