1
0
Fork 0
Commit graph

12 commits

Author SHA1 Message Date
Jonas Ådahl
eed4dab0fc 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
2016-11-18 00:00:10 +08:00
Jonas Ådahl
41c96921d6 wayland: Add support for EGL_WAYLAND_Y_INVERTED_WL
Add support for inverted Y Wayland buffers. OpenGL textures are by
default inverted, so adding support for EGL_WAYLAND_Y_INVERTED_WL
effectively means adding support for non-inverted, which makes the
MetaShapedTexture apply a transformation when drawing only when querying
EGL_WAYLAND_Y_INVERTED_WL resulted in the response "EGL_FALSE".

https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
23455985cd wayland: Make MetaWaylandBuffer handle texture generation itself
Don't rely on the Cogl layer having Wayland specific paths by
determining the buffer type and creating the EGLImage ourself, while
using the newly exposed CoglTexture from EGLImage API. This changes the
API used by MetaWaylandSurface to make the MetaWaylandBuffer API be
aware when the buffer is being attached. For SHM and EGL buffers, only
the first time it is attached will result in a new texture being
allocated, but later for EGLStream's, more logic on every attach is
needed.

https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
10a0114856 wayland: Move buffer use count to MetaWaylandSurface
Each wl_surface.commit with a newly attached buffer should result in
one wl_buffer.release for the attached buffer. For example attaching
the same buffer to two different surfaces must always result in two
wl_buffer.release events being emitted by the server. The client is
responsible for counting the wl_buffer.release events and be sure to
have received as many release events as it has attached and committed
the buffer, before reusing it.

https://bugzilla.gnome.org/show_bug.cgi?id=762828
2016-03-29 18:26:10 +08:00
Jonas Ådahl
aa7bc501d5 wayland: Replace buffer destroy wl_signal with a GObject signal
Don't use the libwayland-* utilities when we have our own that do the
same thing.

https://bugzilla.gnome.org/show_bug.cgi?id=762828
2016-03-29 18:02:31 +08:00
Jonas Ådahl
d340c3a6dd wayland: Don't unset surface->buffer when wl_buffer destroyed
Don't unset the surface->buffer if the associated wl_buffer object is
destroyed. The MetaWaylandBuffer doesn't really only represent a
wl_buffer object, but also the data (texture) created from the given
wl_buffer. Thus, for example destroying a released SHM wl_buffer should
not destroy the MetaWaylandBuffer instance, because the texture may
still be used.

This commit also fixes a race where calc_showing would hide a window
because, at the time of calculation whether it should be showing, the
surface's buffer had been destroyed as described above.

https://bugzilla.gnome.org/show_bug.cgi?id=762716
2016-03-01 13:33:13 +08:00
Ray Strode
bed82427c6 wayland: change accessible boolean to use_count counter
Since a buffer can be used by multiple surfaces at once,
we need to release the buffer only after all surfaces
are finished with it.  Currently we track whether or
not to release the buffer based on the accessible boolean.
This commit changes it to a counter to accomodate multiple
users.

Also, each surface needs to know whether not it is done with
the buffer, so this commit adds a buffer_used boolean to the
surface state.

https://bugzilla.gnome.org/show_bug.cgi?id=761613
2016-02-19 08:57:56 -05:00
Ray Strode
e097bc8353 wayland: get rid of buffer->copied_data boolean
We currently track whether or not a buffer can be released early
by looking at the copied_data boolean on the buffer.  This boolean
is, practically speaking, always set to TRUE for shm buffers and is
always false otherwise.

We can just as easily check if the buffer is a shm buffer to decide
whether or not to do an early release.  That's better from a
theoretical point of view since copied_data assumes a 1-to-1
relationship between surface and buffer, which may not actually hold.

This commit drops copied_data and changes the check to instead see
if the buffer is shm.

https://bugzilla.gnome.org/show_bug.cgi?id=761613
2016-02-19 08:57:56 -05:00
Ray Strode
7adbb58736 wayland: don't prematurely release EGL buffers
commit 0165cb6974 changed
mutter to release committed shm buffers as soon as they were
uploaded to the GPU.

It also inadvertently changed mutter to prematurely
release EGL buffers (which never get copied, but get used
directly).

This commit corrects that mistake.

https://bugzilla.gnome.org/show_bug.cgi?id=761312
2016-02-02 11:15:43 -05:00
Ray Strode
0165cb6974 wayland: release buffer after processing commit
When a client is ready for the compositor to read a surface's
shared memory buffer, it tells the compositor via
wl_surface_commit.

From that point forward, the baton is given to the compositor:
it knows it can read the buffer without worring about the client
making changes out from under it.

After the compositor has uploaded the pixel contents to the video
card it is supposed to release the buffer back to the client so that
the client can reuse it for future use.

At the moment, mutter only releases the buffer when a new buffer
is attached.  This is problematic, since it means the client has
to have a second buffer prepared before the compositor gives the
first one back.  Preparing the second buffer potentially involves
copying megabytes of pixel data, so that's suboptimal, and there's
no reason mutter couldn't release the buffer earlier.

This commit changes mutter to release a surface's buffer as soon
as it's done processing the commit request.

https://bugzilla.gnome.org/show_bug.cgi?id=761312
2016-02-01 14:16:17 -05:00
Jasper St. Pierre
f658740043 wayland: Move some buffer manipulation functions to meta-wayland-buffer 2014-10-07 20:42:27 -07:00
Jasper St. Pierre
c1613a16c0 wayland: Put the MetaWaylandBuffer implementation in a new file 2014-10-07 20:42:27 -07:00