aboutsummaryrefslogtreecommitdiff
path: root/include/wlr
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-02-11 12:49:30 +0100
committeremersion <contact@emersion.fr>2018-02-11 12:49:30 +0100
commitec837e3c9e08a8334fa7093d7f39af2a2f11e122 (patch)
treecef1eaab483d21a105dce4ef3d4b07d067cf41aa /include/wlr
parent664d7bfe4eb55556be491bb87f8f1c0135d8cac5 (diff)
Introduce wlr_output_damage
Diffstat (limited to 'include/wlr')
-rw-r--r--include/wlr/types/wlr_output_damage.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/include/wlr/types/wlr_output_damage.h b/include/wlr/types/wlr_output_damage.h
new file mode 100644
index 00000000..eadbff29
--- /dev/null
+++ b/include/wlr/types/wlr_output_damage.h
@@ -0,0 +1,45 @@
+#ifndef WLR_TYPES_WLR_OUTPUT_DAMAGE_H
+#define WLR_TYPES_WLR_OUTPUT_DAMAGE_H
+
+#include <pixman.h>
+
+/**
+ * Damage tracking requires to keep track of previous frames' damage. To allow
+ * damage tracking to work with triple buffering, a history of two frames is
+ * required.
+ */
+#define WLR_OUTPUT_DAMAGE_PREVIOUS_LEN 2
+
+struct wlr_output_damage {
+ struct wlr_output *output;
+
+ pixman_region32_t current; // in output-local coordinates
+
+ // circular queue for previous damage
+ pixman_region32_t previous[WLR_OUTPUT_DAMAGE_PREVIOUS_LEN];
+ size_t previous_idx;
+
+ struct {
+ struct wl_signal frame;
+ struct wl_signal destroy;
+ } events;
+
+ struct wl_listener output_destroy;
+ struct wl_listener output_mode;
+ struct wl_listener output_needs_swap;
+ struct wl_listener output_frame;
+};
+
+struct wlr_output_damage *wlr_output_damage_create(struct wlr_output *output);
+void wlr_output_damage_destroy(struct wlr_output_damage *output_damage);
+bool wlr_output_damage_make_current(struct wlr_output_damage *output_damage,
+ bool *needs_swap, pixman_region32_t *damage);
+bool wlr_output_damage_swap_buffers(struct wlr_output_damage *output_damage,
+ struct timespec *when, pixman_region32_t *damage);
+void wlr_output_damage_add(struct wlr_output_damage *output_damage,
+ pixman_region32_t *damage);
+void wlr_output_damage_add_whole(struct wlr_output_damage *output_damage);
+void wlr_output_damage_add_box(struct wlr_output_damage *output_damage,
+ struct wlr_box *box);
+
+#endif