Re: [PATCH 1/2] drm: Set crtc->invert_dimensions from the atomic helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 15, 2015 at 04:53:00PM +0300, ville.syrjala@xxxxxxxxxxxxxxx wrote:
> From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> 
> Pull the crtc->invert_dimensions setting from omapdrm into the atomic
> helpers so that all drivers will check viewport correctly in setcrtc()
> after rotating the primary plane,
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 8 ++++++++
>  drivers/gpu/drm/omapdrm/omap_crtc.c | 3 ---
>  2 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 87a2a44..d0d11dbf 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -1272,6 +1272,11 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,
>  
>  		funcs->atomic_flush(crtc, old_crtc_state);
>  	}
> +
> +	for_each_crtc_in_state(old_state, crtc, old_crtc_state, i) {
> +		crtc->invert_dimensions = (crtc->primary->state->rotation &
> +					   (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270)));
> +	}
>  }
>  EXPORT_SYMBOL(drm_atomic_helper_commit_planes);
>  
> @@ -1330,6 +1335,9 @@ drm_atomic_helper_commit_planes_on_crtc(struct drm_crtc_state *old_crtc_state)
>  
>  	if (crtc_funcs && crtc_funcs->atomic_flush)
>  		crtc_funcs->atomic_flush(crtc, old_crtc_state);
> +
> +	crtc->invert_dimensions = (crtc->primary->state->rotation &
> +				   (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270)));

This is racy for async atomic commits since it's only set in the tail part
of the commit, but we read it synchronously from ioctl code. So we'd need
to either state-ify this properly or do something else. Best might be to
ditch crtc->invert_dimensions (so no non-atomic driver uses it), push the
check for legacy drivers down into driver callbacks and for atomic drivers
into the generic check parts of drm_atomic_check.

Not pretty, but probably about the best we can do.
-Daniel

>  }
>  EXPORT_SYMBOL(drm_atomic_helper_commit_planes_on_crtc);
>  
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
> index 9a4ba4f..ad09590 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> @@ -412,9 +412,6 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
>  		dispc_mgr_go(omap_crtc->channel);
>  		omap_irq_register(crtc->dev, &omap_crtc->vblank_irq);
>  	}
> -
> -	crtc->invert_dimensions = !!(crtc->primary->state->rotation &
> -				    (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270)));
>  }
>  
>  static int omap_crtc_atomic_set_property(struct drm_crtc *crtc,
> -- 
> 2.4.9
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux