wayland/surface: Call meta_wayland_buffer_attach from surface commit

Preparation for potentially calling meta_wayland_transaction_apply some
time after surface commit, in which case doing it in the former would be
too late: The client may legally destroy the attached wl_buffer
immediately after commit, in which case meta_wayland_buffer_attach would
spuriously fail and disconnect the client (or possibly even crash mutter
due to NULL error).

Requires splitting up the surface texture between protocol and output
state, and propagating from the former to the latter via
MetaWaylandSurfaceState.

v2: (Jonas Ådahl)
* Move meta_wayland_surface_get_texture call to separate line.
* Use g_autoptr for GError.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1880>
This commit is contained in:
Michel Dänzer
2022-07-13 17:10:05 +02:00
committed by Michel Dänzer
parent 80c6b7d82b
commit 79dc41499d
4 changed files with 48 additions and 38 deletions

View File

@ -561,8 +561,6 @@ meta_wayland_buffer_attach (MetaWaylandBuffer *buffer,
CoglTexture **texture,
GError **error)
{
g_return_val_if_fail (buffer->resource, FALSE);
COGL_TRACE_BEGIN_SCOPED (MetaWaylandBufferAttach, "WaylandBuffer (attach)");
if (!meta_wayland_buffer_is_realized (buffer))