All of lore.kernel.org
 help / color / mirror / Atom feed
From: ville.syrjala@linux.intel.com
To: intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Subject: [PATCH 6/7] drm/i915: Clean up rotation DSPCNTR/DVSCNTR/etc. setup
Date: Wed, 20 Jul 2016 16:18:11 +0300	[thread overview]
Message-ID: <1469020693-24356-7-git-send-email-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <1469020693-24356-1-git-send-email-ville.syrjala@linux.intel.com>

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

Move the plane control register rotation setup away from the
coordinate munging code. This will result in neater looking
code once we add reflection support for CHV.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 28 ++++++++++++++--------------
 drivers/gpu/drm/i915/intel_sprite.c  | 28 +++++++++++++++-------------
 2 files changed, 29 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 79c1a8b89d1d..88a7c4173715 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2674,6 +2674,9 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
 	    obj->tiling_mode != I915_TILING_NONE)
 		dspcntr |= DISPPLANE_TILED;
 
+	if (rotation & BIT(DRM_ROTATE_180))
+		dspcntr |= DISPPLANE_ROTATE_180;
+
 	if (IS_G4X(dev))
 		dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE;
 
@@ -2689,8 +2692,6 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
 	}
 
 	if (rotation & BIT(DRM_ROTATE_180)) {
-		dspcntr |= DISPPLANE_ROTATE_180;
-
 		x += (crtc_state->pipe_src_w - 1);
 		y += (crtc_state->pipe_src_h - 1);
 
@@ -2783,6 +2784,9 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,
 	if (obj->tiling_mode != I915_TILING_NONE)
 		dspcntr |= DISPPLANE_TILED;
 
+	if (rotation & BIT(DRM_ROTATE_180))
+		dspcntr |= DISPPLANE_ROTATE_180;
+
 	if (!IS_HASWELL(dev) && !IS_BROADWELL(dev))
 		dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE;
 
@@ -2792,19 +2796,15 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,
 					  fb->pitches[0], rotation);
 	linear_offset -= intel_crtc->dspaddr_offset;
 
-	if (rotation & BIT(DRM_ROTATE_180)) {
-		dspcntr |= DISPPLANE_ROTATE_180;
-
-		if (!IS_HASWELL(dev) && !IS_BROADWELL(dev)) {
-			x += (crtc_state->pipe_src_w - 1);
-			y += (crtc_state->pipe_src_h - 1);
+	/* HSW and BDW does this automagically in hardware */
+	if (!IS_HASWELL(dev) && !IS_BROADWELL(dev) &&
+	    rotation & BIT(DRM_ROTATE_180)) {
+		x += (crtc_state->pipe_src_w - 1);
+		y += (crtc_state->pipe_src_h - 1);
 
-			/* Finding the last pixel of the last line of the display
-			data and adding to linear_offset*/
-			linear_offset +=
-				(crtc_state->pipe_src_h - 1) * fb->pitches[0] +
-				(crtc_state->pipe_src_w - 1) * cpp;
-		}
+		linear_offset +=
+			(crtc_state->pipe_src_h - 1) * fb->pitches[0] +
+			(crtc_state->pipe_src_w - 1) * cpp;
 	}
 
 	intel_crtc->adjusted_x = x;
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 6b815d57d75a..14173f53f520 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -433,6 +433,9 @@ vlv_update_plane(struct drm_plane *dplane,
 	if (obj->tiling_mode != I915_TILING_NONE)
 		sprctl |= SP_TILED;
 
+	if (rotation & BIT(DRM_ROTATE_180))
+		sprctl |= SP_ROTATE_180;
+
 	/* Sizes are 0 based */
 	src_w--;
 	src_h--;
@@ -445,8 +448,6 @@ vlv_update_plane(struct drm_plane *dplane,
 	linear_offset -= sprsurf_offset;
 
 	if (rotation & BIT(DRM_ROTATE_180)) {
-		sprctl |= SP_ROTATE_180;
-
 		x += src_w;
 		y += src_h;
 		linear_offset += src_h * fb->pitches[0] + src_w * cpp;
@@ -555,6 +556,9 @@ ivb_update_plane(struct drm_plane *plane,
 	if (obj->tiling_mode != I915_TILING_NONE)
 		sprctl |= SPRITE_TILED;
 
+	if (rotation & BIT(DRM_ROTATE_180))
+		sprctl |= SPRITE_ROTATE_180;
+
 	if (IS_HASWELL(dev) || IS_BROADWELL(dev))
 		sprctl &= ~SPRITE_TRICKLE_FEED_DISABLE;
 	else
@@ -577,15 +581,12 @@ ivb_update_plane(struct drm_plane *plane,
 						   fb->pitches[0], rotation);
 	linear_offset -= sprsurf_offset;
 
-	if (rotation & BIT(DRM_ROTATE_180)) {
-		sprctl |= SPRITE_ROTATE_180;
-
-		/* HSW and BDW does this automagically in hardware */
-		if (!IS_HASWELL(dev) && !IS_BROADWELL(dev)) {
-			x += src_w;
-			y += src_h;
-			linear_offset += src_h * fb->pitches[0] + src_w * cpp;
-		}
+	/* HSW and BDW does this automagically in hardware */
+	if (!IS_HASWELL(dev) && !IS_BROADWELL(dev) &&
+	    rotation & BIT(DRM_ROTATE_180)) {
+		x += src_w;
+		y += src_h;
+		linear_offset += src_h * fb->pitches[0] + src_w * cpp;
 	}
 
 	if (key->flags) {
@@ -696,6 +697,9 @@ ilk_update_plane(struct drm_plane *plane,
 	if (obj->tiling_mode != I915_TILING_NONE)
 		dvscntr |= DVS_TILED;
 
+	if (rotation & BIT(DRM_ROTATE_180))
+		dvscntr |= DVS_ROTATE_180;
+
 	if (IS_GEN6(dev))
 		dvscntr |= DVS_TRICKLE_FEED_DISABLE; /* must disable */
 
@@ -715,8 +719,6 @@ ilk_update_plane(struct drm_plane *plane,
 	linear_offset -= dvssurf_offset;
 
 	if (rotation & BIT(DRM_ROTATE_180)) {
-		dvscntr |= DVS_ROTATE_180;
-
 		x += src_w;
 		y += src_h;
 		linear_offset += src_h * fb->pitches[0] + src_w * cpp;
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2016-07-20 13:18 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-20 13:18 [PATCH 0/7] drm/i915: Per-plane rotation, fixes, and mirroring for CHV ville.syrjala
2016-07-20 13:18 ` [PATCH 1/7] drm: Add drm_rotation_90_or_270() ville.syrjala
2016-07-20 13:24   ` Joonas Lahtinen
2016-07-20 13:41   ` [Intel-gfx] " Chris Wilson
2016-07-20 13:18 ` [PATCH 2/7] drm/atomic: Reject attempts to use multiple rotation angles at once ville.syrjala
2016-07-20 13:26   ` Joonas Lahtinen
2016-07-20 13:27   ` Chris Wilson
2016-07-20 13:18 ` [PATCH 3/7] drm: Add support for optional per-plane rotation property ville.syrjala
2016-07-20 13:31   ` [Intel-gfx] " Chris Wilson
2016-07-20 13:51   ` Joonas Lahtinen
2016-07-20 14:08     ` Ville Syrjälä
2016-07-20 14:13       ` Joonas Lahtinen
2016-07-20 13:18 ` [PATCH 4/7] drm/i915: Use the " ville.syrjala
2016-07-20 13:34   ` Chris Wilson
2016-07-20 13:57   ` Joonas Lahtinen
2016-07-20 14:13     ` Ville Syrjälä
2016-07-20 13:18 ` [PATCH 5/7] drm/i915: Use & instead if == to check for rotations ville.syrjala
2016-07-20 13:35   ` [Intel-gfx] " Chris Wilson
2016-07-20 14:01   ` Joonas Lahtinen
2016-07-20 14:14     ` Ville Syrjälä
2016-07-20 13:18 ` ville.syrjala [this message]
2016-07-20 13:37   ` [PATCH 6/7] drm/i915: Clean up rotation DSPCNTR/DVSCNTR/etc. setup Chris Wilson
2016-07-20 14:03   ` Joonas Lahtinen
2016-07-20 13:18 ` [PATCH 7/7] drm/i915: Add horizontal mirroring support for CHV pipe B planes ville.syrjala
2016-07-21 10:30   ` Joonas Lahtinen
2016-07-20 13:18 ` [PATCH i-g-t] tests/kms_rotation_crc: Add bad-rotation subtest ville.syrjala
2016-07-21 10:32   ` Joonas Lahtinen
2016-07-21 11:05     ` Ville Syrjälä
2016-07-22 12:52       ` Matthew Auld
2016-07-22 13:23         ` Ville Syrjälä
2016-07-20 14:17 ` ✓ Ro.CI.BAT: success for drm/i915: Per-plane rotation, fixes, and mirroring for CHV Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1469020693-24356-7-git-send-email-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.