aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-08-19 15:27:32 +0200
committerSimon Ser <contact@emersion.fr>2023-02-20 18:38:09 +0100
commit3e0ce761ad9b081690ee64e37807781b33a4289c (patch)
treeaa06b644479e9c5edca57e1d29b3fde530ff1e59
parent2f29b0c4381a8b544eff89d8be306154a808302e (diff)
output: add wlr_output_set_layers()
-rw-r--r--include/wlr/types/wlr_output.h10
-rw-r--r--include/wlr/types/wlr_output_layer.h3
-rw-r--r--types/output/output.c7
3 files changed, 19 insertions, 1 deletions
diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h
index 5731eb91..4f9e3e11 100644
--- a/include/wlr/types/wlr_output.h
+++ b/include/wlr/types/wlr_output.h
@@ -435,6 +435,16 @@ uint32_t wlr_output_preferred_read_format(struct wlr_output *output);
void wlr_output_set_damage(struct wlr_output *output,
const pixman_region32_t *damage);
/**
+ * Set the output layers state.
+ *
+ * See struct wlr_output_layer for more details on output layers.
+ *
+ * This state is double-buffered, see wlr_output_commit(). The layers array
+ * must remain valid until the wlr_output_test() or wlr_output_commit() call.
+ */
+void wlr_output_set_layers(struct wlr_output *output,
+ struct wlr_output_layer_state *layers, size_t layers_len);
+/**
* Test whether the pending output state would be accepted by the backend. If
* this function returns true, wlr_output_commit() can only fail due to a
* runtime error.
diff --git a/include/wlr/types/wlr_output_layer.h b/include/wlr/types/wlr_output_layer.h
index 92980108..e9b899a9 100644
--- a/include/wlr/types/wlr_output_layer.h
+++ b/include/wlr/types/wlr_output_layer.h
@@ -21,7 +21,8 @@
*
* To configure output layers, callers should call wlr_output_layer_create() to
* create layers, attach struct wlr_output_layer_state onto
- * struct wlr_output_state to describe their new state, and commit the output.
+ * struct wlr_output_state via wlr_output_set_layers() to describe their new
+ * state, and commit the output via wlr_output_commit().
*
* Backends may have arbitrary limitations when it comes to displaying output
* layers. Backends indicate whether or not a layer can be displayed via
diff --git a/types/output/output.c b/types/output/output.c
index c0d5719e..b5157275 100644
--- a/types/output/output.c
+++ b/types/output/output.c
@@ -486,6 +486,13 @@ void wlr_output_set_damage(struct wlr_output *output,
output->pending.committed |= WLR_OUTPUT_STATE_DAMAGE;
}
+void wlr_output_set_layers(struct wlr_output *output,
+ struct wlr_output_layer_state *layers, size_t layers_len) {
+ output->pending.committed |= WLR_OUTPUT_STATE_LAYERS;
+ output->pending.layers = layers;
+ output->pending.layers_len = layers_len;
+}
+
static void output_state_clear_gamma_lut(struct wlr_output_state *state) {
free(state->gamma_lut);
state->gamma_lut = NULL;