diff mbox

drm/i915: Swapping 90 and 270 to be compliant with Xrandr

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

Commit Message

sonika.jindal@intel.com May 20, 2015, 8:10 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.

v2: Rebased

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>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Daniel Vetter May 20, 2015, 9:15 a.m. UTC | #1
On Wed, May 20, 2015 at 01:40:48PM +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.
> 
> v2: Rebased
> 
> 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>
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

I've fixed the summary to make it clear this is skl-only and applied the
patch to dinq, thanks.
-Daniel

> ---
>  drivers/gpu/drm/i915/intel_display.c |    8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 9d2d6fb..a583422 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -3010,12 +3010,16 @@ u32 skl_plane_ctl_rotation(unsigned int rotation)
>  	switch (rotation) {
>  	case BIT(DRM_ROTATE_0):
>  		break;
> +	/*
> +	 * 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):
> -		return PLANE_CTL_ROTATE_90;
> +		return PLANE_CTL_ROTATE_270;
>  	case BIT(DRM_ROTATE_180):
>  		return PLANE_CTL_ROTATE_180;
>  	case BIT(DRM_ROTATE_270):
> -		return PLANE_CTL_ROTATE_270;
> +		return PLANE_CTL_ROTATE_90;
>  	default:
>  		MISSING_CASE(rotation);
>  	}
> -- 
> 1.7.10.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 9d2d6fb..a583422 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3010,12 +3010,16 @@  u32 skl_plane_ctl_rotation(unsigned int rotation)
 	switch (rotation) {
 	case BIT(DRM_ROTATE_0):
 		break;
+	/*
+	 * 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):
-		return PLANE_CTL_ROTATE_90;
+		return PLANE_CTL_ROTATE_270;
 	case BIT(DRM_ROTATE_180):
 		return PLANE_CTL_ROTATE_180;
 	case BIT(DRM_ROTATE_270):
-		return PLANE_CTL_ROTATE_270;
+		return PLANE_CTL_ROTATE_90;
 	default:
 		MISSING_CASE(rotation);
 	}