|
|
776610 |
From f965b963844ef41e75b42f81005e4675df94e10c Mon Sep 17 00:00:00 2001
|
|
|
776610 |
From: "Miguel A. Vico" <mvicomoya@nvidia.com>
|
|
|
776610 |
Date: Sat, 6 May 2017 03:41:51 +0200
|
|
|
776610 |
Subject: [PATCH] wayland: Always realize buffers at surface commit time
|
|
|
776610 |
|
|
|
776610 |
Clients using EGLStream-backed buffers will expect the stream to be
|
|
|
776610 |
functional after wl_surface::attach(). That means the compositor-side
|
|
|
776610 |
stream must be created and a consumer attached to it.
|
|
|
776610 |
|
|
|
776610 |
To resolve the above, this change realizes buffers even when the attach
|
|
|
776610 |
operation is deferred (e.g. synchronized subsurfaces).
|
|
|
776610 |
|
|
|
776610 |
https://bugzilla.gnome.org/show_bug.cgi?id=782575
|
|
|
776610 |
|
|
|
776610 |
(cherry picked from commit 22723ca37173955d8ef4c6981795e91a85f4feb9)
|
|
|
776610 |
---
|
|
|
776610 |
src/wayland/meta-wayland-buffer.c | 21 +++++++++------------
|
|
|
776610 |
src/wayland/meta-wayland-buffer.h | 2 ++
|
|
|
776610 |
src/wayland/meta-wayland-surface.c | 4 ++++
|
|
|
776610 |
3 files changed, 15 insertions(+), 12 deletions(-)
|
|
|
776610 |
|
|
|
776610 |
diff --git a/src/wayland/meta-wayland-buffer.c b/src/wayland/meta-wayland-buffer.c
|
|
|
776610 |
index 3396f45..b4b1e78 100644
|
|
|
776610 |
--- a/src/wayland/meta-wayland-buffer.c
|
|
|
776610 |
+++ b/src/wayland/meta-wayland-buffer.c
|
|
|
776610 |
@@ -94,13 +94,13 @@ meta_wayland_buffer_get_resource (MetaWaylandBuffer *buffer)
|
|
|
776610 |
return buffer->resource;
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
-static gboolean
|
|
|
776610 |
+gboolean
|
|
|
776610 |
meta_wayland_buffer_is_realized (MetaWaylandBuffer *buffer)
|
|
|
776610 |
{
|
|
|
776610 |
return buffer->type != META_WAYLAND_BUFFER_TYPE_UNKNOWN;
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
-static gboolean
|
|
|
776610 |
+gboolean
|
|
|
776610 |
meta_wayland_buffer_realize (MetaWaylandBuffer *buffer)
|
|
|
776610 |
{
|
|
|
776610 |
EGLint format;
|
|
|
776610 |
@@ -131,13 +131,12 @@ meta_wayland_buffer_realize (MetaWaylandBuffer *buffer)
|
|
|
776610 |
{
|
|
|
776610 |
CoglTexture2D *texture;
|
|
|
776610 |
|
|
|
776610 |
- buffer->egl_stream.stream = stream;
|
|
|
776610 |
- buffer->type = META_WAYLAND_BUFFER_TYPE_EGL_STREAM;
|
|
|
776610 |
-
|
|
|
776610 |
texture = meta_wayland_egl_stream_create_texture (stream, NULL);
|
|
|
776610 |
if (!texture)
|
|
|
776610 |
return FALSE;
|
|
|
776610 |
|
|
|
776610 |
+ buffer->egl_stream.stream = stream;
|
|
|
776610 |
+ buffer->type = META_WAYLAND_BUFFER_TYPE_EGL_STREAM;
|
|
|
776610 |
buffer->texture = COGL_TEXTURE (texture);
|
|
|
776610 |
buffer->is_y_inverted = meta_wayland_egl_stream_is_y_inverted (stream);
|
|
|
776610 |
|
|
|
776610 |
@@ -344,13 +343,11 @@ meta_wayland_buffer_attach (MetaWaylandBuffer *buffer,
|
|
|
776610 |
|
|
|
776610 |
if (!meta_wayland_buffer_is_realized (buffer))
|
|
|
776610 |
{
|
|
|
776610 |
- if (!meta_wayland_buffer_realize (buffer))
|
|
|
776610 |
- {
|
|
|
776610 |
- g_set_error (error, G_IO_ERROR,
|
|
|
776610 |
- G_IO_ERROR_FAILED,
|
|
|
776610 |
- "Unknown buffer type");
|
|
|
776610 |
- return FALSE;
|
|
|
776610 |
- }
|
|
|
776610 |
+ /* The buffer should have been realized at surface commit time */
|
|
|
776610 |
+ g_set_error (error, G_IO_ERROR,
|
|
|
776610 |
+ G_IO_ERROR_FAILED,
|
|
|
776610 |
+ "Unknown buffer type");
|
|
|
776610 |
+ return FALSE;
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
switch (buffer->type)
|
|
|
776610 |
diff --git a/src/wayland/meta-wayland-buffer.h b/src/wayland/meta-wayland-buffer.h
|
|
|
776610 |
index e00a41e..036f9d4 100644
|
|
|
776610 |
--- a/src/wayland/meta-wayland-buffer.h
|
|
|
776610 |
+++ b/src/wayland/meta-wayland-buffer.h
|
|
|
776610 |
@@ -69,6 +69,8 @@ G_DECLARE_FINAL_TYPE (MetaWaylandBuffer, meta_wayland_buffer,
|
|
|
776610 |
|
|
|
776610 |
MetaWaylandBuffer * meta_wayland_buffer_from_resource (struct wl_resource *resource);
|
|
|
776610 |
struct wl_resource * meta_wayland_buffer_get_resource (MetaWaylandBuffer *buffer);
|
|
|
776610 |
+gboolean meta_wayland_buffer_is_realized (MetaWaylandBuffer *buffer);
|
|
|
776610 |
+gboolean meta_wayland_buffer_realize (MetaWaylandBuffer *buffer);
|
|
|
776610 |
gboolean meta_wayland_buffer_attach (MetaWaylandBuffer *buffer,
|
|
|
776610 |
GError **error);
|
|
|
776610 |
CoglTexture * meta_wayland_buffer_get_texture (MetaWaylandBuffer *buffer);
|
|
|
776610 |
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
|
|
|
776610 |
index c9c229e..3c9a404 100644
|
|
|
776610 |
--- a/src/wayland/meta-wayland-surface.c
|
|
|
776610 |
+++ b/src/wayland/meta-wayland-surface.c
|
|
|
776610 |
@@ -765,6 +765,10 @@ cleanup:
|
|
|
776610 |
static void
|
|
|
776610 |
meta_wayland_surface_commit (MetaWaylandSurface *surface)
|
|
|
776610 |
{
|
|
|
776610 |
+ if (surface->pending->buffer &&
|
|
|
776610 |
+ !meta_wayland_buffer_is_realized (surface->pending->buffer))
|
|
|
776610 |
+ meta_wayland_buffer_realize (surface->pending->buffer);
|
|
|
776610 |
+
|
|
|
776610 |
/*
|
|
|
776610 |
* If this is a sub-surface and it is in effective synchronous mode, only
|
|
|
776610 |
* cache the pending surface state until either one of the following two
|
|
|
776610 |
--
|
|
|
776610 |
2.19.1
|
|
|
776610 |
|