wayland/buffer: Add 'realization' concept to buffers

Instead of having a way to determine the type of a buffer, add a
realization step that implicitly detects the buffer type. This makes it
possible to both realize (i.e. creating needed objects from the buffer)
and determine the type at the same time, which may be the only possible
way (for example, the only way to know whether a buffer is a EGLStream
is to create the EGLStream from it).

https://bugzilla.gnome.org/show_bug.cgi?id=773629
This commit is contained in:
Jonas Ådahl
2016-12-09 11:15:11 +08:00
parent 0a826da330
commit 405aa8fb9e
2 changed files with 48 additions and 34 deletions

View File

@@ -32,6 +32,14 @@
#include "meta-wayland-types.h"
#include "meta-wayland-egl-stream.h"
typedef enum _MetaWaylandBufferType
{
META_WAYLAND_BUFFER_TYPE_UNKNOWN,
META_WAYLAND_BUFFER_TYPE_SHM,
META_WAYLAND_BUFFER_TYPE_EGL_IMAGE,
META_WAYLAND_BUFFER_TYPE_EGL_STREAM,
} MetaWaylandBufferType;
struct _MetaWaylandBuffer
{
GObject parent;
@@ -42,6 +50,8 @@ struct _MetaWaylandBuffer
CoglTexture *texture;
gboolean is_y_inverted;
MetaWaylandBufferType type;
struct {
MetaWaylandEglStream *stream;
} egl_stream;