mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-03-21 05:34:09 -04:00
output: Add color-representation to output state
Add color_representation to wlr_output_state, holding color representation metadata about the primary buffer. This can be set using wlr_output_state_set_primary_color_representation() and a new enum value WLR_OUTPUT_STATE_COLOR_REPRESENTATION in wlr_output_state.committed indicates when this data is present. Also add color-representation to wlr_output, and discard color-representation in wlr_output_state if it matches what's already been committed to the output.
This commit is contained in:
parent
1fa8bb8f7a
commit
58c158dba6
3 changed files with 38 additions and 0 deletions
|
|
@ -233,6 +233,11 @@ static void output_apply_state(struct wlr_output *output,
|
|||
output->transform = state->transform;
|
||||
}
|
||||
|
||||
if (state->committed & WLR_OUTPUT_STATE_COLOR_REPRESENTATION) {
|
||||
output->color_encoding = state->color_encoding;
|
||||
output->color_range = state->color_range;
|
||||
}
|
||||
|
||||
if (state->committed & WLR_OUTPUT_STATE_IMAGE_DESCRIPTION) {
|
||||
if (state->image_description != NULL) {
|
||||
output->image_description_value = *state->image_description;
|
||||
|
|
@ -580,6 +585,11 @@ static uint32_t output_compare_state(struct wlr_output *output,
|
|||
output->color_transform == state->color_transform) {
|
||||
fields |= WLR_OUTPUT_STATE_COLOR_TRANSFORM;
|
||||
}
|
||||
if ((state->committed & WLR_OUTPUT_STATE_COLOR_REPRESENTATION) &&
|
||||
output->color_encoding == state->color_encoding &&
|
||||
output->color_range == state->color_range) {
|
||||
fields |= WLR_OUTPUT_STATE_COLOR_REPRESENTATION;
|
||||
}
|
||||
return fields;
|
||||
}
|
||||
|
||||
|
|
@ -632,6 +642,10 @@ static bool output_basic_test(struct wlr_output *output,
|
|||
wlr_log(WLR_DEBUG, "Tried to set signal timeline without a buffer");
|
||||
return false;
|
||||
}
|
||||
if (state->committed & WLR_OUTPUT_STATE_COLOR_REPRESENTATION) {
|
||||
wlr_log(WLR_DEBUG, "Tried to set color representation without a buffer");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (state->committed & WLR_OUTPUT_STATE_RENDER_FORMAT) {
|
||||
|
|
|
|||
|
|
@ -141,6 +141,14 @@ bool wlr_output_state_set_image_description(struct wlr_output_state *state,
|
|||
return true;
|
||||
}
|
||||
|
||||
void wlr_output_state_set_color_encoding_and_range(
|
||||
struct wlr_output_state *state,
|
||||
enum wlr_color_encoding encoding, enum wlr_color_range range) {
|
||||
state->committed |= WLR_OUTPUT_STATE_COLOR_REPRESENTATION;
|
||||
state->color_encoding = encoding;
|
||||
state->color_range = range;
|
||||
}
|
||||
|
||||
bool wlr_output_state_copy(struct wlr_output_state *dst,
|
||||
const struct wlr_output_state *src) {
|
||||
struct wlr_output_state copy = *src;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue