[PATCH 4/5] drm: Check crtc viewport correctly with rotated primary plane on atomic drivers

Matt Roper matthew.d.roper at intel.com
Fri Oct 16 08:26:47 PDT 2015


On Fri, Oct 16, 2015 at 06:10:20PM +0300, Ville Syrjälä wrote:
> On Fri, Oct 16, 2015 at 04:35:02PM +0200, Daniel Vetter wrote:
> > On Fri, Oct 16, 2015 at 11:38:18AM +0300, Ville Syrjälä wrote:
> > > On Thu, Oct 15, 2015 at 05:32:12PM -0700, Matt Roper wrote:
> > > > On Thu, Oct 15, 2015 at 08:40:01PM +0300, ville.syrjala at linux.intel.com wrote:
> > > > > From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> > > > > 
> > > > > On atomic drivers we can dig out the primary plane rotation from the
> > > > > plane state instead of looking at the legacy crtc->invert_dimensions
> > > > > flag. The flag is not set by anyone except omapdrm, and it would be
> > > > > racy to set it the same way in the atomic helpers.
> > > > 
> > > > Can't we just remove the invert_dimensions field completely now?  It's a
> > > > legacy-only field, but no legacy drivers actually set it, so it winds up
> > > > being completely unused.
> > > 
> > > omap sets it.
> > 
> > Omap should be atomic now (maybe double-check with Laurent), so I think we
> > can indeed ditch it. Follow-up series perhaps?
> 
> grep ATOMIC in omap didn't turn up anything, so I assumed no.

omap might not be full atomic (just like i915 isn't full atomic), but
it's state-based now, so your new code below will cause the
invert_dimensions to be ignored by the DRM core.  And omap never uses
the field internally, aside from setting it once to reflect the state
values, so as far as I can see, the field is completely unused.


Matt

> 
> > -Daniel
> > 
> > > 
> > > > 
> > > > 
> > > > Matt
> > > > 
> > > > > 
> > > > > Cc: Matt Roper <matthew.d.roper at intel.com>
> > > > > Cc: Tvrtko Ursulin <tvrtko.ursulin at linux.intel.com>
> > > > > Cc: Daniel Vetter <daniel at ffwll.ch>
> > > > > Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> > > > > ---
> > > > >  drivers/gpu/drm/drm_crtc.c | 12 +++++++++++-
> > > > >  1 file changed, 11 insertions(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> > > > > index 227613a..ffaa3f5 100644
> > > > > --- a/drivers/gpu/drm/drm_crtc.c
> > > > > +++ b/drivers/gpu/drm/drm_crtc.c
> > > > > @@ -2545,6 +2545,16 @@ void drm_crtc_get_hv_timing(const struct drm_display_mode *mode,
> > > > >  }
> > > > >  EXPORT_SYMBOL(drm_crtc_get_hv_timing);
> > > > >  
> > > > > +static bool invert_dimensions(const struct drm_crtc *crtc)
> > > > > +{
> > > > > +	if (crtc->state) {
> > > > > +		return crtc->primary->state->rotation & (BIT(DRM_ROTATE_90) |
> > > > > +							 BIT(DRM_ROTATE_270));
> > > > > +	} else {
> > > > > +		return crtc->invert_dimensions;
> > > > > +	}
> > > > > +}
> > > > > +
> > > > >  /**
> > > > >   * drm_crtc_check_viewport - Checks that a framebuffer is big enough for the
> > > > >   *     CRTC viewport
> > > > > @@ -2564,7 +2574,7 @@ int drm_crtc_check_viewport(const struct drm_crtc *crtc,
> > > > >  
> > > > >  	drm_crtc_get_hv_timing(mode, &hdisplay, &vdisplay);
> > > > >  
> > > > > -	if (crtc->invert_dimensions)
> > > > > +	if (invert_dimensions(crtc))
> > > > >  		swap(hdisplay, vdisplay);
> > > > >  
> > > > >  	return check_src_coords(x << 16, y << 16,
> > > > > -- 
> > > > > 2.4.9
> > > > > 
> > > > 
> > > > -- 
> > > > Matt Roper
> > > > Graphics Software Engineer
> > > > IoTG Platform Enabling & Development
> > > > Intel Corporation
> > > > (916) 356-2795
> > > 
> > > -- 
> > > Ville Syrjälä
> > > Intel OTC
> > 
> > -- 
> > Daniel Vetter
> > Software Engineer, Intel Corporation
> > http://blog.ffwll.ch
> 
> -- 
> Ville Syrjälä
> Intel OTC

-- 
Matt Roper
Graphics Software Engineer
IoTG Platform Enabling & Development
Intel Corporation
(916) 356-2795


More information about the dri-devel mailing list