All of lore.kernel.org
 help / color / mirror / Atom feed
From: fabrizio.castro@bp.renesas.com (Fabrizio Castro)
To: cip-dev@lists.cip-project.org
Subject: [cip-dev] [PATCH 4.19.y-cip v2 21/32] drm: rcar-du: Update framebuffer pitch and alignment limits for Gen3
Date: Tue, 17 Sep 2019 14:07:49 +0100	[thread overview]
Message-ID: <1568725680-32730-22-git-send-email-fabrizio.castro@bp.renesas.com> (raw)
In-Reply-To: <1568725680-32730-1-git-send-email-fabrizio.castro@bp.renesas.com>

From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

commit f09e5b5d776debc2761e8d9330d60b8dcd8cb9dd upstream.

The framebuffer pitch and alignment constraints reflect the limitations
of the Gen2 DU hardware. On Gen3, the DU has no memory interface and
thus doesn't impose any constraint. The limitations come instead from
the VSP that has a limit of 65535 bytes for the pitch and no alignment
constraint. Update the checks accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
---
 drivers/gpu/drm/rcar-du/rcar_du_kms.c | 35 +++++++++++++++++++++++------------
 1 file changed, 23 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
index d2094ae..27783f6 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
@@ -233,7 +233,6 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv,
 	const struct rcar_du_format_info *format;
 	unsigned int max_pitch;
 	unsigned int align;
-	unsigned int bpp;
 	unsigned int i;
 
 	format = rcar_du_format_info(mode_cmd->pixel_format);
@@ -243,20 +242,32 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv,
 		return ERR_PTR(-EINVAL);
 	}
 
-	/*
-	 * The pitch and alignment constraints are expressed in pixels on the
-	 * hardware side and in bytes in the DRM API.
-	 */
-	bpp = format->planes == 1 ? format->bpp / 8 : 1;
-	max_pitch =  4096 * bpp;
+	if (rcdu->info->gen < 3) {
+		/*
+		 * On Gen2 the DU limits the pitch to 4095 pixels and requires
+		 * buffers to be aligned to a 16 pixels boundary (or 128 bytes
+		 * on some platforms).
+		 */
+		unsigned int bpp = format->planes == 1 ? format->bpp / 8 : 1;
 
-	if (rcar_du_needs(rcdu, RCAR_DU_QUIRK_ALIGN_128B))
-		align = 128;
-	else
-		align = 16 * bpp;
+		max_pitch = 4095 * bpp;
+
+		if (rcar_du_needs(rcdu, RCAR_DU_QUIRK_ALIGN_128B))
+			align = 128;
+		else
+			align = 16 * bpp;
+	} else {
+		/*
+		 * On Gen3 the memory interface is handled by the VSP that
+		 * limits the pitch to 65535 bytes and has no alignment
+		 * constraint.
+		 */
+		max_pitch = 65535;
+		align = 1;
+	}
 
 	if (mode_cmd->pitches[0] & (align - 1) ||
-	    mode_cmd->pitches[0] >= max_pitch) {
+	    mode_cmd->pitches[0] > max_pitch) {
 		dev_dbg(dev->dev, "invalid pitch value %u\n",
 			mode_cmd->pitches[0]);
 		return ERR_PTR(-EINVAL);
-- 
2.7.4

  parent reply	other threads:[~2019-09-17 13:07 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-17 13:07 [cip-dev] [PATCH 4.19.y-cip v2 00/32] Add PCIe and HDMI support to HiHope RZ/G2M Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 01/32] dt-bindings: PCI: rcar: Add device tree support for r8a774a1 Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 02/32] dt-bindings: display: renesas: du: Document the r8a774a1 bindings Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 03/32] dt-bindings: display: renesas: lvds: Document " Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 04/32] dt-bindings: display: renesas: Add r8a774a1 support Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 05/32] PCI: rcar: Replace unsigned long with u32/unsigned int in register accessors Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 06/32] PCI: rcar: Replace various variable types with unsigned ones for register values Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 07/32] PCI: rcar: Clean up debug messages Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 08/32] PCI: rcar: Do not shadow the 'irq' variable Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 09/32] drm: rcar-du: Add R8A774A1 support Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 10/32] drm: rcar-du: lvds: Add r8a774a1 support Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 11/32] drm: rcar-du: dw-hdmi: Reject modes with a too high clock frequency Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 12/32] drm: rcar-du: Refactor Feature and Quirk definitions Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 13/32] drm: rcar-du: Add interlaced feature flag Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 14/32] drm: rcar-du: Cache DSYSR value to ensure known initial value Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 15/32] drm: rcar-du: Don't use TV sync mode when not supported by the hardware Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 16/32] drm: rcar-du: Support interlaced video output through vsp1 Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 17/32] drm: rcar-du: Rework clock configuration based on hardware limits Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 18/32] drm: rcar-du: Rename and document dpll_ch field Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 19/32] drm: rcar-du: Add support for missing pixel formats Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 20/32] drm: rcar-du: Store V4L2 fourcc in rcar_du_format_info structure Fabrizio Castro
2019-09-17 13:07 ` Fabrizio Castro [this message]
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 22/32] arm64: dts: renesas: r8a774a1: Add PCIe device nodes Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 23/32] arm64: dts: renesas: hihope-common: Declare pcie bus clock Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 24/32] arm64: dts: renesas: hihope-rzg2-ex: Enable PCIe support Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 25/32] arm64: dts: renesas: r8a774a1: Add VSP instances Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 26/32] arm64: dts: renesas: r8a774a1: Add DU device to DT Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 27/32] arm64: dts: renesas: r8a774a1: Add FDP1 instance Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 28/32] arm64: dts: renesas: r8a774a1: Tie SYS-DMAC to IPMMU-DS0/1 Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 29/32] arm64: dts: renesas: r8a774a1: Tie Audio-DMAC to IPMMU-MP Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 30/32] arm64: dts: renesas: r8a774a1: Connect Ethernet-AVB to IPMMU-DS0 Fabrizio Castro
2019-09-17 13:07 ` [cip-dev] [PATCH 4.19.y-cip v2 31/32] arm64: dts: renesas: r8a774a1: Add HDMI encoder instance Fabrizio Castro
2019-09-17 13:08 ` [cip-dev] [PATCH 4.19.y-cip v2 32/32] arm64: dts: renesas: hihope-common: Add HDMI support Fabrizio Castro
2019-09-17 13:57 ` [cip-dev] [PATCH 4.19.y-cip v2 00/32] Add PCIe and HDMI support to HiHope RZ/G2M nobuhiro1.iwamatsu at toshiba.co.jp

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=1568725680-32730-22-git-send-email-fabrizio.castro@bp.renesas.com \
    --to=fabrizio.castro@bp.renesas.com \
    --cc=cip-dev@lists.cip-project.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.