summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2016-02-08 16:07:34 -0500
committerRay Strode <rstrode@redhat.com>2016-02-19 08:57:56 -0500
commite097bc8353f70fb47d5b2b40d2a7b12c7fc29855 (patch)
tree6eed40de80ed88b4c8b51e5ba9bae610136922bf
parent4e82a751fbb2733875b3fe37c556c78dd9937574 (diff)
downloadmutter-e097bc8353f70fb47d5b2b40d2a7b12c7fc29855.tar.gz
wayland: get rid of buffer->copied_data boolean
We currently track whether or not a buffer can be released early by looking at the copied_data boolean on the buffer. This boolean is, practically speaking, always set to TRUE for shm buffers and is always false otherwise. We can just as easily check if the buffer is a shm buffer to decide whether or not to do an early release. That's better from a theoretical point of view since copied_data assumes a 1-to-1 relationship between surface and buffer, which may not actually hold. This commit drops copied_data and changes the check to instead see if the buffer is shm. https://bugzilla.gnome.org/show_bug.cgi?id=761613
-rw-r--r--src/wayland/meta-wayland-buffer.c3
-rw-r--r--src/wayland/meta-wayland-buffer.h1
-rw-r--r--src/wayland/meta-wayland-surface.c11
3 files changed, 10 insertions, 5 deletions
diff --git a/src/wayland/meta-wayland-buffer.c b/src/wayland/meta-wayland-buffer.c
index 1d9b0c3b1..bb0e8d234 100644
--- a/src/wayland/meta-wayland-buffer.c
+++ b/src/wayland/meta-wayland-buffer.c
@@ -140,9 +140,6 @@ meta_wayland_buffer_ensure_texture (MetaWaylandBuffer *buffer)
buffer->texture = texture;
- if (shm_buffer)
- buffer->copied_data = TRUE;
-
out:
return buffer->texture;
}
diff --git a/src/wayland/meta-wayland-buffer.h b/src/wayland/meta-wayland-buffer.h
index 22cbcc1f4..9f6a5bf83 100644
--- a/src/wayland/meta-wayland-buffer.h
+++ b/src/wayland/meta-wayland-buffer.h
@@ -41,7 +41,6 @@ struct _MetaWaylandBuffer
uint32_t ref_count;
uint32_t accessible : 1;
- uint32_t copied_data : 1;
};
MetaWaylandBuffer * meta_wayland_buffer_from_resource (struct wl_resource *resource);
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index aa9824655..fc884d9ef 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -648,6 +648,8 @@ static void
apply_pending_state (MetaWaylandSurface *surface,
MetaWaylandPendingState *pending)
{
+ gboolean release_new_buffer = FALSE;
+
if (pending->newly_attached)
{
if (!surface->buffer && surface->window)
@@ -657,9 +659,16 @@ apply_pending_state (MetaWaylandSurface *surface,
if (pending->buffer)
{
+ struct wl_shm_buffer *shm_buffer = wl_shm_buffer_get (pending->buffer->resource);
+
meta_wayland_buffer_take_control (pending->buffer);
CoglTexture *texture = meta_wayland_buffer_ensure_texture (pending->buffer);
meta_surface_actor_wayland_set_texture (META_SURFACE_ACTOR_WAYLAND (surface->surface_actor), texture);
+
+ /* Release the buffer as soon as possible, so the client can reuse it
+ */
+ if (shm_buffer)
+ release_new_buffer = TRUE;
}
}
@@ -669,7 +678,7 @@ apply_pending_state (MetaWaylandSurface *surface,
if (!cairo_region_is_empty (pending->damage))
surface_process_damage (surface, pending->damage);
- if (pending->buffer && pending->buffer->copied_data)
+ if (release_new_buffer)
meta_wayland_buffer_release_control (pending->buffer);
surface->offset_x += pending->dx;