]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/dp: Add compute routine for DP HDR Metadata Infoframe SDP
authorGwan-gyeong Mun <gwan-gyeong.mun@intel.com>
Tue, 11 Feb 2020 07:46:42 +0000 (09:46 +0200)
committerJani Nikula <jani.nikula@intel.com>
Fri, 20 Mar 2020 12:12:12 +0000 (14:12 +0200)
It stores computed dp hdr metadata infoframe sdp to infoframes.drm of
crtc state. It referenced intel_hdmi_compute_drm_infoframe().

While computing, we'll also fill out the infoframes.enable bitmask
appropriately.

v2: Wrap a long line.
v4: Use struct drm_device logging macros
v5: Fix typo [Uma]

Signed-off-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
Reviewed-by: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200211074657.231405-4-gwan-gyeong.mun@intel.com
drivers/gpu/drm/i915/display/intel_dp.c

index 0af09ed867f275832c94693ec9920bf0c7a3ca28..0d4a466566f129a9b955d22be8ac2cdbb051d212 100644 (file)
@@ -2494,6 +2494,29 @@ static void intel_dp_compute_vsc_sdp(struct intel_dp *intel_dp,
                                         &crtc_state->infoframes.vsc);
 }
 
+static void
+intel_dp_compute_hdr_metadata_infoframe_sdp(struct intel_dp *intel_dp,
+                                           struct intel_crtc_state *crtc_state,
+                                           const struct drm_connector_state *conn_state)
+{
+       int ret;
+       struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
+       struct hdmi_drm_infoframe *drm_infoframe = &crtc_state->infoframes.drm.drm;
+
+       if (!conn_state->hdr_output_metadata)
+               return;
+
+       ret = drm_hdmi_infoframe_set_hdr_metadata(drm_infoframe, conn_state);
+
+       if (ret) {
+               drm_dbg_kms(&dev_priv->drm, "couldn't set HDR metadata in infoframe\n");
+               return;
+       }
+
+       crtc_state->infoframes.enable |=
+               intel_hdmi_infoframe_enable(HDMI_PACKET_TYPE_GAMUT_METADATA);
+}
+
 int
 intel_dp_compute_config(struct intel_encoder *encoder,
                        struct intel_crtc_state *pipe_config,
@@ -2600,6 +2623,7 @@ intel_dp_compute_config(struct intel_encoder *encoder,
 
        intel_psr_compute_config(intel_dp, pipe_config);
        intel_dp_compute_vsc_sdp(intel_dp, pipe_config, conn_state);
+       intel_dp_compute_hdr_metadata_infoframe_sdp(intel_dp, pipe_config, conn_state);
 
        return 0;
 }