mutter/src/wayland/meta-wayland-egl-stream.h
Miguel A. Vico 435b3c4bdb wayland: Create EGLStream-backed buffers through wl_eglstream_controller
One of the current limitations of EGLStreams is that there's no way to
resize a surface consumer without re-creating the entire stream.

Therefore, while resizing, clients will send wl_surface::attach requests
so the compositor can re-create its endpoint of the stream, but no
buffer will be available actually. If we proceed with the rest of the
attach operation we'll be presenting an empty buffer.

In order to fix this, a separate wl_eglstream_controller protocol has
been introduced that clients can use to request a stream re-creation
without overloading wl_surface::attach for that purpose.

This change adds the required logic to create the corresponding
wl_eglstream_controller global interface that clients can bind to.

Whenever a client requests a stream to be created, we just need to
create and realize the new EGLStream buffer. The same buffer resource
will be given at a later time to wl_surface::attach, whenever new
content is made available by the application, so we can proceed to
acquire the stream buffer and update the surface state.

https://bugzilla.gnome.org/show_bug.cgi?id=782575
2018-06-15 13:45:29 -07:00

55 lines
2.0 KiB
C

/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2016 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Written by:
* Jonas Ådahl <jadahl@gmail.com>
*/
#ifndef META_WAYLAND_EGL_STREAM_H
#define META_WAYLAND_EGL_STREAM_H
#include <glib.h>
#include <glib-object.h>
#include "cogl/cogl.h"
#include "wayland/meta-wayland-types.h"
gboolean meta_wayland_eglstream_controller_init (MetaWaylandCompositor *compositor);
#define META_TYPE_WAYLAND_EGL_STREAM (meta_wayland_egl_stream_get_type ())
G_DECLARE_FINAL_TYPE (MetaWaylandEglStream, meta_wayland_egl_stream,
META, WAYLAND_EGL_STREAM, GObject);
gboolean meta_wayland_is_egl_stream_buffer (MetaWaylandBuffer *buffer);
MetaWaylandEglStream * meta_wayland_egl_stream_new (MetaWaylandBuffer *buffer,
GError **error);
gboolean meta_wayland_egl_stream_attach (MetaWaylandEglStream *stream,
GError **error);
CoglTexture2D * meta_wayland_egl_stream_create_texture (MetaWaylandEglStream *stream,
GError **error);
CoglSnippet * meta_wayland_egl_stream_create_snippet (void);
gboolean meta_wayland_egl_stream_is_y_inverted (MetaWaylandEglStream *stream);
#endif /* META_WAYLAND_EGL_STREAM_H */