From e0bbafc253fc69cd9f0e6629cf33c5d247cc9978 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 12 Mar 2020 13:08:57 +0100 Subject: output: replace wlr_output.damage with a damage event This patch disambiguates the needs_frame event by uncoupling it from damage. A new separate damage event is emitted when the backend damages the output (this happens e.g. VT is changed or software cursors are used). The event specifies the damaged region. The wlr_output.damage field is removed. wlr_output is no longer responsible for tracking its own damage, this is wlr_output_damage's job. This is a breaking change, but wlr_output_damage users shouldn't need an update. Bugs fixed: - Screen flashes on VT switch - Cursor damage issues on the X11 and headless backends Closes: https://github.com/swaywm/sway/issues/5086 --- include/wlr/types/wlr_output.h | 13 ++++++++++--- include/wlr/types/wlr_output_damage.h | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index 436bcac3..9d6e85b3 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -138,7 +138,6 @@ struct wlr_output { bool needs_frame; // damage for cursors and fullscreen surface, in output-local coordinates - pixman_region32_t damage; bool frame_pending; float transform_matrix[9]; @@ -150,8 +149,11 @@ struct wlr_output { struct { // Request to render a frame struct wl_signal frame; - // Emitted when buffers need to be swapped (because software cursors or - // fullscreen damage or because of backend-specific logic) + // Emitted when software cursors or backend-specific logic damage the + // output + struct wl_signal damage; // wlr_output_event_damage + // Emitted when a new frame needs to be committed (because of + // backend-specific logic) struct wl_signal needs_frame; // Emitted right before commit struct wl_signal precommit; // wlr_output_event_precommit @@ -181,6 +183,11 @@ struct wlr_output { void *data; }; +struct wlr_output_event_damage { + struct wlr_output *output; + pixman_region32_t *damage; // output-buffer-local coordinates +}; + struct wlr_output_event_precommit { struct wlr_output *output; struct timespec *when; diff --git a/include/wlr/types/wlr_output_damage.h b/include/wlr/types/wlr_output_damage.h index 708ee9b6..4cdb0a54 100644 --- a/include/wlr/types/wlr_output_damage.h +++ b/include/wlr/types/wlr_output_damage.h @@ -52,6 +52,7 @@ struct wlr_output_damage { struct wl_listener output_transform; struct wl_listener output_scale; struct wl_listener output_needs_frame; + struct wl_listener output_damage; struct wl_listener output_frame; struct wl_listener output_commit; }; -- cgit v1.2.3