[Intel-gfx] [PATCH 1/2] drm/i915: Swapping 90 and 270 to be compliant with Xrandr

Sonika Jindal sonika.jindal at intel.com
Wed Apr 15 03:05:07 PDT 2015


Since DRM_ROTATE is counter clockwise (which is compliant with Xrandr),
and HW rotation is clockwise, swapping 90/270 to work as expected from
userspace.

Suggested-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
Signed-off-by: Sonika Jindal <sonika.jindal at intel.com>
---
 drivers/gpu/drm/i915/intel_display.c |    8 ++++++--
 drivers/gpu/drm/i915/intel_sprite.c  |    8 ++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 97922fb..0d7da3f 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3039,8 +3039,12 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc,
 	plane = crtc->primary;
 	rotation = plane->state->rotation;
 	switch (rotation) {
+	/*
+	 * DRM_ROTATE_ is counter clockwise to stay compatible with Xrandr
+	 * while i915 HW rotation is clockwise, thats why this swapping.
+	 */
 	case BIT(DRM_ROTATE_90):
-		plane_ctl |= PLANE_CTL_ROTATE_90;
+		plane_ctl |= PLANE_CTL_ROTATE_270;
 		break;
 
 	case BIT(DRM_ROTATE_180):
@@ -3048,7 +3052,7 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc,
 		break;
 
 	case BIT(DRM_ROTATE_270):
-		plane_ctl |= PLANE_CTL_ROTATE_270;
+		plane_ctl |= PLANE_CTL_ROTATE_90;
 		break;
 	}
 
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index e3d41c0..765095e 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -259,8 +259,12 @@ skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc,
 
 	rotation = drm_plane->state->rotation;
 	switch (rotation) {
+	/*
+	 * DRM_ROTATE_ is counter clockwise to stay compatible with Xrandr
+	 * while i915 HW rotation is clockwise, thats why this swapping.
+	 */
 	case BIT(DRM_ROTATE_90):
-		plane_ctl |= PLANE_CTL_ROTATE_90;
+		plane_ctl |= PLANE_CTL_ROTATE_270;
 		break;
 
 	case BIT(DRM_ROTATE_180):
@@ -268,7 +272,7 @@ skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc,
 		break;
 
 	case BIT(DRM_ROTATE_270):
-		plane_ctl |= PLANE_CTL_ROTATE_270;
+		plane_ctl |= PLANE_CTL_ROTATE_90;
 		break;
 	}
 
-- 
1.7.10.4



More information about the Intel-gfx mailing list