All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King <rmk+kernel@armlinux.org.uk>
To: dri-devel@lists.freedesktop.org
Cc: David Airlie <airlied@linux.ie>
Subject: [PATCH 03/20] drm/armada: provide pitches from armada_drm_plane_calc_addrs()
Date: Tue, 10 Jul 2018 11:41:25 +0100	[thread overview]
Message-ID: <E1fcq5F-0004HD-TE@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <20180710104027.GJ17271@n2100.armlinux.org.uk>

Provide the framebuffer pitches from armada_drm_plane_calc_addrs() as
well as the base addresses for each plane.  Since this is now about
more than just addresses, rename to armada_drm_plane_calc().

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 drivers/gpu/drm/armada/armada_overlay.c |  8 ++++----
 drivers/gpu/drm/armada/armada_plane.c   | 22 ++++++++++++++--------
 drivers/gpu/drm/armada/armada_plane.h   |  3 ++-
 3 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c
index e8c3bcc09d5c..f36f6fb919e7 100644
--- a/drivers/gpu/drm/armada/armada_overlay.c
+++ b/drivers/gpu/drm/armada/armada_overlay.c
@@ -130,10 +130,10 @@ static void armada_drm_overlay_plane_atomic_update(struct drm_plane *plane,
 	    old_state->src.y1 != state->src.y1 ||
 	    old_state->fb != state->fb) {
 		const struct drm_format_info *format;
-		u16 src_x;
+		u16 src_x, pitches[3];
 		u32 addrs[3];
 
-		armada_drm_plane_calc_addrs(state, addrs);
+		armada_drm_plane_calc(state, addrs, pitches);
 
 		armada_reg_queue_set(regs, idx, addrs[0],
 				     LCD_SPU_DMA_START_ADDR_Y0);
@@ -148,9 +148,9 @@ static void armada_drm_overlay_plane_atomic_update(struct drm_plane *plane,
 		armada_reg_queue_set(regs, idx, addrs[2],
 				     LCD_SPU_DMA_START_ADDR_V1);
 
-		val = state->fb->pitches[0] << 16 | state->fb->pitches[0];
+		val = pitches[0] << 16 | pitches[0];
 		armada_reg_queue_set(regs, idx, val, LCD_SPU_DMA_PITCH_YC);
-		val = state->fb->pitches[1] << 16 | state->fb->pitches[2];
+		val = pitches[1] << 16 | pitches[2];
 		armada_reg_queue_set(regs, idx, val, LCD_SPU_DMA_PITCH_UV);
 
 		cfg = CFG_DMA_FMT(drm_fb_to_armada_fb(state->fb)->fmt) |
diff --git a/drivers/gpu/drm/armada/armada_plane.c b/drivers/gpu/drm/armada/armada_plane.c
index c426c92c79d9..3c9414c56aca 100644
--- a/drivers/gpu/drm/armada/armada_plane.c
+++ b/drivers/gpu/drm/armada/armada_plane.c
@@ -35,7 +35,8 @@ static const uint32_t armada_primary_formats[] = {
 	DRM_FORMAT_BGR565,
 };
 
-void armada_drm_plane_calc_addrs(struct drm_plane_state *state, u32 addrs[3])
+void armada_drm_plane_calc(struct drm_plane_state *state, u32 addrs[3],
+	u16 pitches[3])
 {
 	struct drm_framebuffer *fb = state->fb;
 	const struct drm_format_info *format = fb->format;
@@ -53,37 +54,42 @@ void armada_drm_plane_calc_addrs(struct drm_plane_state *state, u32 addrs[3])
 
 	addrs[0] = addr + fb->offsets[0] + y * fb->pitches[0] +
 		   x * format->cpp[0];
+	pitches[0] = fb->pitches[0];
 
 	y /= format->vsub;
 	x /= format->hsub;
 
-	for (i = 1; i < num_planes; i++)
+	for (i = 1; i < num_planes; i++) {
 		addrs[i] = addr + fb->offsets[i] + y * fb->pitches[i] +
 			     x * format->cpp[i];
-	for (; i < 3; i++)
+		pitches[i] = fb->pitches[i];
+	}
+	for (; i < 3; i++) {
 		addrs[i] = 0;
+		pitches[i] = 0;
+	}
 }
 
 static unsigned armada_drm_crtc_calc_fb(struct drm_plane_state *state,
 	struct armada_regs *regs, bool interlaced)
 {
-	unsigned pitch = state->fb->pitches[0];
+	u16 pitches[3];
 	u32 addrs[3], addr_odd, addr_even;
 	unsigned i = 0;
 
-	armada_drm_plane_calc_addrs(state, addrs);
+	armada_drm_plane_calc(state, addrs, pitches);
 
 	addr_odd = addr_even = addrs[0];
 
 	if (interlaced) {
-		addr_even += pitch;
-		pitch *= 2;
+		addr_even += pitches[0];
+		pitches[0] *= 2;
 	}
 
 	/* write offset, base, and pitch */
 	armada_reg_queue_set(regs, i, addr_odd, LCD_CFG_GRA_START_ADDR0);
 	armada_reg_queue_set(regs, i, addr_even, LCD_CFG_GRA_START_ADDR1);
-	armada_reg_queue_mod(regs, i, pitch, 0xffff, LCD_CFG_GRA_PITCH);
+	armada_reg_queue_mod(regs, i, pitches[0], 0xffff, LCD_CFG_GRA_PITCH);
 
 	return i;
 }
diff --git a/drivers/gpu/drm/armada/armada_plane.h b/drivers/gpu/drm/armada/armada_plane.h
index 999a0bd3e512..98280beaaa44 100644
--- a/drivers/gpu/drm/armada/armada_plane.h
+++ b/drivers/gpu/drm/armada/armada_plane.h
@@ -1,7 +1,8 @@
 #ifndef ARMADA_PLANE_H
 #define ARMADA_PLANE_H
 
-void armada_drm_plane_calc_addrs(struct drm_plane_state *state, u32 addrs[3]);
+void armada_drm_plane_calc(struct drm_plane_state *state, u32 addrs[3],
+	u16 pitches[3]);
 int armada_drm_plane_prepare_fb(struct drm_plane *plane,
 	struct drm_plane_state *state);
 void armada_drm_plane_cleanup_fb(struct drm_plane *plane,
-- 
2.7.4

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

  parent reply	other threads:[~2018-07-10 10:41 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-10 10:23 [PATCH 0/3] Finish Armada DRM DT support Russell King - ARM Linux
2018-07-10 10:23 ` Russell King - ARM Linux
2018-07-10 10:24 ` [PATCH 1/3] drm/armada: fix compare_of() for LCD controllers Russell King
2018-07-10 10:24   ` Russell King
2018-07-10 10:24 ` [PATCH 2/3] drm/armada: add OF reserved memory support Russell King
2018-07-10 10:24   ` Russell King
2018-12-18 15:18   ` Lubomir Rintel
2018-12-18 15:18     ` Lubomir Rintel
2018-07-10 10:24 ` [PATCH 3/3] ARM: dts: cubox: add LCD controller and TDA998x configuration Russell King
2018-07-10 10:24   ` Russell King
2018-07-18 14:53   ` Gregory CLEMENT
2018-07-18 14:53     ` Gregory CLEMENT
2018-07-10 10:31 ` [PATCH 00/17] Transition Armada DRM planes to atomic state Russell King - ARM Linux
2018-07-10 10:32   ` [PATCH 01/17] drm/armada: clean up armada_drm_crtc_page_flip() Russell King
2018-07-10 10:32   ` [PATCH 02/17] drm/armada: add rectangle helpers Russell King
2018-07-10 10:32   ` [PATCH 03/17] drm/armada: move mode set vblank handling and disable/enable Russell King
2018-07-10 10:32   ` [PATCH 04/17] drm/armada: use core of primary update_plane for mode set Russell King
2018-07-10 10:32   ` [PATCH 05/17] drm/armada: merge armada_drm_gra_plane_regs() into only caller Russell King
2018-07-10 10:32   ` [PATCH 06/17] drm/armada: reset all atomic state during driver initialisation Russell King
2018-07-10 10:32   ` [PATCH 07/17] drm/armada: convert primary plane to atomic state Russell King
2018-07-10 10:32   ` [PATCH 08/17] drm/armada: convert page_flip to use primary plane atomic_update() Russell King
2018-07-10 10:32   ` [PATCH 09/17] drm/armada: convert overlay plane to atomic state Russell King
2018-07-10 10:33   ` [PATCH 10/17] drm/armada: remove temporary crtc state Russell King
2018-07-10 10:33   ` [PATCH 11/17] drm/armada: use old_state for update tracking in atomic_update() Russell King
2018-07-10 10:33   ` [PATCH 12/17] drm/armada: move primary plane to separate file Russell King
2018-07-10 10:33   ` [PATCH 13/17] drm/armada: move plane works to overlay Russell King
2018-07-10 10:33   ` [PATCH 14/17] drm/armada: move CBSH properties into overlay plane state Russell King
2018-07-10 10:33   ` [PATCH 15/17] drm/armada: move colorkey " Russell King
2018-07-10 10:33   ` [PATCH 16/17] drm/armada: remove crtc YUV colourspace properties Russell King
2018-07-10 10:33   ` [PATCH 17/17] drm/armada: add plane colorspace properties Russell King
2018-07-10 10:40   ` [PATCH 00/20] Finish Armada DRM transition to atomic modeset Russell King - ARM Linux
2018-07-10 10:41     ` [PATCH 01/20] drm/armada: move armada_drm_mode_config_funcs to armada_drv.c Russell King
2018-07-10 10:41     ` [PATCH 02/20] drm/armada: pass plane state into armada_drm_plane_calc_addrs() Russell King
2018-07-10 10:41     ` Russell King [this message]
2018-07-10 10:41     ` [PATCH 04/20] drm/armada: push interlace calculation into armada_drm_plane_calc() Russell King
2018-07-10 10:41     ` [PATCH 05/20] drm/armada: move sync signal polarity to mode_set_nofb() method Russell King
2018-07-10 10:41     ` [PATCH 06/20] drm/armada: update debug in armada_drm_crtc_mode_set_nofb() Russell King
2018-07-10 10:41     ` [PATCH 07/20] drm/armada: clean up SPU_ADV_REG Russell King
2018-07-10 10:41     ` [PATCH 08/20] drm/armada: handle atomic modeset crtc events Russell King
2018-07-10 10:41     ` [PATCH 09/20] drm/armada: push responsibility for clock management to backend Russell King
2018-07-10 10:42     ` [PATCH 10/20] drm/armada: unhook dpms state from armada_drm_crtc_update() Russell King
2018-07-10 10:42     ` [PATCH 11/20] drm/armada: implement atomic_enable()/atomic_disable() methods Russell King
2018-07-10 10:42     ` [PATCH 12/20] drm/armada: enable atomic modeset support Russell King
2018-07-10 10:42     ` [PATCH 13/20] drm/armada: switch legacy modeset to atomic modeset Russell King
2018-07-10 10:42     ` [PATCH 14/20] drm/armada: switch primary plane " Russell King
2018-07-10 10:42     ` [PATCH 15/20] drm/armada: switch overlay " Russell King
2018-07-10 10:42     ` [PATCH 16/20] drm/armada: update planes after the dumb frame is complete Russell King
2018-07-10 10:42     ` [PATCH 17/20] drm/armada: update primary framebuffer parameters on mode change Russell King
2018-07-10 10:42     ` [PATCH 18/20] drm/armada: remove unnecessary armada_ovl_plane structure Russell King
2018-07-10 10:42     ` [PATCH 19/20] drm/armada: remove unnecessary armada_plane structure Russell King
2018-07-10 10:42     ` [PATCH 20/20] drm/armada: remove obsolete fb unreferencing kfifo and workqueue Russell King
2018-07-25 20:01     ` [PATCH 00/20] Finish Armada DRM transition to atomic modeset Dave Airlie
2018-12-18 15:21 ` [PATCH 0/3] Finish Armada DRM DT support Lubomir Rintel
2018-12-18 15:21   ` Lubomir Rintel

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=E1fcq5F-0004HD-TE@rmk-PC.armlinux.org.uk \
    --to=rmk+kernel@armlinux.org.uk \
    --cc=airlied@linux.ie \
    --cc=dri-devel@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.