public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Vandana Kannan <vandana.kannan@intel.com>
Cc: intel-gfx@lists.freedesktop.org,
	Jesse Barnes <jesse.barnes@intel.com>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2] drm/edid: Fill PAR in AVI infoframe based on CEA mode list
Date: Tue, 1 Apr 2014 14:34:55 +0300	[thread overview]
Message-ID: <20140401113455.GE21652@intel.com> (raw)
In-Reply-To: <1396349819-12942-1-git-send-email-vandana.kannan@intel.com>

On Tue, Apr 01, 2014 at 04:26:59PM +0530, Vandana Kannan wrote:
> Populate PAR in infoframe structure. If there is a user setting for PAR, then
> that value is set. Else, value is taken from CEA mode list if VIC is found.
> Else, PAR is calculated from resolution. If none of these conditions are
> satisfied, PAR is NONE as per initialization.
> 
> v2: Removed the part which sets PAR according to user input, based on
> Daniel's review comments.
> 
> A separate patch will be submitted to create a property that would enable a
> user space app to set aspect ratio for AVI infoframe.
> 
> Signed-off-by: Vandana Kannan <vandana.kannan@intel.com>
> Cc: Jesse Barnes <jesse.barnes@intel.com>
> Cc: Vijay Purushothaman <vijay.a.purushothaman@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
> ---
>  drivers/gpu/drm/drm_edid.c | 29 +++++++++++++++++++++++++++++
>  include/drm/drm_crtc.h     |  1 +
>  2 files changed, 30 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index d4e3f9d..fee24d3 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -2452,6 +2452,21 @@ u8 drm_match_cea_mode(const struct drm_display_mode *to_match)
>  }
>  EXPORT_SYMBOL(drm_match_cea_mode);
>  
> +/**
> + * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding to
> + * the input VIC from the CEA mode list
> + *
> + * Returns picture aspect ratio
> + */
> +enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code)
> +{
> +	/* return picture aspect ratio for video_code - 1 to access the
> +	 * right array element
> +	*/
> +	return edid_cea_modes[video_code-1].picture_aspect_ratio;
> +}
> +EXPORT_SYMBOL(drm_get_cea_aspect_ratio);
> +
>  /*
>   * Calculate the alternate clock for HDMI modes (those from the HDMI vendor
>   * specific block).
> @@ -3613,6 +3628,20 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
>  	frame->video_code = drm_match_cea_mode(mode);
>  
>  	frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
> +
> +	/* Populate picture aspect ratio from CEA mode list */
> +	if (frame->video_code > 0)
> +		frame->picture_aspect = drm_get_cea_aspect_ratio(
> +						frame->video_code);
> +	else {
> +		if (!(mode->vdisplay % 3) &&
> +			(((mode->vdisplay * 4) / 3) == mode->hdisplay))
> +			frame->picture_aspect = HDMI_PICTURE_ASPECT_4_3;
> +		else if (!(mode->vdisplay % 9) &&
> +			(((mode->vdisplay * 16) / 9) == mode->hdisplay))
> +			frame->picture_aspect = HDMI_PICTURE_ASPECT_16_9;
> +	}

I'm not sure if providing the PAR for non-CEA modes like this makes
any real difference. But I guess it can't hurt since you only provide
it for exact matches.

But the matches are maybe even a bit too exact. For instance 1366x768
will not match the 16:9 case. So maybe it should be calculated in a bit
more relaxed way.

Or just dropped totally. I'm not sure.

> +
>  	frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
>  	frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN;
>  
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 27f828c..50dc55a 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -983,6 +983,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
>  extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
>  				    void *data, struct drm_file *file_priv);
>  extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
> +extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
>  extern bool drm_detect_hdmi_monitor(struct edid *edid);
>  extern bool drm_detect_monitor_audio(struct edid *edid);
>  extern bool drm_rgb_quant_range_selectable(struct edid *edid);
> -- 
> 1.9.1

-- 
Ville Syrjälä
Intel OTC

  reply	other threads:[~2014-04-01 11:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-21  3:01 [PATCH] drm/edid: Fill PAR in AVI infoframe based on CEA mode list Vandana Kannan
2014-03-31 18:55 ` Jesse Barnes
2014-03-31 19:05 ` Daniel Vetter
2014-04-01  2:36   ` Vandana Kannan
2014-04-01  7:27     ` Daniel Vetter
2014-04-01  9:26       ` Vandana Kannan
2014-04-01  9:51         ` Daniel Vetter
2014-04-01 10:56           ` [PATCH v2] " Vandana Kannan
2014-04-01 11:34             ` Ville Syrjälä [this message]
2014-04-01 13:13               ` Vandana Kannan
2014-04-01 13:54                 ` Ville Syrjälä
2014-04-01 14:22                   ` [PATCH v3] " Vandana Kannan
2014-04-01 15:37                     ` [PATCH v4] " Vandana Kannan
2014-04-01 17:40                       ` Daniel Vetter
2014-04-01 17:04                     ` [Intel-gfx] [PATCH v3] " Daniel Vetter

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=20140401113455.GE21652@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jesse.barnes@intel.com \
    --cc=vandana.kannan@intel.com \
    /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