color-representation: add support for identity+full

This commit is contained in:
Steve Williams 2026-01-31 15:11:14 +04:00 committed by Simon Ser
parent 439985fe95
commit bb78861ca9
3 changed files with 15 additions and 5 deletions

View file

@ -2039,8 +2039,8 @@ struct wlr_vk_pipeline_layout *get_or_create_pipeline_layout(
};
sampler_create_info.pNext = &conversion_info;
} else {
assert(key->ycbcr.encoding == WLR_COLOR_ENCODING_NONE);
assert(key->ycbcr.range == WLR_COLOR_RANGE_NONE);
assert(key->ycbcr.encoding == WLR_COLOR_ENCODING_NONE || key->ycbcr.encoding == WLR_COLOR_ENCODING_IDENTITY);
assert(key->ycbcr.range == WLR_COLOR_RANGE_NONE || key->ycbcr.range == WLR_COLOR_RANGE_FULL);
}
res = vkCreateSampler(renderer->dev->dev, &sampler_create_info, NULL, &pipeline_layout->sampler);

View file

@ -2086,8 +2086,12 @@ static enum scene_direct_scanout_result scene_entry_try_direct_scanout(
return SCANOUT_INELIGIBLE;
}
if (buffer->color_encoding != WLR_COLOR_ENCODING_NONE ||
buffer->color_range != WLR_COLOR_RANGE_NONE) {
bool is_color_repr_none = buffer->color_encoding == WLR_COLOR_ENCODING_NONE &&
buffer->color_range == WLR_COLOR_RANGE_NONE;
bool is_color_repr_identity_full = buffer->color_encoding == WLR_COLOR_ENCODING_IDENTITY &&
buffer->color_range == WLR_COLOR_RANGE_FULL;
if (!(is_color_repr_none || is_color_repr_identity_full)) {
return SCANOUT_INELIGIBLE;
}

View file

@ -260,9 +260,11 @@ static void surface_synced_commit(struct wlr_surface_synced *synced) {
"unexpected encoding/range for yuv");
}
} else /* rgb */ {
wl_resource_post_error(color_repr->resource,
if (!is_identity_full) {
wl_resource_post_error(color_repr->resource,
WP_COLOR_REPRESENTATION_SURFACE_V1_ERROR_PIXEL_FORMAT,
"unexpected encoding/range for rgb");
}
}
}
@ -465,6 +467,10 @@ struct wlr_color_representation_manager_v1 *wlr_color_representation_manager_v1_
struct wlr_color_representation_v1_coeffs_and_range coeffs_and_ranges[COEFFICIENTS_LEN * RANGES_LEN];
size_t coeffs_and_ranges_len = 0;
coeffs_and_ranges[coeffs_and_ranges_len++] = (struct wlr_color_representation_v1_coeffs_and_range){
.coeffs = WP_COLOR_REPRESENTATION_SURFACE_V1_COEFFICIENTS_IDENTITY,
.range = WP_COLOR_REPRESENTATION_SURFACE_V1_RANGE_FULL,
};
for (size_t i = 0; i < COEFFICIENTS_LEN; i++) {
enum wp_color_representation_surface_v1_coefficients coeffs = coefficients[i];
enum wlr_color_encoding enc = wlr_color_representation_v1_color_encoding_to_wlr(coeffs);