Re: [PATCH 05/12] video/hdmi: Don't let the user of this API create invalid infoframes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 14, 2013 at 06:19:08PM +0100, Damien Lespiau wrote:
> To set the active aspect ratio value in the AVI infoframe today, you not
> only have to set the active_aspect field, but also the active_info_valid
> bit. Out of the 1 user of this API, we had 100% misuse, forgetting the
> _valid bit. This was fixed in:
> 
>   Author: Damien Lespiau <damien.lespiau@xxxxxxxxx>
>   Date:   Tue Aug 6 20:32:17 2013 +0100
> 
>       drm: Don't generate invalid AVI infoframes for CEA modes
> 
> We can do better and derive the _valid bit from the user wanting to set
> the active aspect ratio.
[...]
> diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
[...]
> @@ -96,7 +96,9 @@ ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe *frame, void *buffer,
>  
>  	ptr[0] = ((frame->colorspace & 0x3) << 5) | (frame->scan_mode & 0x3);
>  
> -	if (frame->active_info_valid)
> +	/* Data byte 1, bit 4 has to be set if we provide the active format
> +	 * aspect ratio */

Nit: According to the coding style rules this should be:

	/*
	 * Data byte 1, ...
	 * ... ratio.
	 */

> +	if (frame->active_aspect & 0xf)
>  		ptr[0] |= BIT(4);
>  
>  	if (frame->horizontal_bar_valid)
> diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
> index bc6743e..931474c6 100644
> --- a/include/linux/hdmi.h
> +++ b/include/linux/hdmi.h
> @@ -109,7 +109,6 @@ struct hdmi_avi_infoframe {
>  	unsigned char version;
>  	unsigned char length;
>  	enum hdmi_colorspace colorspace;
> -	bool active_info_valid;

When I initially came up with these data structure I wanted them to
explicitly expose all the fields that CEA/HDMI specifies. The idea was
that a user would actually be allowed to generate invalid infoframes if
they chose to by modifying the hdmi_avi_infoframe structure directly.

Instead I'd prefer to see this handled by some higher level function.

Thierry

Attachment: pgpQDJz1xVGjQ.pgp
Description: PGP signature

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

[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux