output: add presentation refresh prediction

This commit is contained in:
emersion 2018-10-02 12:11:09 +02:00
parent abd3e995ab
commit eac7c2ad2f
9 changed files with 47 additions and 23 deletions

View file

@ -45,7 +45,7 @@ void wlr_output_update_enabled(struct wlr_output *output, bool enabled);
void wlr_output_update_needs_swap(struct wlr_output *output);
void wlr_output_damage_whole(struct wlr_output *output);
void wlr_output_send_frame(struct wlr_output *output);
void wlr_output_send_present(struct wlr_output *output, struct timespec *when,
unsigned seq, uint32_t flags);
void wlr_output_send_present(struct wlr_output *output,
struct wlr_output_event_present *event);
#endif

View file

@ -130,15 +130,28 @@ struct wlr_output_event_swap_buffers {
};
enum wlr_output_present_flag {
// The presentation was synchronized to the "vertical retrace" by the
// display hardware such that tearing does not happen.
WLR_OUTPUT_PRESENT_VSYNC = 0x1,
// The display hardware provided measurements that the hardware driver
// converted into a presentation timestamp.
WLR_OUTPUT_PRESENT_HW_CLOCK = 0x2,
// The display hardware signalled that it started using the new image
// content.
WLR_OUTPUT_PRESENT_HW_COMPLETION = 0x4,
// The presentation of this update was done zero-copy.
WLR_OUTPUT_PRESENT_ZERO_COPY = 0x8,
};
struct wlr_output_event_present {
struct wlr_output *output;
// Time when the content update turned into light the first time.
struct timespec *when;
// Vertical retrace counter. Zero if unavailable.
unsigned seq;
// Prediction of how many nanoseconds after `when` the very next output
// refresh may occur. Zero if unknown.
int refresh; // nsec
uint32_t flags; // enum wlr_output_present_flag
};