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

@ -85,6 +85,22 @@ enum wlr_output_state_mode_type {
WLR_OUTPUT_STATE_MODE_CUSTOM,
};
/**
* HDR static metadata block 1 values, as advertised by the display via EDID.
*
* Luminances are given in cd/m². desired_content_min_luminance is always
* available (defaults to 0 when the EDID block does not provide a value).
* desired_content_max_luminance and desired_content_max_frame_average_luminance
* are optional and only meaningful when their corresponding has_* flag is set.
*/
struct wlr_output_hdr_metadata {
double desired_content_min_luminance;
bool has_desired_content_max_luminance;
double desired_content_max_luminance;
bool has_desired_content_max_frame_average_luminance;
double desired_content_max_frame_average_luminance;
};
/**
* Colorimetric image description.
*
@ -194,6 +210,8 @@ struct wlr_output {
char *make, *model, *serial; // may be NULL
int32_t phys_width, phys_height; // mm
const struct wlr_color_primaries *default_primaries; // may be NULL
// HDR static metadata block 1 values from the EDID, NULL if not advertised
const struct wlr_output_hdr_metadata *hdr_metadata;
// Note: some backends may have zero modes
struct wl_list modes; // wlr_output_mode.link
@ -278,6 +296,7 @@ struct wlr_output {
struct wlr_output_image_description image_description_value;
struct wlr_color_transform *color_transform;
struct wlr_color_primaries default_primaries_value;
struct wlr_output_hdr_metadata hdr_metadata_value;
} WLR_PRIVATE;
};