diff --git a/sway/commands/output/color_profile.c b/sway/commands/output/color_profile.c index 98481329b..e81bb0383 100644 --- a/sway/commands/output/color_profile.c +++ b/sway/commands/output/color_profile.c @@ -90,7 +90,7 @@ struct cmd_results *output_cmd_color_profile(int argc, char **argv) { free(icc_path); 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) { free(data); return cmd_results_new(CMD_FAILURE, diff --git a/sway/config/output.c b/sway/config/output.c index 9fb3a12ac..aeb38db63 100644 --- a/sway/config/output.c +++ b/sway/config/output.c @@ -490,6 +490,15 @@ static void queue_output_config(struct output_config *oc, } else { 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) { @@ -549,6 +558,12 @@ static bool finalize_output_config(struct output_config *oc, struct sway_output 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->allow_tearing = oc && oc->allow_tearing > 0;