From nobody Wed Dec 17 18:02:40 2025 Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.3]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8FAAD22A1CD; Mon, 9 Dec 2024 12:34:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.31.3 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733747662; cv=none; b=GGc3HGbjT72fbuZmCenkKYNyv/KWYGfst1jweNya9y4O/+ZIKxXSUV+v58rrN4gibgTEBVh+LxNmZUOMTi0imRs98qAi7kZcufvY8N8LG1Hm2jdYZVe9RW9BVIJ90KuOwo4MvyS6hFPaPWPtZ53pUmvdVLvmQpL1eaQaTZhtRmM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733747662; c=relaxed/simple; bh=bHC7JFW+26YL7vaB9QB7VlOaIE+jDN4bLNb8CYSqdDA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hAmd9R8pUBcB0ReWsIjoRf7rgcDA8a2b5oVPT+HEwYXGc18OQeAGNqrShlZIHmAbmUPS1eEPInatLd3coVGBIgw0EpwaKVyzq9J43RSQbYx0AOCyjqTHitMLfbj5k5l3yVS6EYgpzZUFCgtnDPa2Wtn+DBftbXbMe1cewDrGT2Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=TbkCWvX3; arc=none smtp.client-ip=220.197.31.3 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="TbkCWvX3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version; bh=IHtTj cTu+DnSKNy89SRVAsYS7sLOgsyFok9gfYGh2z0=; b=TbkCWvX36jK9cllVCvgEz gKkVfJbX8sMVb6z6Dvvqd9FiBJzQLoSPBaK3RzkadCXOXw9JQ0imfEjc0z0E5Cx/ qdtK1AO7SwF8/3eERCmn9Z0MNAzY3yBR+2ln3gX6RtsT/N1+ArDrAeugPujhY/HX kD2fl+iq+ENWiXl1Ct/qSY= Received: from ProDesk.. (unknown [58.22.7.114]) by gzga-smtp-mtada-g1-3 (Coremail) with SMTP id _____wDnT3ey41ZnAKtbDA--.2178S2; Mon, 09 Dec 2024 20:33:57 +0800 (CST) From: Andy Yan To: heiko@sntech.de Cc: hjc@rock-chips.com, krzk+dt@kernel.org, s.hauer@pengutronix.de, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, derek.foreman@collabora.com, detlev.casanova@collabora.com, Andy Yan , Michael Riesch Subject: [PATCH v5 15/18] drm/rockchip: vop2: Set plane possible crtcs by possible vp mask Date: Mon, 9 Dec 2024 20:33:52 +0800 Message-ID: <20241209123353.2782091-1-andyshrk@163.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241209122943.2781431-1-andyshrk@163.com> References: <20241209122943.2781431-1-andyshrk@163.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: _____wDnT3ey41ZnAKtbDA--.2178S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxtrW8JFWkXF43Zr17tw45GFg_yoWxKrWUpa yxZFy3WF4fCr4agry7Ja98ZFyak39xAw4a93ZrKFsxKr15Kry7Wr1UK3Z8Cr1DuFyxZr1j vw4aqrWDur17tFJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07j2E_NUUUUU= X-CM-SenderInfo: 5dqg52xkunqiywtou0bp/xtbB0hWwXmdW4xobqwAAsR Content-Type: text/plain; charset="utf-8" From: Andy Yan In the upcoming VOP of rk3576, a window cannot attach to all Video Ports, we introduce a possible_vp_mask for every window to indicate which Video Ports this window can attach to. Signed-off-by: Andy Yan Tested-by: Michael Riesch # on RK3568 Tested-by: Detlev Casanova --- (no changes since v1) drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 18 +++++++++++++++++- drivers/gpu/drm/rockchip/rockchip_drm_vop2.h | 1 + drivers/gpu/drm/rockchip/rockchip_vop2_reg.c | 14 ++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm= /rockchip/rockchip_drm_vop2.c index 29f7c105b89b..81ba2e29a09d 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c @@ -2312,6 +2312,10 @@ static int vop2_create_crtcs(struct vop2 *vop2) if (win->base.type =3D=3D DRM_PLANE_TYPE_PRIMARY) continue; =20 + /* If this win can not attached to this VP */ + if (!(win->data->possible_vp_mask & BIT(vp->id))) + continue; + if (vop2_is_mirror_win(win)) continue; =20 @@ -2343,7 +2347,19 @@ static int vop2_create_crtcs(struct vop2 *vop2) =20 win->type =3D DRM_PLANE_TYPE_OVERLAY; =20 - possible_crtcs =3D (1 << nvps) - 1; + possible_crtcs =3D 0; + nvp =3D 0; + for (j =3D 0; j < vop2_data->nr_vps; j++) { + vp =3D &vop2->vps[j]; + + if (!vp->crtc.port) + continue; + + if (win->data->possible_vp_mask & BIT(vp->id)) + possible_crtcs |=3D BIT(nvp); + nvp++; + } + ret =3D vop2_plane_init(vop2, win, possible_crtcs); if (ret) { drm_err(vop2->drm, "failed to init overlay plane %s: %d\n", diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h b/drivers/gpu/drm= /rockchip/rockchip_drm_vop2.h index 5514ece7df4d..adb23438e4cd 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h @@ -167,6 +167,7 @@ struct vop2_win_data { unsigned int phys_id; =20 u32 base; + u32 possible_vp_mask; enum drm_plane_type type; =20 u32 nformats; diff --git a/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c b/drivers/gpu/drm= /rockchip/rockchip_vop2_reg.c index baf81e97062c..62f8b4113f5f 100644 --- a/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c +++ b/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c @@ -347,6 +347,7 @@ static const struct vop2_win_data rk3568_vop_win_data[]= =3D { .name =3D "Smart0-win0", .phys_id =3D ROCKCHIP_VOP2_SMART0, .base =3D 0x1c00, + .possible_vp_mask =3D BIT(0) | BIT(1) | BIT(2), .formats =3D formats_smart, .nformats =3D ARRAY_SIZE(formats_smart), .format_modifiers =3D format_modifiers, @@ -360,6 +361,7 @@ static const struct vop2_win_data rk3568_vop_win_data[]= =3D { }, { .name =3D "Smart1-win0", .phys_id =3D ROCKCHIP_VOP2_SMART1, + .possible_vp_mask =3D BIT(0) | BIT(1) | BIT(2), .formats =3D formats_smart, .nformats =3D ARRAY_SIZE(formats_smart), .format_modifiers =3D format_modifiers, @@ -373,6 +375,7 @@ static const struct vop2_win_data rk3568_vop_win_data[]= =3D { }, { .name =3D "Esmart1-win0", .phys_id =3D ROCKCHIP_VOP2_ESMART1, + .possible_vp_mask =3D BIT(0) | BIT(1) | BIT(2), .formats =3D formats_rk356x_esmart, .nformats =3D ARRAY_SIZE(formats_rk356x_esmart), .format_modifiers =3D format_modifiers, @@ -386,6 +389,7 @@ static const struct vop2_win_data rk3568_vop_win_data[]= =3D { }, { .name =3D "Esmart0-win0", .phys_id =3D ROCKCHIP_VOP2_ESMART0, + .possible_vp_mask =3D BIT(0) | BIT(1) | BIT(2), .formats =3D formats_rk356x_esmart, .nformats =3D ARRAY_SIZE(formats_rk356x_esmart), .format_modifiers =3D format_modifiers, @@ -400,6 +404,7 @@ static const struct vop2_win_data rk3568_vop_win_data[]= =3D { .name =3D "Cluster0-win0", .phys_id =3D ROCKCHIP_VOP2_CLUSTER0, .base =3D 0x1000, + .possible_vp_mask =3D BIT(0) | BIT(1) | BIT(2), .formats =3D formats_cluster, .nformats =3D ARRAY_SIZE(formats_cluster), .format_modifiers =3D format_modifiers_afbc, @@ -415,6 +420,7 @@ static const struct vop2_win_data rk3568_vop_win_data[]= =3D { .name =3D "Cluster1-win0", .phys_id =3D ROCKCHIP_VOP2_CLUSTER1, .base =3D 0x1200, + .possible_vp_mask =3D BIT(0) | BIT(1) | BIT(2), .formats =3D formats_cluster, .nformats =3D ARRAY_SIZE(formats_cluster), .format_modifiers =3D format_modifiers_afbc, @@ -580,6 +586,7 @@ static const struct vop2_win_data rk3588_vop_win_data[]= =3D { .name =3D "Cluster0-win0", .phys_id =3D ROCKCHIP_VOP2_CLUSTER0, .base =3D 0x1000, + .possible_vp_mask =3D BIT(0) | BIT(1) | BIT(2) | BIT(3), .formats =3D formats_cluster, .nformats =3D ARRAY_SIZE(formats_cluster), .format_modifiers =3D format_modifiers_afbc, @@ -598,6 +605,7 @@ static const struct vop2_win_data rk3588_vop_win_data[]= =3D { .name =3D "Cluster1-win0", .phys_id =3D ROCKCHIP_VOP2_CLUSTER1, .base =3D 0x1200, + .possible_vp_mask =3D BIT(0) | BIT(1) | BIT(2) | BIT(3), .formats =3D formats_cluster, .nformats =3D ARRAY_SIZE(formats_cluster), .format_modifiers =3D format_modifiers_afbc, @@ -616,6 +624,7 @@ static const struct vop2_win_data rk3588_vop_win_data[]= =3D { .name =3D "Cluster2-win0", .phys_id =3D ROCKCHIP_VOP2_CLUSTER2, .base =3D 0x1400, + .possible_vp_mask =3D BIT(0) | BIT(1) | BIT(2) | BIT(3), .formats =3D formats_cluster, .nformats =3D ARRAY_SIZE(formats_cluster), .format_modifiers =3D format_modifiers_afbc, @@ -634,6 +643,7 @@ static const struct vop2_win_data rk3588_vop_win_data[]= =3D { .name =3D "Cluster3-win0", .phys_id =3D ROCKCHIP_VOP2_CLUSTER3, .base =3D 0x1600, + .possible_vp_mask =3D BIT(0) | BIT(1) | BIT(2) | BIT(3), .formats =3D formats_cluster, .nformats =3D ARRAY_SIZE(formats_cluster), .format_modifiers =3D format_modifiers_afbc, @@ -651,6 +661,7 @@ static const struct vop2_win_data rk3588_vop_win_data[]= =3D { }, { .name =3D "Esmart0-win0", .phys_id =3D ROCKCHIP_VOP2_ESMART0, + .possible_vp_mask =3D BIT(0) | BIT(1) | BIT(2) | BIT(3), .formats =3D formats_esmart, .nformats =3D ARRAY_SIZE(formats_esmart), .format_modifiers =3D format_modifiers, @@ -667,6 +678,7 @@ static const struct vop2_win_data rk3588_vop_win_data[]= =3D { }, { .name =3D "Esmart1-win0", .phys_id =3D ROCKCHIP_VOP2_ESMART1, + .possible_vp_mask =3D BIT(0) | BIT(1) | BIT(2) | BIT(3), .formats =3D formats_esmart, .nformats =3D ARRAY_SIZE(formats_esmart), .format_modifiers =3D format_modifiers, @@ -684,6 +696,7 @@ static const struct vop2_win_data rk3588_vop_win_data[]= =3D { .name =3D "Esmart2-win0", .phys_id =3D ROCKCHIP_VOP2_ESMART2, .base =3D 0x1c00, + .possible_vp_mask =3D BIT(0) | BIT(1) | BIT(2) | BIT(3), .formats =3D formats_esmart, .nformats =3D ARRAY_SIZE(formats_esmart), .format_modifiers =3D format_modifiers, @@ -699,6 +712,7 @@ static const struct vop2_win_data rk3588_vop_win_data[]= =3D { }, { .name =3D "Esmart3-win0", .phys_id =3D ROCKCHIP_VOP2_ESMART3, + .possible_vp_mask =3D BIT(0) | BIT(1) | BIT(2) | BIT(3), .formats =3D formats_esmart, .nformats =3D ARRAY_SIZE(formats_esmart), .format_modifiers =3D format_modifiers, --=20 2.34.1