From: Ville Syrjälä <ville.syrj...@linux.intel.com>

Do the fb size readout correctly for the 90/270 degree rotated
cases. Not sure if we're missing something else as well.

Also no idea whether the BIOS would ever do this.

Signed-off-by: Ville Syrjälä <ville.syrj...@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 22 ++++++++++++--------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index fd0103f6cc95..183f5d3cd106 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -10604,7 +10604,7 @@ skl_get_initial_plane_config(struct intel_crtc *crtc,
        enum pipe pipe;
        u32 val, base, offset, stride_mult, tiling, alpha;
        int fourcc, pixel_format;
-       unsigned int aligned_height;
+       unsigned int aligned_height, stride;
        struct drm_framebuffer *fb;
        struct intel_framebuffer *intel_fb;
 
@@ -10696,10 +10696,6 @@ skl_get_initial_plane_config(struct intel_crtc *crtc,
            val & PLANE_CTL_FLIP_HORIZONTAL)
                plane_config->rotation |= DRM_MODE_REFLECT_X;
 
-       /* 90/270 degree rotation would require extra work */
-       if (drm_rotation_90_or_270(plane_config->rotation))
-               goto error;
-
        base = intel_de_read(dev_priv, PLANE_SURF(pipe, plane_id)) & 0xfffff000;
        plane_config->base = base;
 
@@ -10710,10 +10706,18 @@ skl_get_initial_plane_config(struct intel_crtc *crtc,
        fb->width = ((val >> 0) & 0xffff) + 1;
 
        val = intel_de_read(dev_priv, PLANE_STRIDE(pipe, plane_id));
-       stride_mult = skl_plane_stride_mult(fb, 0, DRM_MODE_ROTATE_0);
-       fb->pitches[0] = (val & 0x3ff) * stride_mult;
-
-       aligned_height = intel_fb_align_height(fb, 0, fb->height);
+       stride_mult = skl_plane_stride_mult(fb, 0, plane_config->rotation);
+       stride = (val & 0x3ff) * stride_mult;
+
+       if (drm_rotation_90_or_270(plane_config->rotation)) {
+               swap(fb->width, fb->height);
+               fb->pitches[0] = ALIGN(fb->width * fb->format->cpp[0],
+                                      intel_fb_stride_alignment(fb, 0));
+               aligned_height = stride;
+       } else {
+               fb->pitches[0] = stride;
+               aligned_height = intel_fb_align_height(fb, 0, fb->height);
+       }
 
        plane_config->size = fb->pitches[0] * aligned_height;
 
-- 
2.26.2

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

Reply via email to