Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Mun, Gwan-gyeong" <gwan-gyeong.mun@intel.com>
To: "b.zolnierkie@samsung.com" <b.zolnierkie@samsung.com>
Cc: "linux-fbdev@vger.kernel.org" <linux-fbdev@vger.kernel.org>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"laurent.pinchart@ideasonboard.com"
	<laurent.pinchart@ideasonboard.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH v12 01/14] video/hdmi: Add Unpack only function for DRM infoframe
Date: Thu, 14 May 2020 06:23:03 +0000	[thread overview]
Message-ID: <f817b755bbdc20955cddb5b2cddb9a2246570d0e.camel@intel.com> (raw)
In-Reply-To: <20200514060732.3378396-2-gwan-gyeong.mun@intel.com>

Hi Bartlomiej and Laurent Pinchart, can I have your ack for merging
this via drm-intel along
with the rest of the series, please?

BR,
G.G. 

On Thu, 2020-05-14 at 09:07 +0300, Gwan-gyeong Mun wrote:
> It adds an unpack only function for DRM infoframe for dynamic range
> and
> mastering infoframe readout.
> It unpacks the information data block contained in the binary buffer
> into
> a structured frame of the HDMI Dynamic Range and Mastering (DRM)
> information frame.
> 
> In contrast to hdmi_drm_infoframe_unpack() function, it does not
> verify
> a checksum.
> 
> It can be used for unpacking a DP HDR Metadata Infoframe SDP case.
> DP HDR Metadata Infoframe SDP uses the same Dynamic Range and
> Mastering
> (DRM) information (CTA-861-G spec.) such as HDMI DRM infoframe.
> But DP SDP header and payload structure are different from HDMI DRM
> Infoframe. Therefore unpacking DRM infoframe for DP requires skipping
> of
> a verifying checksum.
> 
> v9: Add clear comments to hdmi_drm_infoframe_unpack_only() and
>     hdmi_drm_infoframe_unpack() (Laurent Pinchart)
> 
> Signed-off-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
> Reviewed-by: Uma Shankar <uma.shankar@intel.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
> ---
>  drivers/video/hdmi.c | 65 +++++++++++++++++++++++++++++++-----------
> --
>  include/linux/hdmi.h |  2 ++
>  2 files changed, 48 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
> index 856a8c4e84a2..e70792b3e367 100644
> --- a/drivers/video/hdmi.c
> +++ b/drivers/video/hdmi.c
> @@ -1768,20 +1768,21 @@ hdmi_vendor_any_infoframe_unpack(union
> hdmi_vendor_any_infoframe *frame,
>  }
>  
>  /**
> - * hdmi_drm_infoframe_unpack() - unpack binary buffer to a HDMI DRM
> infoframe
> + * hdmi_drm_infoframe_unpack_only() - unpack binary buffer of CTA-
> 861-G DRM
> + *                                    infoframe DataBytes to a HDMI
> DRM
> + *                                    infoframe
>   * @frame: HDMI DRM infoframe
>   * @buffer: source buffer
>   * @size: size of buffer
>   *
> - * Unpacks the information contained in binary @buffer into a
> structured
> - * @frame of the HDMI Dynamic Range and Mastering (DRM) information
> frame.
> - * Also verifies the checksum as required by section 5.3.5 of the
> HDMI 1.4
> - * specification.
> + * Unpacks CTA-861-G DRM infoframe DataBytes contained in the binary
> @buffer
> + * into a structured @frame of the HDMI Dynamic Range and Mastering
> (DRM)
> + * infoframe.
>   *
>   * Returns 0 on success or a negative error code on failure.
>   */
> -static int hdmi_drm_infoframe_unpack(struct hdmi_drm_infoframe
> *frame,
> -				     const void *buffer, size_t size)
> +int hdmi_drm_infoframe_unpack_only(struct hdmi_drm_infoframe *frame,
> +				   const void *buffer, size_t size)
>  {
>  	const u8 *ptr = buffer;
>  	const u8 *temp;
> @@ -1790,23 +1791,13 @@ static int hdmi_drm_infoframe_unpack(struct
> hdmi_drm_infoframe *frame,
>  	int ret;
>  	int i;
>  
> -	if (size < HDMI_INFOFRAME_SIZE(DRM))
> -		return -EINVAL;
> -
> -	if (ptr[0] != HDMI_INFOFRAME_TYPE_DRM ||
> -	    ptr[1] != 1 ||
> -	    ptr[2] != HDMI_DRM_INFOFRAME_SIZE)
> -		return -EINVAL;
> -
> -	if (hdmi_infoframe_checksum(buffer, HDMI_INFOFRAME_SIZE(DRM))
> != 0)
> +	if (size < HDMI_DRM_INFOFRAME_SIZE)
>  		return -EINVAL;
>  
>  	ret = hdmi_drm_infoframe_init(frame);
>  	if (ret)
>  		return ret;
>  
> -	ptr += HDMI_INFOFRAME_HEADER_SIZE;
> -
>  	frame->eotf = ptr[0] & 0x7;
>  	frame->metadata_type = ptr[1] & 0x7;
>  
> @@ -1814,7 +1805,7 @@ static int hdmi_drm_infoframe_unpack(struct
> hdmi_drm_infoframe *frame,
>  	for (i = 0; i < 3; i++) {
>  		x_lsb = *temp++;
>  		x_msb = *temp++;
> -		frame->display_primaries[i].x =  (x_msb << 8) | x_lsb;
> +		frame->display_primaries[i].x = (x_msb << 8) | x_lsb;
>  		y_lsb = *temp++;
>  		y_msb = *temp++;
>  		frame->display_primaries[i].y = (y_msb << 8) | y_lsb;
> @@ -1830,6 +1821,42 @@ static int hdmi_drm_infoframe_unpack(struct
> hdmi_drm_infoframe *frame,
>  
>  	return 0;
>  }
> +EXPORT_SYMBOL(hdmi_drm_infoframe_unpack_only);
> +
> +/**
> + * hdmi_drm_infoframe_unpack() - unpack binary buffer to a HDMI DRM
> infoframe
> + * @frame: HDMI DRM infoframe
> + * @buffer: source buffer
> + * @size: size of buffer
> + *
> + * Unpacks the CTA-861-G DRM infoframe contained in the binary
> @buffer into
> + * a structured @frame of the HDMI Dynamic Range and Mastering (DRM)
> + * infoframe. It also verifies the checksum as required by section
> 5.3.5 of
> + * the HDMI 1.4 specification.
> + *
> + * Returns 0 on success or a negative error code on failure.
> + */
> +static int hdmi_drm_infoframe_unpack(struct hdmi_drm_infoframe
> *frame,
> +				     const void *buffer, size_t size)
> +{
> +	const u8 *ptr = buffer;
> +	int ret;
> +
> +	if (size < HDMI_INFOFRAME_SIZE(DRM))
> +		return -EINVAL;
> +
> +	if (ptr[0] != HDMI_INFOFRAME_TYPE_DRM ||
> +	    ptr[1] != 1 ||
> +	    ptr[2] != HDMI_DRM_INFOFRAME_SIZE)
> +		return -EINVAL;
> +
> +	if (hdmi_infoframe_checksum(buffer, HDMI_INFOFRAME_SIZE(DRM))
> != 0)
> +		return -EINVAL;
> +
> +	ret = hdmi_drm_infoframe_unpack_only(frame, ptr +
> HDMI_INFOFRAME_HEADER_SIZE,
> +					     size -
> HDMI_INFOFRAME_HEADER_SIZE);
> +	return ret;
> +}
>  
>  /**
>   * hdmi_infoframe_unpack() - unpack binary buffer to a HDMI
> infoframe
> diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
> index 9613d796cfb1..50c31f1a0a2d 100644
> --- a/include/linux/hdmi.h
> +++ b/include/linux/hdmi.h
> @@ -219,6 +219,8 @@ ssize_t hdmi_drm_infoframe_pack(struct
> hdmi_drm_infoframe *frame, void *buffer,
>  ssize_t hdmi_drm_infoframe_pack_only(const struct hdmi_drm_infoframe
> *frame,
>  				     void *buffer, size_t size);
>  int hdmi_drm_infoframe_check(struct hdmi_drm_infoframe *frame);
> +int hdmi_drm_infoframe_unpack_only(struct hdmi_drm_infoframe *frame,
> +				   const void *buffer, size_t size);
>  
>  enum hdmi_spd_sdi {
>  	HDMI_SPD_SDI_UNKNOWN,
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2020-05-14  6:23 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-14  6:07 [Intel-gfx] [PATCH v12 00/14] In order to readout DP SDPs, refactors the handling of DP SDPs Gwan-gyeong Mun
2020-05-14  6:07 ` [Intel-gfx] [PATCH v12 01/14] video/hdmi: Add Unpack only function for DRM infoframe Gwan-gyeong Mun
2020-05-14  6:23   ` Mun, Gwan-gyeong [this message]
2020-05-14  6:07 ` [Intel-gfx] [PATCH v12 02/14] drm/i915/dp: Read out DP SDPs Gwan-gyeong Mun
2020-05-14  6:07 ` [Intel-gfx] [PATCH v12 03/14] drm: Add logging function for DP VSC SDP Gwan-gyeong Mun
2020-05-14  6:07 ` [Intel-gfx] [PATCH v12 04/14] drm/i915: Include HDMI DRM infoframe in the crtc state dump Gwan-gyeong Mun
2020-05-14  6:07 ` [Intel-gfx] [PATCH v12 05/14] drm/i915: Include DP HDR Metadata Infoframe SDP " Gwan-gyeong Mun
2020-05-14  6:07 ` [Intel-gfx] [PATCH v12 06/14] drm/i915: Include DP VSC " Gwan-gyeong Mun
2020-05-14  6:07 ` [Intel-gfx] [PATCH v12 07/14] drm/i915: Program DP SDPs with computed configs Gwan-gyeong Mun
2020-05-14  6:07 ` [Intel-gfx] [PATCH v12 08/14] drm/i915: Add state readout for DP HDR Metadata Infoframe SDP Gwan-gyeong Mun
2020-05-14  6:07 ` [Intel-gfx] [PATCH v12 09/14] drm/i915: Add state readout for DP VSC SDP Gwan-gyeong Mun
2020-05-14  6:07 ` [Intel-gfx] [PATCH v12 10/14] drm/i915: Fix enabled infoframe states of lspcon Gwan-gyeong Mun
2020-05-14  6:07 ` [Intel-gfx] [PATCH v12 11/14] drm/i915: Program DP SDPs on pipe updates Gwan-gyeong Mun
2020-05-14  6:07 ` [Intel-gfx] [PATCH v12 12/14] drm/i915: Stop sending DP SDPs on ddi disable Gwan-gyeong Mun
2020-05-14  6:07 ` [Intel-gfx] [PATCH v12 13/14] drm/i915/dp: Add compute routine for DP PSR VSC SDP Gwan-gyeong Mun
2020-05-14  6:07 ` [Intel-gfx] [PATCH v12 14/14] drm/i915/psr: Use new DP VSC SDP compute routine on PSR Gwan-gyeong Mun
2020-05-14  6:24 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for In order to readout DP SDPs, refactors the handling of DP SDPs (rev14) Patchwork
2020-05-14  6:48 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-05-14  9:07 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2020-05-14 11:19 ` [Intel-gfx] [PATCH v12 00/14] In order to readout DP SDPs, refactors the handling of DP SDPs Jani Nikula
2020-05-15 13:06   ` Ville Syrjälä
2020-05-15 13:13     ` Jani Nikula
2020-05-15 14:14       ` Daniel Vetter
2020-05-15 17:22         ` Mun, Gwan-gyeong
2020-05-18  9:43           ` Jani Nikula
2020-05-15 14:25       ` Saarinen, Jani
2020-05-15 14:11 ` [Intel-gfx] ✓ Fi.CI.BAT: success for In order to readout DP SDPs, refactors the handling of DP SDPs (rev14) Patchwork

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=f817b755bbdc20955cddb5b2cddb9a2246570d0e.camel@intel.com \
    --to=gwan-gyeong.mun@intel.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-fbdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox