output: add explicit sync API

This commit is contained in:
Simon Ser 2021-10-20 19:29:00 +02:00
parent d2374b3e4e
commit 1ad42bea99
3 changed files with 88 additions and 4 deletions

View file

@ -66,6 +66,8 @@ enum wlr_output_state_field {
WLR_OUTPUT_STATE_RENDER_FORMAT = 1 << 8,
WLR_OUTPUT_STATE_SUBPIXEL = 1 << 9,
WLR_OUTPUT_STATE_LAYERS = 1 << 10,
WLR_OUTPUT_STATE_WAIT_TIMELINE = 1 << 11,
WLR_OUTPUT_STATE_SIGNAL_TIMELINE = 1 << 12,
};
enum wlr_output_state_mode_type {
@ -109,6 +111,11 @@ struct wlr_output_state {
struct wlr_output_layer_state *layers;
size_t layers_len;
struct wlr_drm_syncobj_timeline *wait_timeline;
uint64_t wait_point;
struct wlr_drm_syncobj_timeline *signal_timeline;
uint64_t signal_point;
};
struct wlr_output_impl;
@ -162,6 +169,8 @@ struct wlr_output {
// true for example with VR headsets
bool non_desktop;
// Whether wait/signal timelines are supported
bool timeline;
// Commit sequence number. Incremented on each commit, may overflow.
uint32_t commit_seq;
@ -536,6 +545,33 @@ void wlr_output_state_set_damage(struct wlr_output_state *state,
*/
void wlr_output_state_set_layers(struct wlr_output_state *state,
struct wlr_output_layer_state *layers, size_t layers_len);
/**
* Set a timeline point to wait on before displaying the next frame.
*
* Committing a wait timeline point without a buffer is invalid.
*
* There is only a single wait timeline point, waiting for multiple timeline
* points is unsupported.
*
* Support for this feature is advertised by the timeline field in
* struct wlr_output.
*/
void wlr_output_state_set_wait_timeline(struct wlr_output_state *state,
struct wlr_drm_syncobj_timeline *timeline, uint64_t src_point);
/**
* Set a timeline point to be signalled when the frame is no longer being used
* by the backend.
*
* Committing a signal timeline point without a buffer is invalid.
*
* There is only a single signal timeline point, signalling multiple timeline
* points is unsupported.
*
* Support for this feature is advertised by the timeline field in
* struct wlr_output.
*/
void wlr_output_state_set_signal_timeline(struct wlr_output_state *state,
struct wlr_drm_syncobj_timeline *timeline, uint64_t dst_point);
/**
* Copies the output state from src to dst. It is safe to then