[mutter/gnome-3-34] wayland/surface: Move shaped-texture synchronization to actor surface
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gnome-3-34] wayland/surface: Move shaped-texture synchronization to actor surface
- Date: Thu, 16 Jan 2020 07:55:10 +0000 (UTC)
commit fd7d0fb3391cc98488d9dbbb9560fd9b6d84bef8
Author: Jonas Ådahl <jadahl gmail com>
Date: Fri Dec 6 18:57:10 2019 +0100
wayland/surface: Move shaped-texture synchronization to actor surface
As with most other state that ends up being pushed to the actor and the
associated shaped texture, also push the texture and the corresponding
metadata from the actor surface. This fixes an issue when a toplevel
surface was reset, where before the subsurface content was not properly
re-initialized, as content state synchronization only happened on
commit, not when asked to synchronize.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/961
(cherry picked from commit f0df07cba3ca308b47c9aefcc8112e8880fd9950)
src/wayland/meta-wayland-actor-surface.c | 23 ++++++++++++++++++++++-
src/wayland/meta-wayland-buffer.c | 16 +++-------------
src/wayland/meta-wayland-buffer.h | 1 -
src/wayland/meta-wayland-dma-buf.c | 2 --
src/wayland/meta-wayland-dma-buf.h | 1 -
src/wayland/meta-wayland-surface.c | 20 --------------------
6 files changed, 25 insertions(+), 38 deletions(-)
---
diff --git a/src/wayland/meta-wayland-actor-surface.c b/src/wayland/meta-wayland-actor-surface.c
index 0ded7f55e..cdcc6b1ca 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 5639c3a17..df1a4adde 100644
--- a/src/wayland/meta-wayland-buffer.c
+++ b/src/wayland/meta-wayland-buffer.c
@@ -198,7 +198,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 ();
@@ -224,7 +223,6 @@ shm_buffer_attach (MetaWaylandBuffer *buffer,
_cogl_texture_get_format (*texture) == format)
{
buffer->is_y_inverted = TRUE;
- *changed_texture = FALSE;
return TRUE;
}
@@ -269,7 +267,6 @@ shm_buffer_attach (MetaWaylandBuffer *buffer,
return FALSE;
*texture = new_texture;
- *changed_texture = TRUE;
buffer->is_y_inverted = TRUE;
return TRUE;
@@ -278,7 +275,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 ();
@@ -294,7 +290,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;
@@ -362,7 +357,6 @@ egl_image_buffer_attach (MetaWaylandBuffer *buffer,
cogl_clear_object (texture);
*texture = cogl_object_ref (buffer->egl_image.texture);
- *changed_texture = TRUE;
return TRUE;
}
@@ -371,7 +365,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;
@@ -381,7 +374,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);
@@ -411,7 +403,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);
@@ -428,17 +419,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 914e03a2f..1ad10d8e5 100644
--- a/src/wayland/meta-wayland-dma-buf.c
+++ b/src/wayland/meta-wayland-dma-buf.c
@@ -158,13 +158,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 d23105d2a..01e23783c 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -682,11 +682,9 @@ meta_wayland_surface_apply_pending_state (MetaWaylandSurface *surface,
if (pending->buffer)
{
GError *error = NULL;
- gboolean changed_texture;
if (!meta_wayland_buffer_attach (pending->buffer,
&surface->texture,
- &changed_texture,
&error))
{
g_warning ("Could not import pending buffer: %s", error->message);
@@ -697,24 +695,6 @@ meta_wayland_surface_apply_pending_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 (pending->buffer);
- is_y_inverted = meta_wayland_buffer_is_y_inverted (pending->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
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]