[Intel-gfx] [PATCH] drm/i915: Allow panel fixed modes to have differing sync polarities

Ville Syrjälä ville.syrjala at linux.intel.com
Thu Oct 20 08:33:44 UTC 2022


On Thu, Oct 13, 2022 at 09:46:27AM +0300, Jani Nikula wrote:
> On Fri, 07 Oct 2022, Ville Syrjala <ville.syrjala at linux.intel.com> wrote:
> > From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> >
> > Apparently some panels declare multiple modes with random
> > sync polarities. Seems a bit weird, but looks like Windows/GOP
> > doesn't care, so let follow suit and accept alternate fixed
> > modes regardless of their sync polarities.
> >
> > Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/6968
> > Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_panel.c | 10 +++++++---
> >  1 file changed, 7 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_panel.c b/drivers/gpu/drm/i915/display/intel_panel.c
> > index 2b4b359b8342..fdeb1cd608c3 100644
> > --- a/drivers/gpu/drm/i915/display/intel_panel.c
> > +++ b/drivers/gpu/drm/i915/display/intel_panel.c
> > @@ -82,12 +82,16 @@ static bool is_alt_drrs_mode(const struct drm_display_mode *mode,
> >  		mode->clock != preferred_mode->clock;
> >  }
> >  
> > +#define DRM_MODE_FLAG_SYNC_MASK (DRM_MODE_FLAG_PHSYNC | \
> > +				 DRM_MODE_FLAG_NHSYNC | \
> > +				 DRM_MODE_FLAG_PVSYNC | \
> > +				 DRM_MODE_FLAG_NVSYNC)
> 
> Maybe not the best to name the macro in the DRM_MODE_* "namespace"?

Yeah. My "cunning" plan was that maybe one day someone will
add the same define to drm_mode.h and then we can get rid of
it. But that is probably a bad idea, especially since there
are those csync polarity flags as well...

I'll respin with a local variable or something.

> 
> Other than that,
> 
> Acked-by: Jani Nikula <jani.nikula at intel.com>
> 
> 
> > +
> >  static bool is_alt_fixed_mode(const struct drm_display_mode *mode,
> >  			      const struct drm_display_mode *preferred_mode)
> >  {
> > -	return drm_mode_match(mode, preferred_mode,
> > -			      DRM_MODE_MATCH_FLAGS |
> > -			      DRM_MODE_MATCH_3D_FLAGS) &&
> > +	return (mode->flags & ~DRM_MODE_FLAG_SYNC_MASK) ==
> > +		(preferred_mode->flags & ~DRM_MODE_FLAG_SYNC_MASK) &&
> >  		mode->hdisplay == preferred_mode->hdisplay &&
> >  		mode->vdisplay == preferred_mode->vdisplay;
> >  }
> 
> -- 
> Jani Nikula, Intel Open Source Graphics Center

-- 
Ville Syrjälä
Intel


More information about the Intel-gfx mailing list