mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
output: check for color transform no-op changes
This allows callers to always set this state and not care whether the output currently has the same color transform applied.
This commit is contained in:
parent
0b58bddf13
commit
74ce6c22a5
2 changed files with 16 additions and 2 deletions
|
|
@ -267,6 +267,7 @@ struct wlr_output {
|
||||||
struct {
|
struct {
|
||||||
struct wl_listener display_destroy;
|
struct wl_listener display_destroy;
|
||||||
struct wlr_output_image_description image_description_value;
|
struct wlr_output_image_description image_description_value;
|
||||||
|
struct wlr_color_transform *color_transform;
|
||||||
} WLR_PRIVATE;
|
} WLR_PRIVATE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -242,6 +242,15 @@ static void output_apply_state(struct wlr_output *output,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (state->committed & WLR_OUTPUT_STATE_COLOR_TRANSFORM) {
|
||||||
|
wlr_color_transform_unref(output->color_transform);
|
||||||
|
if (state->color_transform != NULL) {
|
||||||
|
output->color_transform = wlr_color_transform_ref(state->color_transform);
|
||||||
|
} else {
|
||||||
|
output->color_transform = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool geometry_updated = state->committed &
|
bool geometry_updated = state->committed &
|
||||||
(WLR_OUTPUT_STATE_MODE | WLR_OUTPUT_STATE_TRANSFORM |
|
(WLR_OUTPUT_STATE_MODE | WLR_OUTPUT_STATE_TRANSFORM |
|
||||||
WLR_OUTPUT_STATE_SUBPIXEL);
|
WLR_OUTPUT_STATE_SUBPIXEL);
|
||||||
|
|
@ -407,6 +416,7 @@ void wlr_output_finish(struct wlr_output *output) {
|
||||||
|
|
||||||
wlr_swapchain_destroy(output->cursor_swapchain);
|
wlr_swapchain_destroy(output->cursor_swapchain);
|
||||||
wlr_buffer_unlock(output->cursor_front_buffer);
|
wlr_buffer_unlock(output->cursor_front_buffer);
|
||||||
|
wlr_color_transform_unref(output->color_transform);
|
||||||
|
|
||||||
wlr_swapchain_destroy(output->swapchain);
|
wlr_swapchain_destroy(output->swapchain);
|
||||||
|
|
||||||
|
|
@ -515,8 +525,7 @@ const struct wlr_output_image_description *output_pending_image_description(
|
||||||
* Returns a bitfield of the unchanged fields.
|
* Returns a bitfield of the unchanged fields.
|
||||||
*
|
*
|
||||||
* Some fields are not checked: damage always changes in-between frames, the
|
* Some fields are not checked: damage always changes in-between frames, the
|
||||||
* gamma LUT is too expensive to check, the contents of the buffer might have
|
* contents of the buffer might have changed, etc.
|
||||||
* changed, etc.
|
|
||||||
*/
|
*/
|
||||||
static uint32_t output_compare_state(struct wlr_output *output,
|
static uint32_t output_compare_state(struct wlr_output *output,
|
||||||
const struct wlr_output_state *state) {
|
const struct wlr_output_state *state) {
|
||||||
|
|
@ -562,6 +571,10 @@ static uint32_t output_compare_state(struct wlr_output *output,
|
||||||
output->subpixel == state->subpixel) {
|
output->subpixel == state->subpixel) {
|
||||||
fields |= WLR_OUTPUT_STATE_SUBPIXEL;
|
fields |= WLR_OUTPUT_STATE_SUBPIXEL;
|
||||||
}
|
}
|
||||||
|
if ((state->committed & WLR_OUTPUT_STATE_COLOR_TRANSFORM) &&
|
||||||
|
output->color_transform == state->color_transform) {
|
||||||
|
fields |= WLR_OUTPUT_STATE_COLOR_TRANSFORM;
|
||||||
|
}
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue