diff options
author | Simon Ser <contact@emersion.fr> | 2019-11-17 00:20:26 +0100 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-11-21 11:03:43 -0500 |
commit | 2122e49beaac2453707c136e418e196a41537912 (patch) | |
tree | b976e8ba888e081e5f161241bbec88f2503940f7 /include/wlr | |
parent | 533ea6d7efe1ebb59c5cc06dbf5c7aee97d947ed (diff) |
presentation-time: add helper for common case
Most of the time, compositors just display the surface's current buffer
on an output. Add an helper to make it easy to support presentation-time
in this case.
Diffstat (limited to 'include/wlr')
-rw-r--r-- | include/wlr/types/wlr_presentation_time.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/include/wlr/types/wlr_presentation_time.h b/include/wlr/types/wlr_presentation_time.h index f25bd1a1..9a7e6e70 100644 --- a/include/wlr/types/wlr_presentation_time.h +++ b/include/wlr/types/wlr_presentation_time.h @@ -14,6 +14,9 @@ #include <time.h> #include <wayland-server-core.h> +struct wlr_output; +struct wlr_output_event_present; + struct wlr_presentation { struct wl_global *global; struct wl_list resources; // wl_resource_get_link @@ -42,8 +45,17 @@ struct wlr_presentation_feedback { bool sampled; bool presented; + // Only when the wlr_presentation_surface_sampled_on_output helper has been + // called + struct wlr_output *output; + bool output_committed; + uint32_t output_commit_seq; + struct wl_listener surface_commit; struct wl_listener surface_destroy; + struct wl_listener output_commit; + struct wl_listener output_present; + struct wl_listener output_destroy; }; struct wlr_presentation_event { @@ -81,4 +93,22 @@ void wlr_presentation_feedback_send_presented( void wlr_presentation_feedback_destroy( struct wlr_presentation_feedback *feedback); +/** + * Fill a wlr_presentation_event from a wlr_output_event_present. + */ +void wlr_presentation_event_from_output(struct wlr_presentation_event *event, + const struct wlr_output_event_present *output_event); + +/** + * Mark the current surface's buffer as sampled on the given output. + * + * Instead of calling wlr_presentation_surface_sampled and managing the + * wlr_presentation_feedback itself, the compositor can call this function + * before a wlr_output_commit call to indicate that the surface's current + * contents will be displayed on the output. + */ +void wlr_presentation_surface_sampled_on_output( + struct wlr_presentation *presentation, struct wlr_surface *surface, + struct wlr_output *output); + #endif |