output: expose EDID HDR static metadata

Read desired_content_{min,max,max_frame_avg}_luminance from the EDID
HDR static metadata block in the DRM backend and expose them on
wlr_output via a new wlr_output_hdr_metadata struct, mirroring the
existing default_primaries pattern.

In wlr_color_management_v1, propagate mastering display primaries,
mastering luminance, max_cll and max_fall from the output's image
description into the image_description_v1_data, falling back to the
EDID-derived values when the compositor hasn't populated them. Send
the protocol's target_primaries / target_luminance / target_max_cll /
target_max_fall from that data, resolving two TODOs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Christopher Snowhill 2026-05-13 21:00:56 -07:00
parent 63318d28b1
commit 78830ab696
3 changed files with 100 additions and 9 deletions

View file

@ -105,6 +105,23 @@ void parse_edid(struct wlr_drm_connector *conn, size_t len, const uint8_t *data)
output->supported_transfer_functions |= WLR_COLOR_TRANSFER_FUNCTION_ST2084_PQ;
}
if (hdr_static_metadata->type1) {
output->hdr_metadata_value = (struct wlr_output_hdr_metadata){
.desired_content_min_luminance = hdr_static_metadata->desired_content_min_luminance,
};
if (hdr_static_metadata->desired_content_max_luminance > 0) {
output->hdr_metadata_value.has_desired_content_max_luminance = true;
output->hdr_metadata_value.desired_content_max_luminance =
hdr_static_metadata->desired_content_max_luminance;
}
if (hdr_static_metadata->desired_content_max_frame_avg_luminance > 0) {
output->hdr_metadata_value.has_desired_content_max_frame_average_luminance = true;
output->hdr_metadata_value.desired_content_max_frame_average_luminance =
hdr_static_metadata->desired_content_max_frame_avg_luminance;
}
output->hdr_metadata = &output->hdr_metadata_value;
}
di_info_destroy(info);
}