From: Dave Stevenson <dave.stevenson@raspberrypi.com>
To: Maxime Ripard <mripard@kernel.org>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
dri-devel@lists.freedesktop.org
Cc: Maxime Ripard <maxime@cerno.tech>,
Dave Stevenson <dave.stevenson@raspberrypi.com>
Subject: [PATCH 25/31] drm/vc4: hvs: Create cob_init function
Date: Thu, 20 Jun 2024 16:46:26 +0100 [thread overview]
Message-ID: <20240620154632.4125308-26-dave.stevenson@raspberrypi.com> (raw)
In-Reply-To: <20240620154632.4125308-1-dave.stevenson@raspberrypi.com>
From: Maxime Ripard <maxime@cerno.tech>
Just like the HVS itself, the COB parameters will be fairly different in
the BCM2712.
Let's move the COB parameters computation and its initialisation to a
separate function that will be easier to extend in the future.
Signed-off-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/gpu/drm/vc4/vc4_hvs.c | 128 ++++++++++++++++++++--------------
1 file changed, 74 insertions(+), 54 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c
index bab15827fce0..bd9ae25dbdcf 100644
--- a/drivers/gpu/drm/vc4/vc4_hvs.c
+++ b/drivers/gpu/drm/vc4/vc4_hvs.c
@@ -940,6 +940,77 @@ static int vc4_hvs_hw_init(struct vc4_hvs *hvs)
return 0;
}
+static int vc4_hvs_cob_init(struct vc4_hvs *hvs)
+{
+ struct vc4_dev *vc4 = hvs->vc4;
+ u32 reg, top;
+
+ /*
+ * Recompute Composite Output Buffer (COB) allocations for the
+ * displays
+ */
+ switch (vc4->gen) {
+ case VC4_GEN_4:
+ /* The COB is 20736 pixels, or just over 10 lines at 2048 wide.
+ * The bottom 2048 pixels are full 32bpp RGBA (intended for the
+ * TXP composing RGBA to memory), whilst the remainder are only
+ * 24bpp RGB.
+ *
+ * Assign 3 lines to channels 1 & 2, and just over 4 lines to
+ * channel 0.
+ */
+ #define VC4_COB_SIZE 20736
+ #define VC4_COB_LINE_WIDTH 2048
+ #define VC4_COB_NUM_LINES 3
+ reg = 0;
+ top = VC4_COB_LINE_WIDTH * VC4_COB_NUM_LINES;
+ reg |= (top - 1) << 16;
+ HVS_WRITE(SCALER_DISPBASE2, reg);
+ reg = top;
+ top += VC4_COB_LINE_WIDTH * VC4_COB_NUM_LINES;
+ reg |= (top - 1) << 16;
+ HVS_WRITE(SCALER_DISPBASE1, reg);
+ reg = top;
+ top = VC4_COB_SIZE;
+ reg |= (top - 1) << 16;
+ HVS_WRITE(SCALER_DISPBASE0, reg);
+ break;
+
+ case VC4_GEN_5:
+ /* The COB is 44416 pixels, or 10.8 lines at 4096 wide.
+ * The bottom 4096 pixels are full RGBA (intended for the TXP
+ * composing RGBA to memory), whilst the remainder are only
+ * RGB. Addressing is always pixel wide.
+ *
+ * Assign 3 lines of 4096 to channels 1 & 2, and just over 4
+ * lines. to channel 0.
+ */
+ #define VC5_COB_SIZE 44416
+ #define VC5_COB_LINE_WIDTH 4096
+ #define VC5_COB_NUM_LINES 3
+ reg = 0;
+ top = VC5_COB_LINE_WIDTH * VC5_COB_NUM_LINES;
+ reg |= top << 16;
+ HVS_WRITE(SCALER_DISPBASE2, reg);
+ top += 16;
+ reg = top;
+ top += VC5_COB_LINE_WIDTH * VC5_COB_NUM_LINES;
+ reg |= top << 16;
+ HVS_WRITE(SCALER_DISPBASE1, reg);
+ top += 16;
+ reg = top;
+ top = VC5_COB_SIZE;
+ reg |= top << 16;
+ HVS_WRITE(SCALER_DISPBASE0, reg);
+ break;
+
+ default:
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
static int vc4_hvs_bind(struct device *dev, struct device *master, void *data)
{
struct platform_device *pdev = to_platform_device(dev);
@@ -947,7 +1018,6 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data)
struct vc4_dev *vc4 = to_vc4_dev(drm);
struct vc4_hvs *hvs = NULL;
int ret;
- u32 reg, top;
hvs = __vc4_hvs_alloc(vc4, NULL);
if (IS_ERR(hvs))
@@ -1017,59 +1087,9 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data)
if (ret)
return ret;
- /* Recompute Composite Output Buffer (COB) allocations for the displays
- */
- if (vc4->gen == VC4_GEN_4) {
- /* The COB is 20736 pixels, or just over 10 lines at 2048 wide.
- * The bottom 2048 pixels are full 32bpp RGBA (intended for the
- * TXP composing RGBA to memory), whilst the remainder are only
- * 24bpp RGB.
- *
- * Assign 3 lines to channels 1 & 2, and just over 4 lines to
- * channel 0.
- */
- #define VC4_COB_SIZE 20736
- #define VC4_COB_LINE_WIDTH 2048
- #define VC4_COB_NUM_LINES 3
- reg = 0;
- top = VC4_COB_LINE_WIDTH * VC4_COB_NUM_LINES;
- reg |= (top - 1) << 16;
- HVS_WRITE(SCALER_DISPBASE2, reg);
- reg = top;
- top += VC4_COB_LINE_WIDTH * VC4_COB_NUM_LINES;
- reg |= (top - 1) << 16;
- HVS_WRITE(SCALER_DISPBASE1, reg);
- reg = top;
- top = VC4_COB_SIZE;
- reg |= (top - 1) << 16;
- HVS_WRITE(SCALER_DISPBASE0, reg);
- } else {
- /* The COB is 44416 pixels, or 10.8 lines at 4096 wide.
- * The bottom 4096 pixels are full RGBA (intended for the TXP
- * composing RGBA to memory), whilst the remainder are only
- * RGB. Addressing is always pixel wide.
- *
- * Assign 3 lines of 4096 to channels 1 & 2, and just over 4
- * lines. to channel 0.
- */
- #define VC5_COB_SIZE 44416
- #define VC5_COB_LINE_WIDTH 4096
- #define VC5_COB_NUM_LINES 3
- reg = 0;
- top = VC5_COB_LINE_WIDTH * VC5_COB_NUM_LINES;
- reg |= top << 16;
- HVS_WRITE(SCALER_DISPBASE2, reg);
- top += 16;
- reg = top;
- top += VC5_COB_LINE_WIDTH * VC5_COB_NUM_LINES;
- reg |= top << 16;
- HVS_WRITE(SCALER_DISPBASE1, reg);
- top += 16;
- reg = top;
- top = VC5_COB_SIZE;
- reg |= top << 16;
- HVS_WRITE(SCALER_DISPBASE0, reg);
- }
+ ret = vc4_hvs_cob_init(hvs);
+ if (ret)
+ return ret;
ret = devm_request_irq(dev, platform_get_irq(pdev, 0),
vc4_hvs_irq_handler, 0, "vc4 hvs", drm);
--
2.34.1
next prev parent reply other threads:[~2024-06-20 15:47 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-20 15:46 [PATCH 00/31] Preparatory patches for BCM2712 (Pi5) support Dave Stevenson
2024-06-20 15:46 ` [PATCH 01/31] drm/vc4: vc4_plane: Keep fractional source coords inside state Dave Stevenson
2024-06-20 15:46 ` [PATCH 02/31] drm/vc4: Handle fractional coordinates using the phase field Dave Stevenson
2024-06-20 15:46 ` [PATCH 03/31] drm/vc4: Force trigger of dlist update on margins change Dave Stevenson
2024-06-20 15:46 ` [PATCH 04/31] drm/vc4: hdmi: Avoid log spam for audio start failure Dave Stevenson
2024-06-20 15:46 ` [PATCH 05/31] drm/vc4_plane: Add support for YUV444 formats Dave Stevenson
2024-06-21 8:57 ` Maxime Ripard
2024-06-21 9:56 ` Dave Stevenson
2024-06-20 15:46 ` [PATCH 06/31] drm/vc4: Set AXI panic modes for the HVS Dave Stevenson
2024-06-20 15:46 ` [PATCH 07/31] drm/vc4: Limit max_bpc to 8 on Pi0-3 Dave Stevenson
2024-06-20 15:46 ` [PATCH 08/31] drm/vc4: hdmi: Increase audio MAI fifo dreq threshold Dave Stevenson
2024-06-20 15:46 ` [PATCH 09/31] drm/vc4: hdmi: Warn if writing to an unknown HDMI register Dave Stevenson
2024-06-20 15:46 ` [PATCH 10/31] drm/vc4: hvs: More logging for dlist generation Dave Stevenson
2024-06-20 15:46 ` [PATCH 11/31] drm/vc4: hvs: Print error if we fail an allocation Dave Stevenson
2024-06-20 15:46 ` [PATCH 12/31] drm/vc4: plane: Add more debugging for LBM allocation Dave Stevenson
2024-06-20 15:46 ` [PATCH 13/31] drm/vc4: plane: Use return variable in atomic_check Dave Stevenson
2024-06-20 15:46 ` [PATCH 14/31] drm/vc4: crtc: Move assigned_channel to a variable Dave Stevenson
2024-06-20 15:46 ` [PATCH 15/31] drm/vc4: Don't write gamma luts on 2711 Dave Stevenson
2024-06-20 15:46 ` [PATCH 16/31] drm/vc4: UV planes vertical scaling must always be enabled Dave Stevenson
2024-06-20 15:46 ` [PATCH 17/31] drm/vc4: hdmi: Avoid hang with debug registers when suspended Dave Stevenson
2024-06-20 15:46 ` [PATCH 18/31] drm/vc4: Fix dlist debug not resetting the next entry pointer Dave Stevenson
2024-06-20 15:46 ` [PATCH 19/31] drm/vc4: Remove incorrect limit from hvs_dlist debugfs function Dave Stevenson
2024-06-20 15:46 ` [PATCH 20/31] drm/vc4: hvs: Remove ABORT_ON_EMPTY flag Dave Stevenson
2024-06-20 15:46 ` [PATCH 21/31] drm/vc4: Introduce generation number enum Dave Stevenson
2024-06-20 15:46 ` [PATCH 22/31] drm/vc4: Make v3d paths unavailable on any generation newer than vc4 Dave Stevenson
2024-06-20 15:46 ` [PATCH 23/31] drm/vc4: hvs: Use switch statement to simplify vc4_hvs_get_fifo_from_output Dave Stevenson
2024-06-20 15:46 ` [PATCH 24/31] drm/vc4: hvs: Create hw_init function Dave Stevenson
2024-06-20 15:46 ` Dave Stevenson [this message]
2024-06-20 15:46 ` [PATCH 26/31] drm/vc4: hvs: Rename hvs_regs list Dave Stevenson
2024-06-20 15:46 ` [PATCH 27/31] drm/vc4: plane: Change ptr0_offset to an array Dave Stevenson
2024-06-20 15:46 ` [PATCH 28/31] drm/vc4: hvs: Rework LBM alignment Dave Stevenson
2024-06-20 15:46 ` [PATCH 29/31] drm/vc4: hvs: Change prototype of __vc4_hvs_alloc to pass registers Dave Stevenson
2024-06-20 15:46 ` [PATCH 30/31] drm/vc4: Move the buffer offset out of the vc4_plane_state Dave Stevenson
2024-06-20 15:46 ` [PATCH 31/31] drm/vc4: Enable SCALER_CONTROL early in HVS init Dave Stevenson
2024-06-21 8:55 ` [PATCH 00/31] Preparatory patches for BCM2712 (Pi5) support Maxime Ripard
2024-06-21 10:16 ` Dave Stevenson
2024-06-24 14:19 ` Maxime Ripard
2024-06-24 14:45 ` Dave Stevenson
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=20240620154632.4125308-26-dave.stevenson@raspberrypi.com \
--to=dave.stevenson@raspberrypi.com \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=maxime@cerno.tech \
--cc=mripard@kernel.org \
--cc=tzimmermann@suse.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox