Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Commit

Permalink
linux-explicit-synchronization-v1: new protocol implementation
Browse files Browse the repository at this point in the history
This patch adds support for the
linux-explicit-synchronization-unstable-v1 protocol.

To test, run weston-simple-dmabuf-egl.
  • Loading branch information
emersion committed Oct 20, 2021
1 parent 09ebe72 commit 726e5e0
Show file tree
Hide file tree
Showing 4 changed files with 435 additions and 0 deletions.
69 changes: 69 additions & 0 deletions include/wlr/types/wlr_linux_explicit_synchronization_v1.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif

#ifndef WLR_TYPES_WLR_LINUX_EXPLICIT_SYNCHRONIZATION_H
#define WLR_TYPES_WLR_LINUX_EXPLICIT_SYNCHRONIZATION_H

#include <wayland-server-core.h>
#include <wlr/util/addon.h>

struct wlr_linux_surface_synchronization_v1_state {
int acquire_fence_fd;
struct wlr_linux_buffer_release_v1 *buffer_release;
};

struct wlr_linux_surface_synchronization_v1 {
struct wl_resource *resource;
struct wlr_surface *surface;

// private state

struct wlr_addon addon;

struct wlr_linux_surface_synchronization_v1_state pending, current;

struct wl_listener surface_commit;
};

struct wlr_linux_buffer_release_v1 {
struct wl_resource *resource;
};

struct wlr_linux_explicit_synchronization_v1 {
struct wl_global *global;

struct {
struct wl_signal destroy;
} events;

// private state

struct wl_listener display_destroy;
};

/**
* Advertise explicit synchronization support to clients.
*
* The compositor must be prepared to handle fences coming from clients and to
* send release fences correctly. In particular, both the renderer and the
* backend need to support explicit synchronization.
*/
struct wlr_linux_explicit_synchronization_v1 *
wlr_linux_explicit_synchronization_v1_create(struct wl_display *display);

bool wlr_linux_explicit_synchronization_v1_signal_surface_timeline(
struct wlr_linux_explicit_synchronization_v1 *explicit_sync,
struct wlr_surface *surface, struct wlr_render_timeline *timeline,
uint64_t dst_point);

bool wlr_linux_explicit_synchronization_v1_wait_surface_timeline(
struct wlr_linux_explicit_synchronization_v1 *explicit_sync,
struct wlr_surface *surface, struct wlr_render_timeline *timeline,
uint64_t src_point);

#endif
1 change: 1 addition & 0 deletions protocol/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ protocols = {
'idle-inhibit-unstable-v1': wl_protocol_dir / 'unstable/idle-inhibit/idle-inhibit-unstable-v1.xml',
'keyboard-shortcuts-inhibit-unstable-v1': wl_protocol_dir / 'unstable/keyboard-shortcuts-inhibit/keyboard-shortcuts-inhibit-unstable-v1.xml',
'linux-dmabuf-unstable-v1': wl_protocol_dir / 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml',
'linux-explicit-synchronization-unstable-v1': wl_protocol_dir / 'unstable/linux-explicit-synchronization/linux-explicit-synchronization-unstable-v1.xml',
'pointer-constraints-unstable-v1': wl_protocol_dir / 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml',
'pointer-gestures-unstable-v1': wl_protocol_dir / 'unstable/pointer-gestures/pointer-gestures-unstable-v1.xml',
'primary-selection-unstable-v1': wl_protocol_dir / 'unstable/primary-selection/primary-selection-unstable-v1.xml',
Expand Down
1 change: 1 addition & 0 deletions types/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ wlr_files += files(
'wlr_keyboard_shortcuts_inhibit_v1.c',
'wlr_layer_shell_v1.c',
'wlr_linux_dmabuf_v1.c',
'wlr_linux_explicit_synchronization_v1.c',
'wlr_matrix.c',
'wlr_output_damage.c',
'wlr_output_layout.c',
Expand Down
Loading

0 comments on commit 726e5e0

Please sign in to comment.