From: Tvrtko Ursulin <tvrtko.ursu...@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.ursu...@intel.com>
Cc: Sonika Jindal <sonika.jin...@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);
+       } 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
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to