diff mbox series

[v6,07/11] drm/i915/display: Implement DRM infoframe read for LSPCON

Message ID 20200914210047.11972-8-uma.shankar@intel.com (mailing list archive)
State New, archived
Headers show
Series Enable HDR on MCA LSPCON based Gen9 devices | expand

Commit Message

Shankar, Uma Sept. 14, 2020, 9 p.m. UTC
Implement Read back of HDR metadata infoframes i.e Dynamic Range
and Mastering Infoframe for LSPCON devices.

v2: Added proper bitmask of enabled infoframes as per Ville's
recommendation.

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/i915/display/intel_hdmi.c   | 10 ++++++++++
 drivers/gpu/drm/i915/display/intel_lspcon.c |  6 +++++-
 drivers/gpu/drm/i915/display/intel_lspcon.h |  4 ++++
 3 files changed, 19 insertions(+), 1 deletion(-)

Comments

Ville Syrjälä Sept. 29, 2020, 4:22 p.m. UTC | #1
On Tue, Sep 15, 2020 at 02:30:43AM +0530, Uma Shankar wrote:
> Implement Read back of HDR metadata infoframes i.e Dynamic Range
> and Mastering Infoframe for LSPCON devices.
> 
> v2: Added proper bitmask of enabled infoframes as per Ville's
> recommendation.
> 
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_hdmi.c   | 10 ++++++++++
>  drivers/gpu/drm/i915/display/intel_lspcon.c |  6 +++++-
>  drivers/gpu/drm/i915/display/intel_lspcon.h |  4 ++++
>  3 files changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c
> index 1e40ed473fb9..02b0b5921bed 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
> @@ -600,6 +600,16 @@ void lspcon_drm_write_infoframe(struct intel_encoder *encoder,
>  	hsw_write_infoframe(encoder, crtc_state, type, frame, len);
>  }
>  
> +void lspcon_drm_read_infoframe(struct intel_encoder *encoder,
> +			       const struct intel_crtc_state *crtc_state,
> +			       unsigned int type,
> +			       void *frame, ssize_t len)
> +{
> +	drm_dbg_kms(encoder->base.dev, "Read HDR metadata for lspcon\n");
> +	/* It uses the legacy hsw implementation for the same */
> +	hsw_read_infoframe(encoder, crtc_state, type, frame, len);
> +}

Another pointless wrapper.

> +
>  static const u8 infoframe_type_to_idx[] = {
>  	HDMI_PACKET_TYPE_GENERAL_CONTROL,
>  	HDMI_PACKET_TYPE_GAMUT_METADATA,
> diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.c b/drivers/gpu/drm/i915/display/intel_lspcon.c
> index 565913b8e656..ee77a5381cb5 100644
> --- a/drivers/gpu/drm/i915/display/intel_lspcon.c
> +++ b/drivers/gpu/drm/i915/display/intel_lspcon.c
> @@ -501,7 +501,11 @@ void lspcon_read_infoframe(struct intel_encoder *encoder,
>  			   unsigned int type,
>  			   void *frame, ssize_t len)
>  {
> -	/* FIXME implement this */
> +	/* FIXME implement for AVI Infoframe as well */
> +	if (type == HDMI_PACKET_TYPE_GAMUT_METADATA)
> +		lspcon_drm_read_infoframe(encoder, crtc_state,
> +					  HDMI_PACKET_TYPE_GAMUT_METADATA,
> +					  frame, VIDEO_DIP_DATA_SIZE);

Again I'd just pass the params through.

>  }
>  
>  /* HDMI HDR Colorspace Spec Definitions */
> diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.h b/drivers/gpu/drm/i915/display/intel_lspcon.h
> index 3fac05535731..1b9fb531128e 100644
> --- a/drivers/gpu/drm/i915/display/intel_lspcon.h
> +++ b/drivers/gpu/drm/i915/display/intel_lspcon.h
> @@ -38,4 +38,8 @@ 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 lspcon_drm_read_infoframe(struct intel_encoder *encoder,
> +			       const struct intel_crtc_state *crtc_state,
> +			       unsigned int type,
> +			       void *frame, ssize_t len);
>  #endif /* __INTEL_LSPCON_H__ */
> -- 
> 2.26.2
Shankar, Uma Oct. 5, 2020, 9:37 p.m. UTC | #2
> -----Original Message-----
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Sent: Tuesday, September 29, 2020 9:53 PM
> To: Shankar, Uma <uma.shankar@intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Subject: Re: [v6 07/11] drm/i915/display: Implement DRM infoframe read for
> LSPCON
> 
> On Tue, Sep 15, 2020 at 02:30:43AM +0530, Uma Shankar wrote:
> > Implement Read back of HDR metadata infoframes i.e Dynamic Range and
> > Mastering Infoframe for LSPCON devices.
> >
> > v2: Added proper bitmask of enabled infoframes as per Ville's
> > recommendation.
> >
> > Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_hdmi.c   | 10 ++++++++++
> >  drivers/gpu/drm/i915/display/intel_lspcon.c |  6 +++++-
> > drivers/gpu/drm/i915/display/intel_lspcon.h |  4 ++++
> >  3 files changed, 19 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c
> > b/drivers/gpu/drm/i915/display/intel_hdmi.c
> > index 1e40ed473fb9..02b0b5921bed 100644
> > --- a/drivers/gpu/drm/i915/display/intel_hdmi.c
> > +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
> > @@ -600,6 +600,16 @@ void lspcon_drm_write_infoframe(struct
> intel_encoder *encoder,
> >  	hsw_write_infoframe(encoder, crtc_state, type, frame, len);  }
> >
> > +void lspcon_drm_read_infoframe(struct intel_encoder *encoder,
> > +			       const struct intel_crtc_state *crtc_state,
> > +			       unsigned int type,
> > +			       void *frame, ssize_t len)
> > +{
> > +	drm_dbg_kms(encoder->base.dev, "Read HDR metadata for lspcon\n");
> > +	/* It uses the legacy hsw implementation for the same */
> > +	hsw_read_infoframe(encoder, crtc_state, type, frame, len); }
> 
> Another pointless wrapper.

Sure, will drop this.
> > +
> >  static const u8 infoframe_type_to_idx[] = {
> >  	HDMI_PACKET_TYPE_GENERAL_CONTROL,
> >  	HDMI_PACKET_TYPE_GAMUT_METADATA,
> > diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.c
> > b/drivers/gpu/drm/i915/display/intel_lspcon.c
> > index 565913b8e656..ee77a5381cb5 100644
> > --- a/drivers/gpu/drm/i915/display/intel_lspcon.c
> > +++ b/drivers/gpu/drm/i915/display/intel_lspcon.c
> > @@ -501,7 +501,11 @@ void lspcon_read_infoframe(struct intel_encoder
> *encoder,
> >  			   unsigned int type,
> >  			   void *frame, ssize_t len)
> >  {
> > -	/* FIXME implement this */
> > +	/* FIXME implement for AVI Infoframe as well */
> > +	if (type == HDMI_PACKET_TYPE_GAMUT_METADATA)
> > +		lspcon_drm_read_infoframe(encoder, crtc_state,
> > +
> HDMI_PACKET_TYPE_GAMUT_METADATA,
> > +					  frame, VIDEO_DIP_DATA_SIZE);
> 
> Again I'd just pass the params through.

Will do the same.
> >  }
> >
> >  /* HDMI HDR Colorspace Spec Definitions */ diff --git
> > a/drivers/gpu/drm/i915/display/intel_lspcon.h
> > b/drivers/gpu/drm/i915/display/intel_lspcon.h
> > index 3fac05535731..1b9fb531128e 100644
> > --- a/drivers/gpu/drm/i915/display/intel_lspcon.h
> > +++ b/drivers/gpu/drm/i915/display/intel_lspcon.h
> > @@ -38,4 +38,8 @@ 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 lspcon_drm_read_infoframe(struct intel_encoder *encoder,
> > +			       const struct intel_crtc_state *crtc_state,
> > +			       unsigned int type,
> > +			       void *frame, ssize_t len);
> >  #endif /* __INTEL_LSPCON_H__ */
> > --
> > 2.26.2
> 
> --
> Ville Syrjälä
> Intel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c
index 1e40ed473fb9..02b0b5921bed 100644
--- a/drivers/gpu/drm/i915/display/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
@@ -600,6 +600,16 @@  void lspcon_drm_write_infoframe(struct intel_encoder *encoder,
 	hsw_write_infoframe(encoder, crtc_state, type, frame, len);
 }
 
+void lspcon_drm_read_infoframe(struct intel_encoder *encoder,
+			       const struct intel_crtc_state *crtc_state,
+			       unsigned int type,
+			       void *frame, ssize_t len)
+{
+	drm_dbg_kms(encoder->base.dev, "Read HDR metadata for lspcon\n");
+	/* It uses the legacy hsw implementation for the same */
+	hsw_read_infoframe(encoder, crtc_state, type, frame, len);
+}
+
 static const u8 infoframe_type_to_idx[] = {
 	HDMI_PACKET_TYPE_GENERAL_CONTROL,
 	HDMI_PACKET_TYPE_GAMUT_METADATA,
diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.c b/drivers/gpu/drm/i915/display/intel_lspcon.c
index 565913b8e656..ee77a5381cb5 100644
--- a/drivers/gpu/drm/i915/display/intel_lspcon.c
+++ b/drivers/gpu/drm/i915/display/intel_lspcon.c
@@ -501,7 +501,11 @@  void lspcon_read_infoframe(struct intel_encoder *encoder,
 			   unsigned int type,
 			   void *frame, ssize_t len)
 {
-	/* FIXME implement this */
+	/* FIXME implement for AVI Infoframe as well */
+	if (type == HDMI_PACKET_TYPE_GAMUT_METADATA)
+		lspcon_drm_read_infoframe(encoder, crtc_state,
+					  HDMI_PACKET_TYPE_GAMUT_METADATA,
+					  frame, VIDEO_DIP_DATA_SIZE);
 }
 
 /* HDMI HDR Colorspace Spec Definitions */
diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.h b/drivers/gpu/drm/i915/display/intel_lspcon.h
index 3fac05535731..1b9fb531128e 100644
--- a/drivers/gpu/drm/i915/display/intel_lspcon.h
+++ b/drivers/gpu/drm/i915/display/intel_lspcon.h
@@ -38,4 +38,8 @@  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 lspcon_drm_read_infoframe(struct intel_encoder *encoder,
+			       const struct intel_crtc_state *crtc_state,
+			       unsigned int type,
+			       void *frame, ssize_t len);
 #endif /* __INTEL_LSPCON_H__ */