2018-09-29 15:38:06 +02:00
|
|
|
/*
|
|
|
|
* 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_PRESENTATION_TIME_H
|
|
|
|
#define WLR_TYPES_WLR_PRESENTATION_TIME_H
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <time.h>
|
2019-07-27 10:53:54 +02:00
|
|
|
#include <wayland-server-core.h>
|
2018-09-29 15:38:06 +02:00
|
|
|
|
|
|
|
struct wlr_presentation {
|
|
|
|
struct wl_global *global;
|
|
|
|
struct wl_list resources; // wl_resource_get_link
|
|
|
|
struct wl_list feedbacks; // wlr_presentation_feedback::link
|
|
|
|
clockid_t clock;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
struct wl_signal destroy;
|
|
|
|
} events;
|
|
|
|
|
|
|
|
struct wl_listener display_destroy;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct wlr_presentation_feedback {
|
|
|
|
struct wlr_presentation *presentation;
|
2019-11-16 23:44:28 +01:00
|
|
|
struct wlr_surface *surface; // NULL if the surface has been destroyed
|
2018-09-29 15:38:06 +02:00
|
|
|
struct wl_list link; // wlr_presentation::feedbacks
|
|
|
|
|
2019-11-16 23:44:28 +01:00
|
|
|
struct wl_list resources; // wl_resource_get_link
|
|
|
|
|
2019-08-18 06:57:47 +02:00
|
|
|
// The surface contents were committed.
|
|
|
|
bool committed;
|
|
|
|
// The surface contents were sampled by the compositor and are to be
|
|
|
|
// presented on the next flip. Can become true only after committed becomes
|
|
|
|
// true.
|
|
|
|
bool sampled;
|
2019-11-16 23:44:28 +01:00
|
|
|
bool presented;
|
2019-08-18 06:57:47 +02:00
|
|
|
|
2018-09-29 15:38:06 +02:00
|
|
|
struct wl_listener surface_commit;
|
|
|
|
struct wl_listener surface_destroy;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct wlr_presentation_event {
|
|
|
|
struct wlr_output *output;
|
|
|
|
uint64_t tv_sec;
|
|
|
|
uint32_t tv_nsec;
|
|
|
|
uint32_t refresh;
|
|
|
|
uint64_t seq;
|
|
|
|
uint32_t flags; // wp_presentation_feedback_kind
|
|
|
|
};
|
|
|
|
|
2018-10-01 22:57:36 +02:00
|
|
|
struct wlr_backend;
|
|
|
|
|
|
|
|
struct wlr_presentation *wlr_presentation_create(struct wl_display *display,
|
|
|
|
struct wlr_backend *backend);
|
2018-09-29 15:38:06 +02:00
|
|
|
void wlr_presentation_destroy(struct wlr_presentation *presentation);
|
2019-11-16 23:44:28 +01:00
|
|
|
/**
|
|
|
|
* Mark the current surface's buffer as sampled.
|
|
|
|
*
|
|
|
|
* The compositor must call this function when it uses the surface's current
|
|
|
|
* contents (e.g. when rendering the surface's current texture, when
|
|
|
|
* referencing its current buffer, or when directly scanning out its current
|
|
|
|
* buffer). A wlr_presentation_feedback is returned. The compositor should call
|
|
|
|
* wlr_presentation_feedback_send_presented if this content has been displayed,
|
|
|
|
* then wlr_presentation_feedback_destroy.
|
|
|
|
*
|
|
|
|
* NULL is returned if the client hasn't requested presentation feedback for
|
|
|
|
* this surface.
|
|
|
|
*/
|
|
|
|
struct wlr_presentation_feedback *wlr_presentation_surface_sampled(
|
2019-08-18 06:57:47 +02:00
|
|
|
struct wlr_presentation *presentation, struct wlr_surface *surface);
|
2019-11-16 23:44:28 +01:00
|
|
|
void wlr_presentation_feedback_send_presented(
|
|
|
|
struct wlr_presentation_feedback *feedback,
|
|
|
|
struct wlr_presentation_event *event);
|
|
|
|
void wlr_presentation_feedback_destroy(
|
|
|
|
struct wlr_presentation_feedback *feedback);
|
2018-09-29 15:38:06 +02:00
|
|
|
|
|
|
|
#endif
|