All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: "Sharma, Shashank" <shashank.sharma@intel.com>
Cc: Jose Abreu <Jose.Abreu@synopsys.com>,
	"Lin, Jia" <lin.a.jia@intel.com>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Nautiyal Ankit <ankit.k.nautiyal@intel.com>
Subject: Re: [PATCH 06/10] drm/edid: Fix cea mode aspect ratio handling
Date: Thu, 16 Nov 2017 18:23:57 +0200	[thread overview]
Message-ID: <20171116162357.GX10981@intel.com> (raw)
In-Reply-To: <67ddbed5-421d-d81f-9e0f-7ad4055f3c4e@intel.com>

On Thu, Nov 16, 2017 at 08:21:44PM +0530, Sharma, Shashank wrote:
> Regards
> 
> Shashank
> 
> 
> On 11/13/2017 10:34 PM, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > commit 6dffd431e229 ("drm: Add aspect ratio parsing in DRM layer")
> > cause us to not send out any VICs in the AVI infoframes. That commit
> > was since reverted, but if and when we add aspect ratio handing back
> > we need to be more careful.
> >
> > Let's handle this by considering the aspect ratio as a requirement
> > for cea mode matching only if the passed in mode actually has a
> > non-zero aspect ratio field. This will keep userspace that doesn't
> > provide an aspect ratio working as before by matching it to the
> > first otherwise equal cea mode. And once userspace starts to
> > provide the aspect ratio it will be considerd a hard requirement
> > for the match.
> >
> > Also change the hdmi mode matching to use drm_mode_match() for
> > consistency, but we don't match on aspect ratio there since the
> > spec doesn't list a specific aspect ratio for those modes.
> >
> > Cc: Shashank Sharma <shashank.sharma@intel.com>
> > Cc: "Lin, Jia" <lin.a.jia@intel.com>
> > Cc: Akashdeep Sharma <akashdeep.sharma@intel.com>
> > Cc: Jim Bride <jim.bride@linux.intel.com>
> > Cc: Jose Abreu <Jose.Abreu@synopsys.com>
> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Cc: Emil Velikov <emil.l.velikov@gmail.com>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >   drivers/gpu/drm/drm_edid.c | 18 ++++++++++++++----
> >   1 file changed, 14 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> > index 7220b8f9a7e8..00aa98f3e55d 100644
> > --- a/drivers/gpu/drm/drm_edid.c
> > +++ b/drivers/gpu/drm/drm_edid.c
> > @@ -2903,11 +2903,15 @@ cea_mode_alternate_timings(u8 vic, struct drm_display_mode *mode)
> >   static u8 drm_match_cea_mode_clock_tolerance(const struct drm_display_mode *to_match,
> >   					     unsigned int clock_tolerance)
> >   {
> > +	unsigned int match_flags = DRM_MODE_MATCH_TIMINGS | DRM_MODE_MATCH_FLAGS;
> >   	u8 vic;
> >   
> >   	if (!to_match->clock)
> >   		return 0;
> >   
> > +	if (to_match->picture_aspect_ratio)
> > +		match_flags |= DRM_MODE_MATCH_ASPECT_RATIO;
> This doesn't look right. This means we are expecting a CEA mode without 
> a pic aspect ratio field,
> which is invalid.

No, it's perfectly valid. It's what we currently get from userspace.

> Ankit is going to publish the aspect ratio patch 
> series again, with proper DRM cap and flags check. Would it be
> ok if we have a look that handling first ?

This patch will be needed by that work. Otherwise we're going to stop
sending a VIC for CEA modes with current userspace.

> > +
> >   	for (vic = 1; vic < ARRAY_SIZE(edid_cea_modes); vic++) {
> >   		struct drm_display_mode cea_mode = edid_cea_modes[vic];
> >   		unsigned int clock1, clock2;
> > @@ -2921,7 +2925,7 @@ static u8 drm_match_cea_mode_clock_tolerance(const struct drm_display_mode *to_m
> >   			continue;
> >   
> >   		do {
> > -			if (drm_mode_equal_no_clocks_no_stereo(to_match, &cea_mode))
> > +			if (drm_mode_match(to_match, &cea_mode, match_flags))
> >   				return vic;
> >   		} while (cea_mode_alternate_timings(vic, &cea_mode));
> >   	}
> > @@ -2938,11 +2942,15 @@ static u8 drm_match_cea_mode_clock_tolerance(const struct drm_display_mode *to_m
> >    */
> >   u8 drm_match_cea_mode(const struct drm_display_mode *to_match)
> >   {
> > +	unsigned int match_flags = DRM_MODE_MATCH_TIMINGS | DRM_MODE_MATCH_FLAGS;
> >   	u8 vic;
> >   
> >   	if (!to_match->clock)
> >   		return 0;
> >   
> > +	if (to_match->picture_aspect_ratio)
> > +		match_flags |= DRM_MODE_MATCH_ASPECT_RATIO;
> same here, and probably in other CEA match functions.
> > +
> >   	for (vic = 1; vic < ARRAY_SIZE(edid_cea_modes); vic++) {
> >   		struct drm_display_mode cea_mode = edid_cea_modes[vic];
> >   		unsigned int clock1, clock2;
> > @@ -2956,7 +2964,7 @@ u8 drm_match_cea_mode(const struct drm_display_mode *to_match)
> >   			continue;
> >   
> >   		do {
> > -			if (drm_mode_equal_no_clocks_no_stereo(to_match, &cea_mode))
> > +			if (drm_mode_match(to_match, &cea_mode, match_flags))
> >   				return vic;
> >   		} while (cea_mode_alternate_timings(vic, &cea_mode));
> >   	}
> > @@ -3003,6 +3011,7 @@ hdmi_mode_alternate_clock(const struct drm_display_mode *hdmi_mode)
> >   static u8 drm_match_hdmi_mode_clock_tolerance(const struct drm_display_mode *to_match,
> >   					      unsigned int clock_tolerance)
> >   {
> > +	unsigned int match_flags = DRM_MODE_MATCH_TIMINGS | DRM_MODE_MATCH_FLAGS;
> >   	u8 vic;
> >   
> >   	if (!to_match->clock)
> > @@ -3020,7 +3029,7 @@ static u8 drm_match_hdmi_mode_clock_tolerance(const struct drm_display_mode *to_
> >   		    abs(to_match->clock - clock2) > clock_tolerance)
> >   			continue;
> >   
> > -		if (drm_mode_equal_no_clocks_no_stereo(to_match, hdmi_mode))
> > +		if (drm_mode_match(to_match, hdmi_mode, match_flags))
> >   			return vic;
> >   	}
> >   
> > @@ -3037,6 +3046,7 @@ static u8 drm_match_hdmi_mode_clock_tolerance(const struct drm_display_mode *to_
> >    */
> >   static u8 drm_match_hdmi_mode(const struct drm_display_mode *to_match)
> >   {
> > +	unsigned int match_flags = DRM_MODE_MATCH_TIMINGS | DRM_MODE_MATCH_FLAGS;
> >   	u8 vic;
> >   
> >   	if (!to_match->clock)
> > @@ -3052,7 +3062,7 @@ static u8 drm_match_hdmi_mode(const struct drm_display_mode *to_match)
> >   
> >   		if ((KHZ2PICOS(to_match->clock) == KHZ2PICOS(clock1) ||
> >   		     KHZ2PICOS(to_match->clock) == KHZ2PICOS(clock2)) &&
> > -		    drm_mode_equal_no_clocks_no_stereo(to_match, hdmi_mode))
> > +		    drm_mode_match(to_match, hdmi_mode, match_flags))
> >   			return vic;
> >   	}
> >   	return 0;
> - Shashank

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-11-16 16:23 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-13 17:04 [PATCH 00/10] drm/edid: Infoframe cleanups and fixes Ville Syrjala
2017-11-13 17:04 ` [PATCH 01/10] video/hdmi: Allow "empty" HDMI infoframes Ville Syrjala
2017-11-13 17:04   ` Ville Syrjala
2017-11-16 14:36   ` Sharma, Shashank
2017-11-16 16:16     ` Ville Syrjälä
2017-11-17  3:05       ` Sharma, Shashank
2017-11-17  3:05         ` Sharma, Shashank
2017-11-13 17:04 ` [PATCH 02/10] drm/edid: Allow HDMI infoframe without VIC or S3D Ville Syrjala
2017-11-16 14:40   ` Sharma, Shashank
2017-11-16 16:21     ` Ville Syrjälä
2017-11-17  3:10       ` Sharma, Shashank
2017-11-22 18:28         ` Ville Syrjälä
2017-11-13 17:04 ` [PATCH 03/10] drm/modes: Introduce drm_mode_match() Ville Syrjala
2017-11-13 17:04 ` [PATCH 04/10] drm/edid: Use drm_mode_match_no_clocks_no_stereo() for consistentcy Ville Syrjala
2017-11-13 17:04 ` [PATCH 05/10] drm/edid: Fix up edid_cea_modes[] formatting Ville Syrjala
2017-11-13 17:04 ` [PATCH 06/10] drm/edid: Fix cea mode aspect ratio handling Ville Syrjala
2017-11-13 18:13   ` Jose Abreu
2017-11-13 18:53     ` Ville Syrjälä
2017-11-16 14:51   ` Sharma, Shashank
2017-11-16 16:23     ` Ville Syrjälä [this message]
2017-11-17  3:19       ` Sharma, Shashank
2017-11-17 11:35         ` Ville Syrjälä
2017-11-17 12:20           ` Sharma, Shashank
2017-11-17 12:49             ` Ville Syrjälä
2017-11-24  8:56               ` Sharma, Shashank
2017-11-24 13:22                 ` Ville Syrjälä
2017-11-13 17:04 ` [PATCH 07/10] drm/edid: Don't send bogus aspect ratios in AVI infoframes Ville Syrjala
2017-11-13 18:30   ` Jose Abreu
2017-11-13 19:00     ` Ville Syrjälä
2017-11-16 15:01   ` Sharma, Shashank
2017-11-16 16:26     ` Ville Syrjälä
2017-11-17  3:23       ` Sharma, Shashank
2017-11-17 11:38         ` Ville Syrjälä
2017-11-24  8:55           ` Sharma, Shashank
2017-11-13 17:04 ` [PATCH 08/10] video/hdmi: Reject illegal picture aspect ratios Ville Syrjala
2017-11-13 18:33   ` Jose Abreu
2017-11-13 18:33     ` Jose Abreu
2017-11-13 17:04 ` [PATCH 09/10] video/hdmi: Constify 'buffer' to the unpack functions Ville Syrjala
2017-11-13 17:04 ` [PATCH 10/10] video/hdmi: Pass buffer size to infoframe " Ville Syrjala
2017-11-20 13:36   ` Hans Verkuil
2017-11-20 14:55     ` Ville Syrjälä
2017-11-20 14:55       ` Ville Syrjälä
2017-11-13 17:52 ` ✓ Fi.CI.BAT: success for drm/edid: Infoframe cleanups and fixes Patchwork
2017-11-13 19:07 ` ✓ Fi.CI.IGT: " 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=20171116162357.GX10981@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=Jose.Abreu@synopsys.com \
    --cc=ankit.k.nautiyal@intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=lin.a.jia@intel.com \
    --cc=shashank.sharma@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.