Add support for BT2020 primaries

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4976
This commit is contained in:
Simon Ser 2025-01-27 21:00:54 +01:00
parent d093c2e358
commit 9e805f06f0
2 changed files with 16 additions and 1 deletions

View file

@ -90,7 +90,7 @@ struct cmd_results *output_cmd_color_profile(int argc, char **argv) {
free(icc_path); free(icc_path);
struct wlr_color_transform *tmp = struct wlr_color_transform *tmp =
wlr_color_transform_init_linear_to_icc(data, size); wlr_color_transform_init_linear_to_icc(WLR_COLOR_NAMED_PRIMARIES_SRGB, data, size);
if (!tmp) { if (!tmp) {
free(data); free(data);
return cmd_results_new(CMD_FAILURE, return cmd_results_new(CMD_FAILURE,

View file

@ -490,6 +490,15 @@ static void queue_output_config(struct output_config *oc,
} else { } else {
wlr_output_state_set_render_format(pending, DRM_FORMAT_XRGB8888); wlr_output_state_set_render_format(pending, DRM_FORMAT_XRGB8888);
} }
if (oc && oc->color_transform == NULL && oc->render_bit_depth == RENDER_BIT_DEPTH_10 &&
(wlr_output->supported_primaries & WLR_COLOR_NAMED_PRIMARIES_BT2020) &&
server.renderer->features.output_color_transform) {
const struct wlr_output_image_description image_desc = {
.primaries = WLR_COLOR_NAMED_PRIMARIES_BT2020,
};
wlr_output_state_set_image_description(pending, &image_desc);
}
} }
static bool finalize_output_config(struct output_config *oc, struct sway_output *output) { static bool finalize_output_config(struct output_config *oc, struct sway_output *output) {
@ -549,6 +558,12 @@ static bool finalize_output_config(struct output_config *oc, struct sway_output
output->color_transform = NULL; output->color_transform = NULL;
} }
if (output->color_transform == NULL && oc && oc->render_bit_depth == RENDER_BIT_DEPTH_10 &&
(wlr_output->supported_primaries & WLR_COLOR_NAMED_PRIMARIES_BT2020) &&
server.renderer->features.output_color_transform) {
output->color_transform = wlr_color_transform_init_srgb(WLR_COLOR_NAMED_PRIMARIES_BT2020);
}
output->max_render_time = oc && oc->max_render_time > 0 ? oc->max_render_time : 0; output->max_render_time = oc && oc->max_render_time > 0 ? oc->max_render_time : 0;
output->allow_tearing = oc && oc->allow_tearing > 0; output->allow_tearing = oc && oc->allow_tearing > 0;