drm: capture EDID HDR metadata when only EOTFs are advertised

Some displays populate the desired-content luminance bytes in the HDR
Static Metadata Data Block without setting the Type 1 descriptor flag.
Fall through to capture the values whenever any luminance field is
non-zero, and log what was parsed at WLR_DEBUG level to aid HDR
debugging.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Christopher Snowhill 2026-05-13 23:07:25 -07:00
parent 78830ab696
commit 51b9350e69

View file

@ -105,7 +105,14 @@ 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) {
// Capture HDR static metadata whenever the EDID provides any value, even if
// the Type 1 descriptor flag is unset: some displays only advertise EOTFs
// without explicitly flagging Type 1 support, but still expose useful
// desired-content luminance values.
if (hdr_static_metadata->type1 ||
hdr_static_metadata->desired_content_max_luminance > 0 ||
hdr_static_metadata->desired_content_max_frame_avg_luminance > 0 ||
hdr_static_metadata->desired_content_min_luminance > 0) {
output->hdr_metadata_value = (struct wlr_output_hdr_metadata){
.desired_content_min_luminance = hdr_static_metadata->desired_content_min_luminance,
};
@ -120,6 +127,19 @@ void parse_edid(struct wlr_drm_connector *conn, size_t len, const uint8_t *data)
hdr_static_metadata->desired_content_max_frame_avg_luminance;
}
output->hdr_metadata = &output->hdr_metadata_value;
wlr_log(WLR_DEBUG,
"EDID HDR static metadata: type1=%d pq=%d hlg=%d hdr_gamma=%d sdr=%d, "
"min_lum=%.4f cd/m^2, max_lum=%.1f cd/m^2, max_fall=%.1f cd/m^2",
hdr_static_metadata->type1, hdr_static_metadata->pq,
hdr_static_metadata->hlg, hdr_static_metadata->traditional_hdr,
hdr_static_metadata->traditional_sdr,
hdr_static_metadata->desired_content_min_luminance,
hdr_static_metadata->desired_content_max_luminance,
hdr_static_metadata->desired_content_max_frame_avg_luminance);
} else {
wlr_log(WLR_DEBUG,
"EDID has no HDR static metadata (sdr_only=%d)",
hdr_static_metadata->traditional_sdr);
}
di_info_destroy(info);