color_management_v1: add create windows scrgb

v2: Remove assert blocking feature, gate feature behind compositor
    enabling it, and set get_info_allowed to false for the
    descriptor returned
v3: Whoops, made a minor error without testing it first. Thanks, CI.
v4: Add default luminance level response for linear color. Thanks,
    Dominick DiMaggio @njdom24
v5: Revert v4, and instead use new implementation of
    set_luminances to apply a color luminance range
v6: Move luminances declaration to the correct place
This commit is contained in:
Christopher Snowhill 2025-08-20 18:04:14 -07:00
parent 5994c3d055
commit 5a13fa848a

View file

@ -908,9 +908,25 @@ static void manager_handle_create_parametric_creator(struct wl_client *client,
static void manager_handle_create_windows_scrgb(struct wl_client *client, static void manager_handle_create_windows_scrgb(struct wl_client *client,
struct wl_resource *manager_resource, uint32_t id) { struct wl_resource *manager_resource, uint32_t id) {
wl_resource_post_error(manager_resource, struct wlr_color_manager_v1 *manager = manager_from_resource(manager_resource);
WP_COLOR_MANAGER_V1_ERROR_UNSUPPORTED_FEATURE, if (!manager->features.windows_scrgb) {
"get_windows_scrgb is not supported"); wl_resource_post_error(manager_resource,
WP_COLOR_MANAGER_V1_ERROR_UNSUPPORTED_FEATURE,
"get_windows_scrgb is not supported");
return;
}
struct wlr_image_description_v1_data data = {
.tf_named = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_LINEAR,
.primaries_named = WP_COLOR_MANAGER_V1_PRIMARIES_SRGB,
.has_luminances = true,
.luminances = (struct wlr_color_luminances){
.min = 0.02,
.max = 80,
.reference = 203,
},
};
image_desc_create_ready(manager, manager_resource, id, &data, false);
} }
static const struct wp_color_manager_v1_interface manager_impl = { static const struct wp_color_manager_v1_interface manager_impl = {
@ -1003,7 +1019,6 @@ struct wlr_color_manager_v1 *wlr_color_manager_v1_create(struct wl_display *disp
assert(!options->features.set_primaries); assert(!options->features.set_primaries);
assert(!options->features.set_tf_power); assert(!options->features.set_tf_power);
assert(!options->features.extended_target_volume); assert(!options->features.extended_target_volume);
assert(!options->features.windows_scrgb);
struct wlr_color_manager_v1 *manager = calloc(1, sizeof(*manager)); struct wlr_color_manager_v1 *manager = calloc(1, sizeof(*manager));
if (manager == NULL) { if (manager == NULL) {