[Intel-gfx] [PATCH] drm/i915: Consider plane rotation when calculating stride in skl_do_mmio_flip

Jindal, Sonika sonika.jindal at intel.com
Wed Oct 7 05:10:03 PDT 2015



On 10/7/2015 3:31 PM, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>
> Previously rotation was ignored and wrong stride programmed
> into the plane registers resulting in a corrupt image on screen.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> Cc: Sonika Jindal <sonika.jindal at intel.com>
> ---
>   drivers/gpu/drm/i915/intel_display.c | 16 ++++++++++++----
>   1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 539c3737e823..6328788193e4 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -11126,9 +11126,10 @@ static void skl_do_mmio_flip(struct intel_crtc *intel_crtc)
>   {
>   	struct drm_device *dev = intel_crtc->base.dev;
>   	struct drm_i915_private *dev_priv = dev->dev_private;
> +	struct drm_plane *plane = intel_crtc->base.primary;
>   	struct drm_framebuffer *fb = intel_crtc->base.primary->fb;
>   	const enum pipe pipe = intel_crtc->pipe;
> -	u32 ctl, stride;
> +	u32 ctl, stride, tile_height;
>
>   	ctl = I915_READ(PLANE_CTL(pipe, 0));
>   	ctl &= ~PLANE_CTL_TILED_MASK;
> @@ -11152,9 +11153,16 @@ static void skl_do_mmio_flip(struct intel_crtc *intel_crtc)
>   	 * The stride is either expressed as a multiple of 64 bytes chunks for
>   	 * linear buffers or in number of tiles for tiled buffers.
>   	 */
> -	stride = fb->pitches[0] /
> -		 intel_fb_stride_alignment(dev, fb->modifier[0],
> -					   fb->pixel_format);
> +	if (intel_rotation_90_or_270(plane->state->rotation)) {
> +		/* stride = Surface height in tiles */
> +		tile_height = intel_tile_height(dev, fb->pixel_format,
> +						fb->modifier[0], 0);
> +		stride = DIV_ROUND_UP(fb->height, tile_height);
Wouldn't we need a PLANE_SIZE update somewhere in case of 90/270? For 
the cases where the plane is not square and can fit after rotation as well?

> +	} else {
> +		stride = fb->pitches[0] /
> +				intel_fb_stride_alignment(dev, fb->modifier[0],
> +							  fb->pixel_format);
> +	}
>
>   	/*
>   	 * Both PLANE_CTL and PLANE_STRIDE are not updated on vblank but on
>


More information about the Intel-gfx mailing list