mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arun Iyengar via B4 Relay <devnull+aiyengar1990.gmail.com@kernel.org>
To: "Sandy Huang" <hjc@rock-chips.com>,
	"Heiko Stübner" <heiko@sntech.de>, "Andy Yan" <andyshrk@163.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Sascha Hauer" <s.hauer@pengutronix.de>,
	"Rob Herring" <robh@kernel.org>
Cc: dri-devel@lists.freedesktop.org,
	linux-rockchip@lists.infradead.org,
	 linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	 Chaoyi Chen <chaoyi.chen@rock-chips.com>,
	 Damon Ding <damon.ding@rock-chips.com>,
	 Cristian Ciocaltea <cristian.ciocaltea@collabora.com>,
	 Arun Iyengar <aiyengar1990@gmail.com>
Subject: [PATCH v2 2/2] drm/rockchip: vop2: Give each RK3588 video port its own cluster
Date: Tue, 01 Dec 2026 10:28:06 +0000	[thread overview]
Message-ID: <20261201-vop2-axi-primary-v2-2-e111a8c05883@gmail.com> (raw)
In-Reply-To: <20261201-vop2-axi-primary-v2-0-e111a8c05883@gmail.com>

From: Arun Iyengar <aiyengar1990@gmail.com>

Damon Ding asked for POST_BUF_EMPTY to be fixed in the layer setup. On
RK3588 Cluster0/1 fetch through AXI0 and Cluster2/3 through AXI1. Each
video port takes the first free primary window, so VP0 and VP2 get
Cluster0 and Cluster1, both on AXI0. A 4K120 and a 4K60 XR24 primary
need about 6 GB/s there, one port delivers about 4.5 GB/s, and VP0
underflows in every frame. aclk_vop at 750 or 850 MHz is the same.

On RK3588 give VP N Cluster N as primary plane. Boards that skip a lower
video port get a different primary: without VP1, VP2 gets Cluster2
instead of Cluster1. VP0 and VP1 still share AXI0, and overlay planes
can still go on any video port. RK3568 and RK3576 are unchanged.

A skipped cluster would default below VP2's primary, so give primary
planes the lowest default zpos.

Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
index bbe86aecf9039..4d054c41baca1 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
@@ -2526,7 +2526,7 @@ static irqreturn_t vop2_isr(int irq, void *data)
 }
 
 static int vop2_plane_init(struct vop2 *vop2, struct vop2_win *win,
-			   unsigned long possible_crtcs)
+			   unsigned long possible_crtcs, unsigned int zpos)
 {
 	const struct vop2_win_data *win_data = win->data;
 	unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) |
@@ -2552,7 +2552,7 @@ static int vop2_plane_init(struct vop2 *vop2, struct vop2_win *win,
 						   win->data->supported_rotations);
 	drm_plane_create_alpha_property(&win->base);
 	drm_plane_create_blend_mode_property(&win->base, blend_caps);
-	drm_plane_create_zpos_property(&win->base, win->win_id, 0,
+	drm_plane_create_zpos_property(&win->base, zpos, 0,
 				       vop2->registered_num_wins - 1);
 
 	return 0;
@@ -2583,6 +2583,11 @@ static bool vop2_is_mirror_win(struct vop2_win *win)
 	}
 }
 
+static const u8 rk3588_vp_primary[] = {
+	ROCKCHIP_VOP2_CLUSTER0, ROCKCHIP_VOP2_CLUSTER1,
+	ROCKCHIP_VOP2_CLUSTER2, ROCKCHIP_VOP2_CLUSTER3,
+};
+
 static int vop2_create_crtcs(struct vop2 *vop2)
 {
 	const struct vop2_data *vop2_data = vop2->data;
@@ -2594,6 +2599,7 @@ static int vop2_create_crtcs(struct vop2 *vop2)
 	struct vop2_win *win;
 	u32 possible_crtcs;
 	int i, j, nvp, nvps = 0;
+	unsigned int zpos;
 	int ret;
 
 	for (i = 0; i < vop2_data->nr_vps; i++) {
@@ -2655,13 +2661,17 @@ static int vop2_create_crtcs(struct vop2 *vop2)
 			if (!(win->data->possible_vp_mask & BIT(vp->id)))
 				continue;
 
+			if (vop2->version == VOP_VERSION_RK3588 &&
+			    win->data->phys_id != rk3588_vp_primary[vp->id])
+				continue;
+
 			if (vop2_is_mirror_win(win))
 				continue;
 
 			if (win->type == DRM_PLANE_TYPE_PRIMARY) {
 				possible_crtcs = BIT(nvp);
 				vp->primary_plane = win;
-				ret = vop2_plane_init(vop2, win, possible_crtcs);
+				ret = vop2_plane_init(vop2, win, possible_crtcs, nvp);
 				if (ret)
 					return dev_err_probe(drm->dev, ret,
 							     "failed to init primary plane %s\n",
@@ -2677,6 +2687,7 @@ static int vop2_create_crtcs(struct vop2 *vop2)
 	}
 
 	/* Register all unused window as overlay plane */
+	zpos = nvp;
 	for (i = 0; i < vop2->registered_num_wins; i++) {
 		win = &vop2->win[i];
 
@@ -2702,7 +2713,7 @@ static int vop2_create_crtcs(struct vop2 *vop2)
 			nvp++;
 		}
 
-		ret = vop2_plane_init(vop2, win, possible_crtcs);
+		ret = vop2_plane_init(vop2, win, possible_crtcs, zpos++);
 		if (ret)
 			return dev_err_probe(drm->dev, ret, "failed to init overlay plane %s\n",
 					     win->data->name);

-- 
2.55.0



      parent reply	other threads:[~2026-12-01 10:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 10:28 [PATCH v2 0/2] " Arun Iyengar via B4 Relay
2026-12-01 10:28 ` [PATCH v2 1/2] drm/rockchip: vop2: Clean up after a failed vop2_create_crtcs() Arun Iyengar via B4 Relay
2026-12-01 10:28 ` Arun Iyengar via B4 Relay [this message]

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=20261201-vop2-axi-primary-v2-2-e111a8c05883@gmail.com \
    --to=devnull+aiyengar1990.gmail.com@kernel.org \
    --cc=airlied@gmail.com \
    --cc=aiyengar1990@gmail.com \
    --cc=andyshrk@163.com \
    --cc=chaoyi.chen@rock-chips.com \
    --cc=cristian.ciocaltea@collabora.com \
    --cc=damon.ding@rock-chips.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko@sntech.de \
    --cc=hjc@rock-chips.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=simona@ffwll.ch \
    --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

all inboxes | Powered by JetHome®