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
|
|
@ -77,6 +77,7 @@ enum wlr_output_state_field {
|
||||||
WLR_OUTPUT_STATE_SIGNAL_TIMELINE = 1 << 11,
|
WLR_OUTPUT_STATE_SIGNAL_TIMELINE = 1 << 11,
|
||||||
WLR_OUTPUT_STATE_COLOR_TRANSFORM = 1 << 12,
|
WLR_OUTPUT_STATE_COLOR_TRANSFORM = 1 << 12,
|
||||||
WLR_OUTPUT_STATE_IMAGE_DESCRIPTION = 1 << 13,
|
WLR_OUTPUT_STATE_IMAGE_DESCRIPTION = 1 << 13,
|
||||||
|
WLR_OUTPUT_STATE_COLOR_REPRESENTATION = 1 << 14,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum wlr_output_state_mode_type {
|
enum wlr_output_state_mode_type {
|
||||||
|
|
@ -142,6 +143,10 @@ struct wlr_output_state {
|
||||||
* regular page-flip at the next wlr_output.frame event. */
|
* regular page-flip at the next wlr_output.frame event. */
|
||||||
bool tearing_page_flip;
|
bool tearing_page_flip;
|
||||||
|
|
||||||
|
// Set if (committed & WLR_OUTPUT_STATE_COLOR_REPRESENTATION)
|
||||||
|
enum wlr_color_encoding color_encoding;
|
||||||
|
enum wlr_color_range color_range;
|
||||||
|
|
||||||
enum wlr_output_state_mode_type mode_type;
|
enum wlr_output_state_mode_type mode_type;
|
||||||
struct wlr_output_mode *mode;
|
struct wlr_output_mode *mode;
|
||||||
struct {
|
struct {
|
||||||
|
|
@ -205,6 +210,8 @@ struct wlr_output {
|
||||||
enum wl_output_transform transform;
|
enum wl_output_transform transform;
|
||||||
enum wlr_output_adaptive_sync_status adaptive_sync_status;
|
enum wlr_output_adaptive_sync_status adaptive_sync_status;
|
||||||
uint32_t render_format;
|
uint32_t render_format;
|
||||||
|
enum wlr_color_encoding color_encoding;
|
||||||
|
enum wlr_color_range color_range;
|
||||||
const struct wlr_output_image_description *image_description;
|
const struct wlr_output_image_description *image_description;
|
||||||
|
|
||||||
// Indicates whether making changes to adaptive sync status is supported.
|
// Indicates whether making changes to adaptive sync status is supported.
|
||||||
|
|
@ -625,6 +632,15 @@ void wlr_output_state_set_color_transform(struct wlr_output_state *state,
|
||||||
bool wlr_output_state_set_image_description(struct wlr_output_state *state,
|
bool wlr_output_state_set_image_description(struct wlr_output_state *state,
|
||||||
const struct wlr_output_image_description *image_desc);
|
const struct wlr_output_image_description *image_desc);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the color encoding and range of the primary scanout buffer.
|
||||||
|
*
|
||||||
|
* Pass WLR_COLOR_ENCODING_NONE / WLR_COLOR_RANGE_NONE to reset to defaults.
|
||||||
|
*/
|
||||||
|
void wlr_output_state_set_color_encoding_and_range(
|
||||||
|
struct wlr_output_state *state,
|
||||||
|
enum wlr_color_encoding encoding, enum wlr_color_range range);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copies the output state from src to dst. It is safe to then
|
* Copies the output state from src to dst. It is safe to then
|
||||||
* wlr_output_state_finish() src and have dst still be valid.
|
* wlr_output_state_finish() src and have dst still be valid.
|
||||||
|
|
|
||||||
|
|
@ -233,6 +233,11 @@ static void output_apply_state(struct wlr_output *output,
|
||||||
output->transform = state->transform;
|
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->committed & WLR_OUTPUT_STATE_IMAGE_DESCRIPTION) {
|
||||||
if (state->image_description != NULL) {
|
if (state->image_description != NULL) {
|
||||||
output->image_description_value = *state->image_description;
|
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) {
|
output->color_transform == state->color_transform) {
|
||||||
fields |= WLR_OUTPUT_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;
|
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");
|
wlr_log(WLR_DEBUG, "Tried to set signal timeline without a buffer");
|
||||||
return false;
|
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) {
|
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;
|
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,
|
bool wlr_output_state_copy(struct wlr_output_state *dst,
|
||||||
const struct wlr_output_state *src) {
|
const struct wlr_output_state *src) {
|
||||||
struct wlr_output_state copy = *src;
|
struct wlr_output_state copy = *src;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue