wayland: Add support for EGLStream client buffers

This commit adds for a new type of buffer being attached to a Wayland
surface: buffers from an EGLStream. These buffers behave very
differently from regular Wayland buffers; instead of each buffer
reperesenting an actual frame, the same buffer is attached over and
over again, and EGL API is used to switch the content of the OpenGL
texture associated with the buffer attached. It more or less
side-tracks the Wayland buffer handling.

It is implemented by creating a MetaWaylandEglStream object, dealing
with the EGLStream state. The lifetime of the MetaWaylandEglStream is
tied to the texture object (CoglTexture), which is referenced-counted
and owned by both the actors and the MetaWaylandBuffer.

When the buffer is reattached and committed, the EGLStream is triggered
to switch the content of the associated texture to the new content.
This means that one cannot keep old texture content around without
copying, so any feature relying on that will effectively be broken.

https://bugzilla.gnome.org/show_bug.cgi?id=773629
This commit is contained in:
Jonas Ådahl
2016-10-20 15:59:09 +08:00
parent f5bdf75f70
commit eed4dab0fc
7 changed files with 406 additions and 0 deletions

View File

@ -30,6 +30,7 @@
#include <wayland-server.h>
#include "meta-wayland-types.h"
#include "meta-wayland-egl-stream.h"
struct _MetaWaylandBuffer
{
@ -40,6 +41,10 @@ struct _MetaWaylandBuffer
CoglTexture *texture;
gboolean is_y_inverted;
struct {
MetaWaylandEglStream *stream;
} egl_stream;
};
#define META_TYPE_WAYLAND_BUFFER (meta_wayland_buffer_get_type ())
@ -50,6 +55,7 @@ MetaWaylandBuffer * meta_wayland_buffer_from_resource (struct wl_resou
gboolean meta_wayland_buffer_attach (MetaWaylandBuffer *buffer,
GError **error);
CoglTexture * meta_wayland_buffer_get_texture (MetaWaylandBuffer *buffer);
CoglSnippet * meta_wayland_buffer_create_snippet (MetaWaylandBuffer *buffer);
gboolean meta_wayland_buffer_is_y_inverted (MetaWaylandBuffer *buffer);
void meta_wayland_buffer_process_damage (MetaWaylandBuffer *buffer,
cairo_region_t *region);