diff --git a/src/wayland/meta-wayland-actor-surface.c b/src/wayland/meta-wayland-actor-surface.c index 1aa3335be..711932e12 100644 --- a/src/wayland/meta-wayland-actor-surface.c +++ b/src/wayland/meta-wayland-actor-surface.c @@ -28,6 +28,7 @@ #include "compositor/meta-surface-actor-wayland.h" #include "compositor/meta-window-actor-wayland.h" #include "compositor/region-utils.h" +#include "wayland/meta-wayland-buffer.h" #include "wayland/meta-wayland-surface.h" #include "wayland/meta-window-wayland.h" @@ -147,13 +148,33 @@ meta_wayland_actor_surface_real_sync_actor_state (MetaWaylandActorSurface *actor meta_wayland_surface_role_get_surface (surface_role); MetaSurfaceActor *surface_actor; MetaShapedTexture *stex; + MetaWaylandBuffer *buffer; cairo_rectangle_int_t surface_rect; int geometry_scale; MetaWaylandSurface *subsurface_surface; surface_actor = priv->actor; stex = meta_surface_actor_get_texture (surface_actor); - meta_shaped_texture_set_buffer_scale (stex, surface->scale); + + buffer = surface->buffer_ref.buffer; + if (buffer) + { + CoglSnippet *snippet; + gboolean is_y_inverted; + + 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); + 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); + cogl_clear_object (&snippet); + } + else + { + meta_shaped_texture_set_texture (stex, NULL); + } /* Wayland surface coordinate space -> stage coordinate space */ geometry_scale = meta_wayland_actor_surface_get_geometry_scale (actor_surface); diff --git a/src/wayland/meta-wayland-buffer.c b/src/wayland/meta-wayland-buffer.c index 419e16a76..6236579e7 100644 --- a/src/wayland/meta-wayland-buffer.c +++ b/src/wayland/meta-wayland-buffer.c @@ -222,7 +222,6 @@ shm_buffer_get_cogl_pixel_format (struct wl_shm_buffer *shm_buffer, static gboolean shm_buffer_attach (MetaWaylandBuffer *buffer, CoglTexture **texture, - gboolean *changed_texture, GError **error) { MetaBackend *backend = meta_get_backend (); @@ -248,7 +247,6 @@ shm_buffer_attach (MetaWaylandBuffer *buffer, _cogl_texture_get_format (*texture) == format) { buffer->is_y_inverted = TRUE; - *changed_texture = FALSE; return TRUE; } @@ -293,7 +291,6 @@ shm_buffer_attach (MetaWaylandBuffer *buffer, return FALSE; *texture = new_texture; - *changed_texture = TRUE; buffer->is_y_inverted = TRUE; return TRUE; @@ -302,7 +299,6 @@ shm_buffer_attach (MetaWaylandBuffer *buffer, static gboolean egl_image_buffer_attach (MetaWaylandBuffer *buffer, CoglTexture **texture, - gboolean *changed_texture, GError **error) { MetaBackend *backend = meta_get_backend (); @@ -318,7 +314,6 @@ egl_image_buffer_attach (MetaWaylandBuffer *buffer, if (buffer->egl_image.texture) { - *changed_texture = *texture != buffer->egl_image.texture; cogl_clear_object (texture); *texture = cogl_object_ref (buffer->egl_image.texture); return TRUE; @@ -386,7 +381,6 @@ egl_image_buffer_attach (MetaWaylandBuffer *buffer, cogl_clear_object (texture); *texture = cogl_object_ref (buffer->egl_image.texture); - *changed_texture = TRUE; return TRUE; } @@ -395,7 +389,6 @@ egl_image_buffer_attach (MetaWaylandBuffer *buffer, static gboolean egl_stream_buffer_attach (MetaWaylandBuffer *buffer, CoglTexture **texture, - gboolean *changed_texture, GError **error) { MetaWaylandEglStream *stream = buffer->egl_stream.stream; @@ -405,7 +398,6 @@ egl_stream_buffer_attach (MetaWaylandBuffer *buffer, if (!meta_wayland_egl_stream_attach (stream, error)) return FALSE; - *changed_texture = *texture != buffer->egl_stream.texture; cogl_clear_object (texture); *texture = cogl_object_ref (buffer->egl_stream.texture); @@ -435,7 +427,6 @@ egl_stream_buffer_attach (MetaWaylandBuffer *buffer, gboolean meta_wayland_buffer_attach (MetaWaylandBuffer *buffer, CoglTexture **texture, - gboolean *changed_texture, GError **error) { g_return_val_if_fail (buffer->resource, FALSE); @@ -452,17 +443,16 @@ meta_wayland_buffer_attach (MetaWaylandBuffer *buffer, switch (buffer->type) { case META_WAYLAND_BUFFER_TYPE_SHM: - return shm_buffer_attach (buffer, texture, changed_texture, error); + return shm_buffer_attach (buffer, texture, error); case META_WAYLAND_BUFFER_TYPE_EGL_IMAGE: - return egl_image_buffer_attach (buffer, texture, changed_texture, error); + return egl_image_buffer_attach (buffer, texture, error); #ifdef HAVE_WAYLAND_EGLSTREAM case META_WAYLAND_BUFFER_TYPE_EGL_STREAM: - return egl_stream_buffer_attach (buffer, texture, changed_texture, error); + return egl_stream_buffer_attach (buffer, texture, error); #endif case META_WAYLAND_BUFFER_TYPE_DMA_BUF: return meta_wayland_dma_buf_buffer_attach (buffer, texture, - changed_texture, error); case META_WAYLAND_BUFFER_TYPE_UNKNOWN: g_assert_not_reached (); diff --git a/src/wayland/meta-wayland-buffer.h b/src/wayland/meta-wayland-buffer.h index 5d75a3451..4a503b183 100644 --- a/src/wayland/meta-wayland-buffer.h +++ b/src/wayland/meta-wayland-buffer.h @@ -82,7 +82,6 @@ gboolean meta_wayland_buffer_is_realized (MetaWaylandBuff gboolean meta_wayland_buffer_realize (MetaWaylandBuffer *buffer); gboolean meta_wayland_buffer_attach (MetaWaylandBuffer *buffer, CoglTexture **texture, - gboolean *changed_texture, GError **error); CoglSnippet * meta_wayland_buffer_create_snippet (MetaWaylandBuffer *buffer); gboolean meta_wayland_buffer_is_y_inverted (MetaWaylandBuffer *buffer); diff --git a/src/wayland/meta-wayland-dma-buf.c b/src/wayland/meta-wayland-dma-buf.c index ace8b7e12..ac412d214 100644 --- a/src/wayland/meta-wayland-dma-buf.c +++ b/src/wayland/meta-wayland-dma-buf.c @@ -168,13 +168,11 @@ meta_wayland_dma_buf_realize_texture (MetaWaylandBuffer *buffer, gboolean meta_wayland_dma_buf_buffer_attach (MetaWaylandBuffer *buffer, CoglTexture **texture, - gboolean *changed_texture, GError **error) { if (!meta_wayland_dma_buf_realize_texture (buffer, error)) return FALSE; - *changed_texture = *texture != buffer->dma_buf.texture; cogl_clear_object (texture); *texture = cogl_object_ref (buffer->dma_buf.texture); return TRUE; diff --git a/src/wayland/meta-wayland-dma-buf.h b/src/wayland/meta-wayland-dma-buf.h index 580a3e777..b7f712d8d 100644 --- a/src/wayland/meta-wayland-dma-buf.h +++ b/src/wayland/meta-wayland-dma-buf.h @@ -44,7 +44,6 @@ gboolean meta_wayland_dma_buf_init (MetaWaylandCompositor *compositor); gboolean meta_wayland_dma_buf_buffer_attach (MetaWaylandBuffer *buffer, CoglTexture **texture, - gboolean *changed_texture, GError **error); MetaWaylandDmaBufBuffer * diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index e5d8c1ab1..74e134fb6 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -652,11 +652,9 @@ meta_wayland_surface_apply_state (MetaWaylandSurface *surface, if (state->buffer) { GError *error = NULL; - gboolean changed_texture; if (!meta_wayland_buffer_attach (state->buffer, &surface->texture, - &changed_texture, &error)) { g_warning ("Could not import pending buffer: %s", error->message); @@ -667,24 +665,6 @@ meta_wayland_surface_apply_state (MetaWaylandSurface *surface, g_error_free (error); goto cleanup; } - - if (changed_texture && meta_wayland_surface_get_actor (surface)) - { - MetaShapedTexture *stex; - CoglTexture *texture; - CoglSnippet *snippet; - gboolean is_y_inverted; - - stex = meta_surface_actor_get_texture (meta_wayland_surface_get_actor (surface)); - texture = surface->texture; - snippet = meta_wayland_buffer_create_snippet (state->buffer); - is_y_inverted = meta_wayland_buffer_is_y_inverted (state->buffer); - - 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); - g_clear_pointer (&snippet, cogl_object_unref); - } } else {