aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/wlr/types/wlr_output.h1
-rw-r--r--types/output/output.c14
-rw-r--r--types/output/state.c13
3 files changed, 16 insertions, 12 deletions
diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h
index 4f9e3e11..cfd21325 100644
--- a/include/wlr/types/wlr_output.h
+++ b/include/wlr/types/wlr_output.h
@@ -543,6 +543,7 @@ bool wlr_output_cursor_move(struct wlr_output_cursor *cursor,
void wlr_output_cursor_destroy(struct wlr_output_cursor *cursor);
+void wlr_output_state_finish(struct wlr_output_state *state);
void wlr_output_state_set_enabled(struct wlr_output_state *state,
bool enabled);
void wlr_output_state_set_mode(struct wlr_output_state *state,
diff --git a/types/output/output.c b/types/output/output.c
index b5157275..db69f016 100644
--- a/types/output/output.c
+++ b/types/output/output.c
@@ -324,16 +324,6 @@ static void output_state_init(struct wlr_output_state *state) {
pixman_region32_init(&state->damage);
}
-static void output_state_finish(struct wlr_output_state *state) {
- wlr_buffer_unlock(state->buffer);
- // struct wlr_buffer is ref'counted, so the pointer may remain valid after
- // wlr_buffer_unlock(). Reset the field to NULL to ensure nobody mistakenly
- // reads it after output_state_finish().
- state->buffer = NULL;
- pixman_region32_fini(&state->damage);
- free(state->gamma_lut);
-}
-
static void output_state_move(struct wlr_output_state *dst,
struct wlr_output_state *src) {
*dst = *src;
@@ -425,7 +415,7 @@ void wlr_output_destroy(struct wlr_output *output) {
free(output->model);
free(output->serial);
- output_state_finish(&output->pending);
+ wlr_output_state_finish(&output->pending);
if (output->impl && output->impl->destroy) {
output->impl->destroy(output);
@@ -887,7 +877,7 @@ bool wlr_output_commit(struct wlr_output *output) {
}
bool ok = wlr_output_commit_state(output, &state);
- output_state_finish(&state);
+ wlr_output_state_finish(&state);
return ok;
}
diff --git a/types/output/state.c b/types/output/state.c
index 08c1a9e8..d81f928a 100644
--- a/types/output/state.c
+++ b/types/output/state.c
@@ -1,5 +1,18 @@
+#include <stdlib.h>
#include "types/wlr_output.h"
+void wlr_output_state_finish(struct wlr_output_state *state) {
+ wlr_buffer_unlock(state->buffer);
+ // struct wlr_buffer is ref'counted, so the pointer may remain valid after
+ // wlr_buffer_unlock(). Reset the field to NULL to ensure nobody mistakenly
+ // reads it after output_state_finish().
+ state->buffer = NULL;
+ if (state->committed & WLR_OUTPUT_STATE_DAMAGE) {
+ pixman_region32_fini(&state->damage);
+ }
+ free(state->gamma_lut);
+}
+
void wlr_output_state_set_enabled(struct wlr_output_state *state,
bool enabled) {
state->committed |= WLR_OUTPUT_STATE_ENABLED;