aboutsummaryrefslogtreecommitdiff
path: root/include/wlr
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2019-11-16 23:44:28 +0100
committerDrew DeVault <sir@cmpwn.com>2019-11-21 11:03:43 -0500
commit533ea6d7efe1ebb59c5cc06dbf5c7aee97d947ed (patch)
tree13f7dafe33682302998f49a25846b88578ea6a11 /include/wlr
parent3084cee7bc6209b5431e00fee86eec6355817bad (diff)
presentation-time: make API more flexible
The wlr_presentation_feedback struct now tracks presentation feedback for multiple resources (but still a single surface content update). This allows the compositor to properly send presentation events even when there is more than one frame of latency or when it references a surface's buffer.
Diffstat (limited to 'include/wlr')
-rw-r--r--include/wlr/types/wlr_presentation_time.h29
1 files changed, 23 insertions, 6 deletions
diff --git a/include/wlr/types/wlr_presentation_time.h b/include/wlr/types/wlr_presentation_time.h
index bf1d3ac2..f25bd1a1 100644
--- a/include/wlr/types/wlr_presentation_time.h
+++ b/include/wlr/types/wlr_presentation_time.h
@@ -28,17 +28,19 @@ struct wlr_presentation {
};
struct wlr_presentation_feedback {
- struct wl_resource *resource;
struct wlr_presentation *presentation;
- struct wlr_surface *surface;
+ struct wlr_surface *surface; // NULL if the surface has been destroyed
struct wl_list link; // wlr_presentation::feedbacks
+ struct wl_list resources; // wl_resource_get_link
+
// 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;
+ bool presented;
struct wl_listener surface_commit;
struct wl_listener surface_destroy;
@@ -58,10 +60,25 @@ struct wlr_backend;
struct wlr_presentation *wlr_presentation_create(struct wl_display *display,
struct wlr_backend *backend);
void wlr_presentation_destroy(struct wlr_presentation *presentation);
-void wlr_presentation_send_surface_presented(
- struct wlr_presentation *presentation, struct wlr_surface *surface,
- struct wlr_presentation_event *event);
-void wlr_presentation_surface_sampled(
+/**
+ * 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(
struct wlr_presentation *presentation, struct wlr_surface *surface);
+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);
#endif