public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Damien Lespiau <damien.lespiau@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 04/12] video/hmdi: Clear the whole incoming buffer, not just the infoframe size
Date: Wed, 7 Aug 2013 13:56:58 +0300	[thread overview]
Message-ID: <20130807105658.GT5004@intel.com> (raw)
In-Reply-To: <1375817544-14565-5-git-send-email-damien.lespiau@intel.com>

On Tue, Aug 06, 2013 at 08:32:16PM +0100, Damien Lespiau wrote:
> If the user if this API is providing a bigger buffer than the infoframe
> size, it could be for a could reason. For instance it could be because
> it gives the buffer that will be written to the hardware, up to the
> maximum of an infoframe size.
> 
> Instead of just zeroing up to the infoframe size, let's zero the whole
> incoming buffer as those extra bytes are also used to compute the
> ECC and need to be 0.
> 
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>

One concern that came to mind was someone needing to preserve the buffer
contents beyond the infoframe. But I guess if someone really needs to
do that, they can go and figure out the exact length of the infoframe
and pass that.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  drivers/video/hdmi.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
> index f7a85e5..635d569 100644
> --- a/drivers/video/hdmi.c
> +++ b/drivers/video/hdmi.c
> @@ -84,7 +84,7 @@ ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe *frame, void *buffer,
>  	if (size < length)
>  		return -ENOSPC;
>  
> -	memset(buffer, 0, length);
> +	memset(buffer, 0, size);
>  
>  	ptr[0] = frame->type;
>  	ptr[1] = frame->version;
> @@ -186,7 +186,7 @@ ssize_t hdmi_spd_infoframe_pack(struct hdmi_spd_infoframe *frame, void *buffer,
>  	if (size < length)
>  		return -ENOSPC;
>  
> -	memset(buffer, 0, length);
> +	memset(buffer, 0, size);
>  
>  	ptr[0] = frame->type;
>  	ptr[1] = frame->version;
> @@ -251,7 +251,7 @@ ssize_t hdmi_audio_infoframe_pack(struct hdmi_audio_infoframe *frame,
>  	if (size < length)
>  		return -ENOSPC;
>  
> -	memset(buffer, 0, length);
> +	memset(buffer, 0, size);
>  
>  	if (frame->channels >= 2)
>  		channels = frame->channels - 1;
> @@ -308,7 +308,7 @@ ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
>  	if (size < length)
>  		return -ENOSPC;
>  
> -	memset(buffer, 0, length);
> +	memset(buffer, 0, size);
>  
>  	ptr[0] = frame->type;
>  	ptr[1] = frame->version;
> -- 
> 1.8.3.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC

  reply	other threads:[~2013-08-07 10:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-06 19:32 Port the i915 HDMI infoframe code to the common infrastructure v2 Damien Lespiau
2013-08-06 19:32 ` [PATCH 01/12] video/hdmi: Replace the payload length by their defines Damien Lespiau
2013-08-07  2:06   ` Alex Deucher
2013-08-07  8:13     ` Daniel Vetter
2013-08-06 19:32 ` [PATCH 02/12] video/hdmi: Introduce a generic hdmi_infoframe union Damien Lespiau
2013-08-06 19:32 ` [PATCH 03/12] video/hdmi: Add a macro to return the size of a full infoframe Damien Lespiau
2013-08-06 19:32 ` [PATCH 04/12] video/hmdi: Clear the whole incoming buffer, not just the infoframe size Damien Lespiau
2013-08-07 10:56   ` Ville Syrjälä [this message]
2013-08-07 11:02     ` [Intel-gfx] " Damien Lespiau
2013-08-06 19:32 ` [PATCH 05/12] drm: Don't generate invalid AVI infoframes for CEA modes Damien Lespiau
2013-08-06 19:32 ` [PATCH 06/12] drm/i915/hdmi: Change the write_infoframe vfunc to take a buffer and a type Damien Lespiau
2013-08-07 10:58   ` Ville Syrjälä
2013-08-06 19:32 ` [PATCH 07/12] drm/i915/hdmi: Port the infoframe code to the common hdmi helpers Damien Lespiau
2013-08-07 11:00   ` Ville Syrjälä
2013-08-06 19:32 ` [PATCH 08/12] drm/i915/sdvo: Port the infoframe code to the shared infrastructure Damien Lespiau
2013-08-06 19:32 ` [PATCH 09/12] drm/i915: Remove the now obsolete infoframe definitions Damien Lespiau
2013-08-06 19:32 ` [PATCH 10/12] drm: Handle the DBLCLK flag in the common infoframe helper Damien Lespiau
2013-08-06 19:32 ` [PATCH 11/12] drm: Set aspect ratio fields in the AVI infoframe even for non CEA modes Damien Lespiau
2013-08-06 19:32 ` [PATCH 12/12] drm/i915/hmdi: Rename set_infoframe() to write_infoframe() Damien Lespiau

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=20130807105658.GT5004@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=damien.lespiau@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox