Module smithay::wayland::explicit_synchronization[][src]

Expand description

Explicit buffer synchronization per wayland surface

This interface allow clients to switch from a per-buffer signaling of buffer release (via the wl_buffer.release event) to a per-surface signaling using dma_fences. This is notably used for efficient synchronization of OpenGL/Vulkan clients.

At surface commit time, in addition to a buffer the client can have attached two more properties:

  • an acquire dma_fence file descriptor, that the compositor is required to wait on before it will try to access the contents of the associated buffer
  • an ExplicitBufferRelease object, that the compositor is expect to use to signal the client when it has finished using the buffer for this surface (if the same buffer is attached to multiple surfaces, the release only applies for the surface associated with this release object, not the whole buffer).

The use of these dma_fences in conjunction with the graphics stack allows for efficient synchronization between the clients and the compositor.

Usage

First, you need to initialize the global:

use smithay::wayland::explicit_synchronization::*;
init_explicit_synchronization_global(
    &mut display,
    None /* You can insert a logger here */
);

Then when handling a surface commit, you can retrieve the synchronization information for the surface states:

use smithay::wayland::compositor::with_states;
with_states(&surface, |states| {
    let explicit_sync_state = states.cached_state.current::<ExplicitSyncState>();
    /* process the explicit_sync_state */
});

Structs

An object to signal end of use of a buffer

An explicit synchronization state

This surface is not explicitly synchronized

Enums

Possible errors you can send to an ill-behaving clients

Functions

Initialize the explicit synchronization global

Send a synchronization error to a client