All of lore.kernel.org
 help / color / mirror / Atom feed
From: Uma Shankar <uma.shankar@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [v1 4/6] drm/i915/display: Set HDR Infoframe for HDR capable LSPCON devices
Date: Wed, 16 Oct 2019 16:02:47 +0530	[thread overview]
Message-ID: <20191016103249.32121-5-uma.shankar@intel.com> (raw)
In-Reply-To: <20191016103249.32121-1-uma.shankar@intel.com>

Send Dynamic Range and Mastering Infoframe (DRM for HDR metadata)
as SDP packet to LSPCON following the DP spec. LSPCON receives the
same and sends it to HDMI sink.

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/drm_atomic_state_helper.c   |  1 +
 drivers/gpu/drm/drm_atomic_uapi.c           |  1 +
 drivers/gpu/drm/i915/display/intel_ddi.c    | 10 ++++++++++
 drivers/gpu/drm/i915/display/intel_dp.c     |  2 +-
 drivers/gpu/drm/i915/display/intel_lspcon.h |  3 +++
 include/drm/drm_connector.h                 |  1 +
 6 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c
index d0a937fb0c56..e78b3a1626fd 100644
--- a/drivers/gpu/drm/drm_atomic_state_helper.c
+++ b/drivers/gpu/drm/drm_atomic_state_helper.c
@@ -416,6 +416,7 @@ __drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector,
 
 	if (state->hdr_output_metadata)
 		drm_property_blob_get(state->hdr_output_metadata);
+	state->hdr_metadata_changed = false;
 
 	/* Don't copy over a writeback job, they are used only once */
 	state->writeback_job = NULL;
diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
index 0d466d3b0809..5beabcd42d30 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -734,6 +734,7 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
 				val,
 				sizeof(struct hdr_output_metadata), -1,
 				&replaced);
+		state->hdr_metadata_changed |= replaced;
 		return ret;
 	} else if (property == config->aspect_ratio_property) {
 		state->picture_aspect_ratio = val;
diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
index 80f8e2698be0..bfb680d3f4cf 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -3847,6 +3847,8 @@ static void intel_enable_ddi_dp(struct intel_encoder *encoder,
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
+	struct intel_lspcon *lspcon =
+				enc_to_intel_lspcon(&encoder->base);
 	enum port port = encoder->port;
 
 	if (port == PORT_A && INTEL_GEN(dev_priv) < 9)
@@ -3856,6 +3858,12 @@ static void intel_enable_ddi_dp(struct intel_encoder *encoder,
 	intel_psr_enable(intel_dp, crtc_state);
 	intel_dp_vsc_enable(intel_dp, crtc_state, conn_state);
 	intel_dp_hdr_metadata_enable(intel_dp, crtc_state, conn_state);
+
+	/* Set the infoframe for NON modeset cases as well */
+	if (lspcon->active && lspcon->hdr_supported &&
+	    conn_state->hdr_metadata_changed)
+		intel_dp_setup_hdr_metadata_infoframe_sdp(intel_dp, crtc_state,
+							  conn_state);
 	intel_edp_drrs_enable(intel_dp, crtc_state);
 
 	if (crtc_state->has_audio)
@@ -4027,6 +4035,8 @@ static void intel_ddi_update_pipe(struct intel_encoder *encoder,
 {
 	struct intel_connector *connector =
 				to_intel_connector(conn_state->connector);
+	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
+
 	struct intel_hdcp *hdcp = &connector->hdcp;
 	bool content_protection_type_changed =
 			(conn_state->hdcp_content_type != hdcp->content_type &&
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index dd5dc1e38495..d92777bd3bed 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -4624,7 +4624,7 @@ intel_dp_setup_vsc_sdp(struct intel_dp *intel_dp,
 			crtc_state, DP_SDP_VSC, &vsc_sdp, sizeof(vsc_sdp));
 }
 
-static void
+void
 intel_dp_setup_hdr_metadata_infoframe_sdp(struct intel_dp *intel_dp,
 					  const struct intel_crtc_state *crtc_state,
 					  const struct drm_connector_state *conn_state)
diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.h b/drivers/gpu/drm/i915/display/intel_lspcon.h
index 65878904f672..2a175ea7eac2 100644
--- a/drivers/gpu/drm/i915/display/intel_lspcon.h
+++ b/drivers/gpu/drm/i915/display/intel_lspcon.h
@@ -39,4 +39,7 @@ void lspcon_drm_write_infoframe(struct intel_encoder *encoder,
 				const struct intel_crtc_state *crtc_state,
 				unsigned int type,
 				const void *frame, ssize_t len);
+void intel_dp_setup_hdr_metadata_infoframe_sdp(struct intel_dp *intel_dp,
+					       const struct intel_crtc_state *crtc_state,
+					       const struct drm_connector_state *conn_state);
 #endif /* __INTEL_LSPCON_H__ */
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 5f8c3389d46f..1f0b4fcf0bd3 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -661,6 +661,7 @@ struct drm_connector_state {
 	 * DRM blob property for HDR output metadata
 	 */
 	struct drm_property_blob *hdr_output_metadata;
+	u8 hdr_metadata_changed : 1;
 };
 
 /**
-- 
2.22.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2019-10-16 10:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-16 10:32 [v1 0/6] Enable HDR on MCA LSPCON based Gen9 devices Uma Shankar
2019-10-16 10:32 ` [v1 1/6] drm/i915/display: Add HDR Capability detection for LSPCON Uma Shankar
2019-10-16 10:32 ` [v1 2/6] drm/i915/display: Enable HDR on gen9 devices with MCA Lspcon Uma Shankar
2019-10-16 13:14   ` Ville Syrjälä
2019-10-16 14:16     ` Shankar, Uma
2019-10-16 10:32 ` [v1 3/6] drm/i915/display: Attach HDR property for capable Gen9 devices Uma Shankar
2019-10-16 10:32 ` Uma Shankar [this message]
2019-10-16 10:32 ` [v1 5/6] drm/i915/display: Enable BT2020 for HDR on LSPCON devices Uma Shankar
2019-10-16 10:32 ` [v1 6/6] drm/i915/display: Reduce blanking to support 4k60@10bpp for LSPCON Uma Shankar
2019-10-16 13:13   ` Ville Syrjälä
2019-10-16 13:46     ` Shankar, Uma
2019-10-16 13:56       ` Ville Syrjälä
2019-10-16 14:13         ` Shankar, Uma
2019-10-16 12:31 ` ✗ Fi.CI.BUILD: failure for Enable HDR on MCA LSPCON based Gen9 devices Patchwork
2019-10-16 13:17 ` [v1 0/6] " Ville Syrjälä
2019-10-16 14:21   ` Shankar, Uma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191016103249.32121-5-uma.shankar@intel.com \
    --to=uma.shankar@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.