mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
wayland: Always realize buffers at surface commit time
Clients using EGLStream-backed buffers will expect the stream to be
functional after wl_surface::attach(). That means the compositor-side
stream must be created and a consumer attached to it.
To resolve the above, this change realizes buffers even when the attach
operation is deferred (e.g. synchronized subsurfaces).
https://bugzilla.gnome.org/show_bug.cgi?id=782575
(cherry picked from commit 22723ca371
)
This commit is contained in:
parent
53b040be5c
commit
59d2d5ef3b
@ -88,13 +88,13 @@ meta_wayland_buffer_from_resource (struct wl_resource *resource)
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
gboolean
|
||||||
meta_wayland_buffer_is_realized (MetaWaylandBuffer *buffer)
|
meta_wayland_buffer_is_realized (MetaWaylandBuffer *buffer)
|
||||||
{
|
{
|
||||||
return buffer->type != META_WAYLAND_BUFFER_TYPE_UNKNOWN;
|
return buffer->type != META_WAYLAND_BUFFER_TYPE_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
gboolean
|
||||||
meta_wayland_buffer_realize (MetaWaylandBuffer *buffer)
|
meta_wayland_buffer_realize (MetaWaylandBuffer *buffer)
|
||||||
{
|
{
|
||||||
EGLint format;
|
EGLint format;
|
||||||
@ -125,13 +125,12 @@ meta_wayland_buffer_realize (MetaWaylandBuffer *buffer)
|
|||||||
{
|
{
|
||||||
CoglTexture2D *texture;
|
CoglTexture2D *texture;
|
||||||
|
|
||||||
buffer->egl_stream.stream = stream;
|
|
||||||
buffer->type = META_WAYLAND_BUFFER_TYPE_EGL_STREAM;
|
|
||||||
|
|
||||||
texture = meta_wayland_egl_stream_create_texture (stream, NULL);
|
texture = meta_wayland_egl_stream_create_texture (stream, NULL);
|
||||||
if (!texture)
|
if (!texture)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
buffer->egl_stream.stream = stream;
|
||||||
|
buffer->type = META_WAYLAND_BUFFER_TYPE_EGL_STREAM;
|
||||||
buffer->texture = COGL_TEXTURE (texture);
|
buffer->texture = COGL_TEXTURE (texture);
|
||||||
buffer->is_y_inverted = meta_wayland_egl_stream_is_y_inverted (stream);
|
buffer->is_y_inverted = meta_wayland_egl_stream_is_y_inverted (stream);
|
||||||
|
|
||||||
@ -338,14 +337,12 @@ meta_wayland_buffer_attach (MetaWaylandBuffer *buffer,
|
|||||||
|
|
||||||
if (!meta_wayland_buffer_is_realized (buffer))
|
if (!meta_wayland_buffer_is_realized (buffer))
|
||||||
{
|
{
|
||||||
if (!meta_wayland_buffer_realize (buffer))
|
/* The buffer should have been realized at surface commit time */
|
||||||
{
|
|
||||||
g_set_error (error, G_IO_ERROR,
|
g_set_error (error, G_IO_ERROR,
|
||||||
G_IO_ERROR_FAILED,
|
G_IO_ERROR_FAILED,
|
||||||
"Unknown buffer type");
|
"Unknown buffer type");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
switch (buffer->type)
|
switch (buffer->type)
|
||||||
{
|
{
|
||||||
|
@ -68,6 +68,8 @@ G_DECLARE_FINAL_TYPE (MetaWaylandBuffer, meta_wayland_buffer,
|
|||||||
META, WAYLAND_BUFFER, GObject);
|
META, WAYLAND_BUFFER, GObject);
|
||||||
|
|
||||||
MetaWaylandBuffer * meta_wayland_buffer_from_resource (struct wl_resource *resource);
|
MetaWaylandBuffer * meta_wayland_buffer_from_resource (struct wl_resource *resource);
|
||||||
|
gboolean meta_wayland_buffer_is_realized (MetaWaylandBuffer *buffer);
|
||||||
|
gboolean meta_wayland_buffer_realize (MetaWaylandBuffer *buffer);
|
||||||
gboolean meta_wayland_buffer_attach (MetaWaylandBuffer *buffer,
|
gboolean meta_wayland_buffer_attach (MetaWaylandBuffer *buffer,
|
||||||
GError **error);
|
GError **error);
|
||||||
CoglTexture * meta_wayland_buffer_get_texture (MetaWaylandBuffer *buffer);
|
CoglTexture * meta_wayland_buffer_get_texture (MetaWaylandBuffer *buffer);
|
||||||
|
@ -762,6 +762,10 @@ cleanup:
|
|||||||
static void
|
static void
|
||||||
meta_wayland_surface_commit (MetaWaylandSurface *surface)
|
meta_wayland_surface_commit (MetaWaylandSurface *surface)
|
||||||
{
|
{
|
||||||
|
if (surface->pending->buffer &&
|
||||||
|
!meta_wayland_buffer_is_realized (surface->pending->buffer))
|
||||||
|
meta_wayland_buffer_realize (surface->pending->buffer);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If this is a sub-surface and it is in effective synchronous mode, only
|
* If this is a sub-surface and it is in effective synchronous mode, only
|
||||||
* cache the pending surface state until either one of the following two
|
* cache the pending surface state until either one of the following two
|
||||||
|
Loading…
Reference in New Issue
Block a user