Re: [PATCH 13/13] drm/msm/dp: Add static HDR metadata support for DP and eDP

From: Dmitry Baryshkov

Date: Wed Sep 30 2026 - 15:43:42 EST


On Wed, Sep 30, 2026 at 08:41:57PM +0800, Xilin Wu wrote:
> Expose HDR_OUTPUT_METADATA and validate and pack it during atomic check.
> Program Generic2 from the checked bridge state on every stream enable.
> Reuse the DRM metadata conversion and infoframe packing helpers, omit
> the HDMI checksum when constructing the DP SDP, and zero reserved bytes.
>
> Require 10 bpc for HDR transfer functions and reject insufficient
> bandwidth after link training instead of silently reducing color depth.
> Revalidate sink HDR capabilities after powering up an eDP panel, using
> the stream enable failure path if the requested output is unsupported.
>
> Force a modeset for metadata changes and include metadata enable and
> disable in peripheral flush requests. Keep HDR streams out of PSR and
> clear Generic2 enable state when disabling the stream. Preserve the
> software metadata across teardown so that every stream rebuild restores
> the checked packets.
>
> Give checked HDR modesets precedence over SDR video-pattern tests. Reject
> new test requests with NAK while HDR is configured and return -EBUSY from
> the debugfs test control. Clear the test override under plugged_lock when
> applying HDR so that a request arriving after atomic check cannot replace
> the checked output depth. Keep pending test colorimetry from overriding
> HDR signalling. Atomic checks leave the running test state untouched.
>
> Assisted-by: LLM
> Signed-off-by: Xilin Wu <sophon@xxxxxxxxx>
> ---
> drivers/gpu/drm/msm/Kconfig | 1 +
> drivers/gpu/drm/msm/dp/dp_ctrl.c | 9 ++++--
> drivers/gpu/drm/msm/dp/dp_display.c | 39 +++++++++++++++++++++---
> drivers/gpu/drm/msm/dp/dp_drm.c | 4 ++-
> drivers/gpu/drm/msm/dp/dp_drm.h | 2 ++
> drivers/gpu/drm/msm/dp/dp_panel.c | 33 ++++++++++++++++++++
> drivers/gpu/drm/msm/dp/dp_panel.h | 3 ++
> drivers/gpu/drm/msm/dp/dp_utils.c | 61 ++++++++++++++++++++++++++++++++++---
> drivers/gpu/drm/msm/dp/dp_utils.h | 5 ++-
> 9 files changed, 145 insertions(+), 12 deletions(-)
>
> @@ -717,17 +727,25 @@ int msm_dp_display_atomic_check(struct msm_dp *msm_dp_display,
>
> guard(mutex)(&dp->plugged_lock);
>
> + ret = msm_dp_utils_pack_hdr_sdp(conn_state, &state->hdr_sdp);
> + if (ret)
> + return ret;
> +
> + state->hdr_enabled = !!conn_state->hdr_output_metadata;

This should be done in atomic_check. Also please make sure that we don't
copy data from the state to the long-term structures. I'd rather pass
state pointer around.

> bpp = msm_dp_utils_select_bpp(info->bpc, conn_state->max_requested_bpc,
> clock, dp->panel->link_caps_valid ?
> dp->panel->link_info.rate : 0,
> - dp->panel->link_info.num_lanes);
> + dp->panel->link_info.num_lanes,
> + state->hdr_enabled && state->hdr_sdp.db[2] !=
> + HDMI_EOTF_TRADITIONAL_GAMMA_SDR);
> if (bpp < 0)
> return bpp;
>
> state->bpp = bpp;
> state->colorspace = conn_state->colorspace;
> state->vsc_enabled = drm_mode_is_420_only(info, mode) ||
> - state->colorspace != DRM_MODE_COLORIMETRY_DEFAULT;
> + state->colorspace != DRM_MODE_COLORIMETRY_DEFAULT ||
> + state->hdr_enabled;
> if (!state->vsc_enabled)
> return 0;
>

--
With best wishes
Dmitry