diff mbox

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

Message ID 1429092308-4739-1-git-send-email-sonika.jindal@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

sonika.jindal@intel.com April 15, 2015, 10:05 a.m. UTC
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@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Sonika Jindal <sonika.jindal@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(-)

Comments

Ville Syrjälä May 12, 2015, 12:35 p.m. UTC | #1
On Wed, Apr 15, 2015 at 03:35:07PM +0530, Sonika Jindal wrote:
> 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@linux.intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Sonika Jindal <sonika.jindal@intel.com>

Looks like this needs a rebase, but other than that this is

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.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
diff mbox

Patch

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;
 	}