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] drm: Add support for alternate clocks of 4k modes
Date: Wed, 14 Aug 2013 13:18:02 +0300	[thread overview]
Message-ID: <20130814101802.GN7159@intel.com> (raw)
In-Reply-To: <1376435848-14584-5-git-send-email-damien.lespiau@intel.com>

On Wed, Aug 14, 2013 at 12:17:20AM +0100, Damien Lespiau wrote:
> Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> ---
>  drivers/gpu/drm/drm_edid.c | 68 ++++++++++++++++++++++++++++++++++++++++++----
>  1 file changed, 62 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 0faa08e..606335f 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -2409,6 +2409,54 @@ u8 drm_match_cea_mode(const struct drm_display_mode *to_match)
>  }
>  EXPORT_SYMBOL(drm_match_cea_mode);
>  
> +/*
> + * Calculate the alternate clock for HDMI modes (those from the HDMI vendor
> + * specific block).
> + *
> + * It's almost like cea_mode_alternate_clock(), we just need to add an
> + * exception for the VIC 4 mode (4096x2160@24Hz): no alternate clock for this
> + * one.
> + */
> +static unsigned int
> +hdmi_mode_alternate_clock(const struct drm_display_mode *hdmi_mode)
> +{
> +	if (hdmi_mode->vdisplay == 4096 && hdmi_mode->hdisplay == 2160)
> +		return hdmi_mode->clock;
> +
> +	return cea_mode_alternate_clock(hdmi_mode);
> +}
> +
> +/*
> + * drm_match_cea_mode - look for a HDMI mode matching given mode
                ^^^

Fix that, and you get:

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

> + * @to_match: display mode
> + *
> + * An HDMI mode is one defined in the HDMI vendor specific block.
> + *
> + * Returns the HDMI Video ID (VIC) of the mode or 0 if it isn't one.
> + */
> +static u8 drm_match_hmdi_mode(const struct drm_display_mode *to_match)
> +{
> +	u8 mode;
> +
> +	if (!to_match->clock)
> +		return 0;
> +
> +	for (mode = 0; mode < ARRAY_SIZE(edid_4k_modes); mode++) {
> +		const struct drm_display_mode *hdmi_mode = &edid_4k_modes[mode];
> +		unsigned int clock1, clock2;
> +
> +		/* Make sure to also match alternate clocks */
> +		clock1 = hdmi_mode->clock;
> +		clock2 = hdmi_mode_alternate_clock(hdmi_mode);
> +
> +		if ((KHZ2PICOS(to_match->clock) == KHZ2PICOS(clock1) ||
> +		     KHZ2PICOS(to_match->clock) == KHZ2PICOS(clock2)) &&
> +		    drm_mode_equal_no_clocks(to_match, hdmi_mode))
> +			return mode + 1;
> +	}
> +	return 0;
> +}
> +
>  static int
>  add_alternate_cea_modes(struct drm_connector *connector, struct edid *edid)
>  {
> @@ -2426,18 +2474,26 @@ add_alternate_cea_modes(struct drm_connector *connector, struct edid *edid)
>  	 * with the alternate clock for certain CEA modes.
>  	 */
>  	list_for_each_entry(mode, &connector->probed_modes, head) {
> -		const struct drm_display_mode *cea_mode;
> +		const struct drm_display_mode *cea_mode = NULL;
>  		struct drm_display_mode *newmode;
> -		u8 cea_mode_idx = drm_match_cea_mode(mode) - 1;
> +		u8 mode_idx = drm_match_cea_mode(mode) - 1;
>  		unsigned int clock1, clock2;
>  
> -		if (cea_mode_idx >= ARRAY_SIZE(edid_cea_modes))
> -			continue;
> +		if (mode_idx < ARRAY_SIZE(edid_cea_modes)) {
> +			cea_mode = &edid_cea_modes[mode_idx];
> +			clock2 = cea_mode_alternate_clock(cea_mode);
> +		} else {
> +			mode_idx = drm_match_hmdi_mode(mode) - 1;
> +			if (mode_idx < ARRAY_SIZE(edid_4k_modes)) {
> +				cea_mode = &edid_4k_modes[mode_idx];
> +				clock2 = hdmi_mode_alternate_clock(cea_mode);
> +			}
> +		}
>  
> -		cea_mode = &edid_cea_modes[cea_mode_idx];
> +		if (!cea_mode)
> +			continue;
>  
>  		clock1 = cea_mode->clock;
> -		clock2 = cea_mode_alternate_clock(cea_mode);
>  
>  		if (clock1 == clock2)
>  			continue;
> -- 
> 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

  parent reply	other threads:[~2013-08-14 10:18 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-13 23:17 HDMI 4k support v2 Damien Lespiau
2013-08-13 23:17 ` [PATCH 01/12] drm: Don't export drm_find_cea_extension() any more Damien Lespiau
2013-08-13 23:17 ` [PATCH 02/12] drm/edid: Fix add_cea_modes() style issues Damien Lespiau
2013-08-14 10:16   ` Ville Syrjälä
2013-08-13 23:17 ` [PATCH 03/12] drm/edid: Parse the HDMI CEA block and look for 4k modes Damien Lespiau
2013-08-14  9:32   ` Simon Farnsworth
2013-08-13 23:17 ` [PATCH 04/12] drm: Add support for alternate clocks of " Damien Lespiau
2013-08-14  9:33   ` Simon Farnsworth
2013-08-14 10:18   ` Ville Syrjälä [this message]
2013-08-13 23:17 ` [PATCH 05/12] video/hdmi: Don't let the user of this API create invalid infoframes Damien Lespiau
2013-08-13 23:17 ` [PATCH 06/12] video/hdmi: Derive the bar data valid bit from the bar data fields Damien Lespiau
2013-08-14 10:41   ` Ville Syrjälä
2013-08-13 23:17 ` [PATCH 07/12] video/hdmi: Introduce helpers for the HDMI vendor specific infoframe Damien Lespiau
2013-08-14 10:50   ` Ville Syrjälä
2013-08-14 11:24   ` [Intel-gfx] " Ville Syrjälä
     [not found] ` <1376435848-14584-1-git-send-email-damien.lespiau-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-08-13 23:17   ` [PATCH 08/12] gpu: host1x: Port the HDMI vendor infoframe code the common helpers Damien Lespiau
     [not found]     ` <1376435848-14584-9-git-send-email-damien.lespiau-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-08-14 11:20       ` Ville Syrjälä
2013-08-13 23:17 ` [PATCH 09/12] drm/edid: Move HDMI_IDENTIFIER to hdmi.h Damien Lespiau
2013-08-13 23:17 ` [PATCH 10/12] video/hdmi: Hook the HDMI vendor infoframe with the generic _pack() Damien Lespiau
2013-08-14 11:14   ` [Intel-gfx] " Ville Syrjälä
2013-08-13 23:17 ` [PATCH 11/12] drm: Add a helper to forge HDMI vendor infoframes Damien Lespiau
2013-08-14  9:42   ` Simon Farnsworth
2013-08-13 23:17 ` [PATCH 12/12] drm/i915/hdmi: Write HDMI vendor specific infoframes Damien Lespiau
2013-08-14  9:43 ` HDMI 4k support v2 Simon Farnsworth
2013-08-14 11:32 ` Ville Syrjälä

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=20130814101802.GN7159@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