Skip to content
Empty file modified meson/meson-postinstall.sh
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion src/compositor/meta-window-actor-wayland.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ meta_window_actor_wayland_rebuild_surface_tree (MetaWindowActor *actor)
meta_window_actor_get_surface (actor);
MetaWaylandSurface *surface = meta_surface_actor_wayland_get_surface (
META_SURFACE_ACTOR_WAYLAND (surface_actor));
GNode *root_node = surface->subsurface_branch_node;
GNode *root_node = surface->output_state.subsurface_branch_node;
g_autoptr (GList) surface_actors = NULL;
g_autoptr (GList) children = NULL;
GList *l;
Expand Down
2 changes: 2 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,8 @@ if have_wayland
'wayland/meta-wayland-virtual-keyboard.h',
'wayland/meta-wayland-touch.c',
'wayland/meta-wayland-touch.h',
'wayland/meta-wayland-transaction.c',
'wayland/meta-wayland-transaction.h',
'wayland/meta-wayland-types.h',
'wayland/meta-wayland-versions.h',
'wayland/meta-wayland-viewporter.c',
Expand Down
12 changes: 8 additions & 4 deletions src/wayland/meta-wayland-actor-surface.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,18 @@ meta_wayland_actor_surface_real_sync_actor_state (MetaWaylandActorSurface *actor
surface_actor = priv->actor;
stex = meta_surface_actor_get_texture (surface_actor);

buffer = surface->buffer_ref->buffer;
buffer = meta_wayland_surface_get_buffer (surface);
if (buffer)
{
CoglSnippet *snippet;
gboolean is_y_inverted;
CoglTexture *texture;

snippet = meta_wayland_buffer_create_snippet (buffer);
is_y_inverted = meta_wayland_buffer_is_y_inverted (buffer);

meta_shaped_texture_set_texture (stex, surface->texture);
texture = meta_wayland_surface_get_texture (surface);
meta_shaped_texture_set_texture (stex, texture);
meta_shaped_texture_set_snippet (stex, snippet);
meta_shaped_texture_set_is_y_inverted (stex, is_y_inverted);
meta_shaped_texture_set_buffer_scale (stex, surface->scale);
Expand Down Expand Up @@ -270,7 +272,8 @@ meta_wayland_actor_surface_real_sync_actor_state (MetaWaylandActorSurface *actor

meta_shaped_texture_ensure_size_valid (stex);

META_WAYLAND_SURFACE_FOREACH_SUBSURFACE (surface, subsurface_surface)
META_WAYLAND_SURFACE_FOREACH_SUBSURFACE (&surface->output_state,
subsurface_surface)
{
MetaWaylandActorSurface *actor_surface;

Expand Down Expand Up @@ -457,7 +460,8 @@ meta_wayland_actor_surface_reset_actor (MetaWaylandActorSurface *actor_surface)
meta_wayland_surface_role_get_surface (META_WAYLAND_SURFACE_ROLE (actor_surface));
MetaWaylandSurface *subsurface_surface;

META_WAYLAND_SURFACE_FOREACH_SUBSURFACE (surface, subsurface_surface)
META_WAYLAND_SURFACE_FOREACH_SUBSURFACE (&surface->output_state,
subsurface_surface)
{
MetaWaylandActorSurface *actor_surface;

Expand Down
25 changes: 23 additions & 2 deletions src/wayland/meta-wayland-buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ meta_wayland_buffer_realize (MetaWaylandBuffer *buffer)
EGL_TEXTURE_FORMAT, &format,
NULL))
{
buffer->type = META_WAYLAND_BUFFER_TYPE_EGL_IMAGE;
buffer->dma_buf.dma_buf =
meta_wayland_dma_buf_fds_for_wayland_buffer (buffer);
return TRUE;
}

Expand Down Expand Up @@ -506,7 +507,6 @@ meta_wayland_buffer_attach (MetaWaylandBuffer *buffer,
CoglTexture **texture,
GError **error)
{
g_return_val_if_fail (buffer->resource, FALSE);

if (!meta_wayland_buffer_is_realized (buffer))
{
Expand Down Expand Up @@ -566,6 +566,25 @@ meta_wayland_buffer_create_snippet (MetaWaylandBuffer *buffer)
#endif /* HAVE_WAYLAND_EGLSTREAM */
}

void
meta_wayland_buffer_inc_use_count (MetaWaylandBuffer *buffer)
{
g_warn_if_fail (buffer->resource);

buffer->use_count++;
}

void
meta_wayland_buffer_dec_use_count (MetaWaylandBuffer *buffer)
{
g_return_if_fail (buffer->use_count > 0);

buffer->use_count--;

if (buffer->use_count == 0 && buffer->resource)
wl_buffer_send_release (buffer->resource);
}

gboolean
meta_wayland_buffer_is_y_inverted (MetaWaylandBuffer *buffer)
{
Expand Down Expand Up @@ -754,6 +773,8 @@ meta_wayland_buffer_finalize (GObject *object)
{
MetaWaylandBuffer *buffer = META_WAYLAND_BUFFER (object);

g_warn_if_fail (buffer->use_count == 0);

g_clear_pointer (&buffer->egl_image.texture, cogl_object_unref);
#ifdef HAVE_WAYLAND_EGLSTREAM
g_clear_pointer (&buffer->egl_stream.texture, cogl_object_unref);
Expand Down
4 changes: 4 additions & 0 deletions src/wayland/meta-wayland-buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ struct _MetaWaylandBuffer
struct wl_resource *resource;
struct wl_listener destroy_listener;

unsigned int use_count;

gboolean is_y_inverted;

MetaWaylandBufferType type;
Expand Down Expand Up @@ -91,6 +93,8 @@ gboolean meta_wayland_buffer_attach (MetaWaylandBuff
CoglTexture **texture,
GError **error);
CoglSnippet * meta_wayland_buffer_create_snippet (MetaWaylandBuffer *buffer);
void meta_wayland_buffer_inc_use_count (MetaWaylandBuffer *buffer);
void meta_wayland_buffer_dec_use_count (MetaWaylandBuffer *buffer);
gboolean meta_wayland_buffer_is_y_inverted (MetaWaylandBuffer *buffer);
void meta_wayland_buffer_process_damage (MetaWaylandBuffer *buffer,
CoglTexture *texture,
Expand Down
22 changes: 7 additions & 15 deletions src/wayland/meta-wayland-cursor-surface.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,10 @@ meta_wayland_cursor_surface_pre_apply_state (MetaWaylandSurfaceRole *surface_ro
META_WAYLAND_CURSOR_SURFACE (surface_role);
MetaWaylandCursorSurfacePrivate *priv =
meta_wayland_cursor_surface_get_instance_private (cursor_surface);
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);

if (pending->newly_attached && priv->buffer)
{
meta_wayland_surface_unref_buffer_use_count (surface);
meta_wayland_buffer_dec_use_count (priv->buffer);
g_clear_object (&priv->buffer);
}
}
Expand All @@ -157,15 +155,11 @@ meta_wayland_cursor_surface_apply_state (MetaWaylandSurfaceRole *surface_role,
META_WAYLAND_CURSOR_SURFACE (surface_role);
MetaWaylandCursorSurfacePrivate *priv =
meta_wayland_cursor_surface_get_instance_private (cursor_surface);
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaWaylandBuffer *buffer = meta_wayland_surface_get_buffer (surface);

if (pending->newly_attached)
if (pending->buffer)
{
g_set_object (&priv->buffer, buffer);
if (priv->buffer)
meta_wayland_surface_ref_buffer_use_count (surface);
priv->buffer = g_object_ref (pending->buffer);
meta_wayland_buffer_inc_use_count (priv->buffer);
}

wl_list_insert_list (&priv->frame_callbacks,
Expand Down Expand Up @@ -210,8 +204,6 @@ meta_wayland_cursor_surface_dispose (GObject *object)
META_WAYLAND_CURSOR_SURFACE (object);
MetaWaylandCursorSurfacePrivate *priv =
meta_wayland_cursor_surface_get_instance_private (cursor_surface);
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (META_WAYLAND_SURFACE_ROLE (object));
MetaWaylandFrameCallback *cb, *next;

wl_list_for_each_safe (cb, next, &priv->frame_callbacks, link)
Expand All @@ -225,7 +217,7 @@ meta_wayland_cursor_surface_dispose (GObject *object)

if (priv->buffer)
{
meta_wayland_surface_unref_buffer_use_count (surface);
meta_wayland_buffer_dec_use_count (priv->buffer);
g_clear_object (&priv->buffer);
}

Expand All @@ -251,8 +243,8 @@ meta_wayland_cursor_surface_constructed (GObject *object)

if (buffer && buffer->resource)
{
g_set_object (&priv->buffer, buffer);
meta_wayland_surface_ref_buffer_use_count (surface);
priv->buffer = g_object_ref (surface->buffer);
meta_wayland_buffer_inc_use_count (priv->buffer);
}

priv->cursor_sprite = meta_cursor_sprite_wayland_new (surface);
Expand Down
Loading
Loading