Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit 0c00087

Browse files
committed
output-damage: add wlr_output_damage_step
This does the same as wlr_output_damage_attach_render except it doesn't call wlr_output_attach_render.
1 parent 86b64d3 commit 0c00087

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

include/wlr/types/wlr_output_damage.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ void wlr_output_damage_destroy(struct wlr_output_damage *output_damage);
7676
*/
7777
bool wlr_output_damage_attach_render(struct wlr_output_damage *output_damage,
7878
bool *needs_frame, pixman_region32_t *buffer_damage);
79+
/**
80+
* Advance the output damage state machine. Takes the buffer age as input,
81+
* returns a bool indicating whether rendering a new frame is necessary and the
82+
* accumulated damage.
83+
*/
84+
void wlr_output_damage_step(struct wlr_output_damage *output_damage,
85+
int buffer_age, bool *needs_frame, pixman_region32_t *buffer_damage);
7986
/**
8087
* Accumulates damage and schedules a `frame` event.
8188
*/

types/wlr_output_damage.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,14 @@ bool wlr_output_damage_attach_render(struct wlr_output_damage *output_damage,
150150
return false;
151151
}
152152

153+
wlr_output_damage_step(output_damage, buffer_age, needs_frame, damage);
154+
return true;
155+
}
156+
157+
void wlr_output_damage_step(struct wlr_output_damage *output_damage,
158+
int buffer_age, bool *needs_frame, pixman_region32_t *damage) {
159+
struct wlr_output *output = output_damage->output;
160+
153161
*needs_frame =
154162
output->needs_frame || pixman_region32_not_empty(&output_damage->current);
155163
// Check if we can use damage tracking
@@ -178,8 +186,6 @@ bool wlr_output_damage_attach_render(struct wlr_output_damage *output_damage,
178186
extents->x2 - extents->x1, extents->y2 - extents->y1);
179187
}
180188
}
181-
182-
return true;
183189
}
184190

185191
void wlr_output_damage_add(struct wlr_output_damage *output_damage,

0 commit comments

Comments
 (0)