From patchwork Wed Oct 18 09:42:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Yan X-Patchwork-Id: 13426765 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C1A29CDB47E for ; Wed, 18 Oct 2023 09:42:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kECGeZ4aP7daLjlSXoFd3YBRs1Arpzfl6guNrZvfvPA=; b=on2V/c3VGszDpI wvhbM3KwbieDlVXUhtTYBqixumGpYThKrb6nouYpqNPjrZ0y8aC5P3HCxtpKVGXYSTGMegpXqd95f pup45RJeH/y+8X0qlHQwcPWHe2hLAcsriI/AsQ4+ChTCvExrj6lSrW+RdrWzFCVxM6nU98YGcO7je Dw/LsswPPxezNH3qUV/47b0KPyl2YXz+mjO/s3WwAlEtFdD2arYqZqllKZkF0Sc6pKdeSrzqH2a7z RHDyoakeSZ/VE7MSOSfl15JnsiJ/UPM0hSJMIf77s85i2egi31QUyybHSjQSrZl9NYCvlm2+VHRA1 RQ6y5GT5js7IwXkSVrQQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qt34d-00EIcZ-1z; Wed, 18 Oct 2023 09:42:43 +0000 Received: from m15.mail.163.com ([45.254.50.219]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qt34a-00EIbC-2a for linux-rockchip@lists.infradead.org; Wed, 18 Oct 2023 09:42:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=D8orW aZoftxAaMcKBCJtMoDO5cmw6kme9A0KiSp4QR8=; b=Pw7npVl3Cx/3BmSj4FnHH yFO5ZUEcDQwzS3Upd3LpKCVEXKxtR1PpwWvWTlFuatK+fOMlnkyGSmT+Fm7QGhke sU1cytA3jMulrAfPXY8WX4jC90usXZLtjqutMWToFWZmCGqRJWPIAxKirSiAtUDF 3OqrB8FWx6NK1Z/jf4JKfw= Received: from ProDesk.. (unknown [58.22.7.114]) by zwqz-smtp-mta-g0-1 (Coremail) with SMTP id _____wD3fzp3qC9lkJuJAw--.52842S2; Wed, 18 Oct 2023 17:42:19 +0800 (CST) From: Andy Yan To: linux-rockchip@lists.infradead.org, dri-devel@lists.freedesktop.org, heiko@sntech.de, jonas@kwiboo.se Cc: s.hauer@pengutronix.de, hjc@rock-chips.com, sebastian.reichel@collabora.com, sjoerd.simons@collabora.com, Andy Yan Subject: [PATCH v3 1/4] drm/rockchip: fix vop format bpp calculation Date: Wed, 18 Oct 2023 17:42:10 +0800 Message-Id: <20231018094210.2475771-1-andyshrk@163.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231018094122.2475668-1-andyshrk@163.com> References: <20231018094122.2475668-1-andyshrk@163.com> MIME-Version: 1.0 X-CM-TRANSID: _____wD3fzp3qC9lkJuJAw--.52842S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7urW3tF13uFW7AF1DZFyrJFb_yoW8Zry7pF WUAr90gr45KFWjgFn7JaykZFWakwnxCay2grW7G3s8KF13KFyDAw1akrWUAr98GFyxur1a yFsxKrWUCa12k3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jSWlkUUUUU= X-Originating-IP: [58.22.7.114] X-CM-SenderInfo: 5dqg52xkunqiywtou0bp/1tbiEB8NXl8YL0Q5UgAAsb X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231018_024241_254362_A443BF46 X-CRM114-Status: UNSURE ( 9.21 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org From: Andy Yan We can't rely on cpp for bpp calculation as the cpp of some formats(DRM_FORMAT_YUV420_8BIT/10BIT, etc) is zero. Signed-off-by: Andy Yan --- (no changes since v1) drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c index 57c05c6b246c..93b27b03d479 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c @@ -282,6 +282,20 @@ static void vop2_win_disable(struct vop2_win *win) vop2_win_write(win, VOP2_WIN_CLUSTER_ENABLE, 0); } +static u32 vop2_get_bpp(const struct drm_format_info *format) +{ + switch (format->format) { + case DRM_FORMAT_YUV420_8BIT: + return 12; + case DRM_FORMAT_YUV420_10BIT: + return 15; + case DRM_FORMAT_VUY101010: + return 30; + default: + return drm_format_info_bpp(format, 0); + } +} + static enum vop2_data_format vop2_convert_format(u32 format) { switch (format) { @@ -482,7 +496,7 @@ static u32 vop2_afbc_transform_offset(struct drm_plane_state *pstate, { struct drm_rect *src = &pstate->src; struct drm_framebuffer *fb = pstate->fb; - u32 bpp = fb->format->cpp[0] * 8; + u32 bpp = vop2_get_bpp(fb->format); u32 vir_width = (fb->pitches[0] << 3) / bpp; u32 width = drm_rect_width(src) >> 16; u32 height = drm_rect_height(src) >> 16; @@ -1080,7 +1094,7 @@ static void vop2_plane_atomic_update(struct drm_plane *plane, struct drm_display_mode *adjusted_mode = &crtc->state->adjusted_mode; struct vop2 *vop2 = win->vop2; struct drm_framebuffer *fb = pstate->fb; - u32 bpp = fb->format->cpp[0] * 8; + u32 bpp = vop2_get_bpp(fb->format); u32 actual_w, actual_h, dsp_w, dsp_h; u32 act_info, dsp_info; u32 format; From patchwork Wed Oct 18 09:42:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Yan X-Patchwork-Id: 13426766 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8B295CDB47E for ; Wed, 18 Oct 2023 09:43:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RjxIhpTY/9LRRnTuo28Rg7uKtj1PAIX20fce1UGZFqo=; b=fN7gvvCQfY9Gm2 eKUXTMoSrU6oSAq8/3dgiTzdeAZpFs/eBF33FT6UvRFdh3bbLkHk5KdSISrRdt0CgbT+fjpdffzuu +cGcLxmz7M24pG8f5rsoNHfnoQXDakQWXunzbAeYBdGQ5W49ORIunvXd40KHIUzD//LWPiWKTHbha VX3kreDmJvNiMYRicNM8QH7QEdqvOO+6LTxHLav7JEwBPK2fOZxrklFovnsa5GeqpuwVPZ7UMGaUu tNwaj4SBzjvBBMjRnS0yBZzL3yQOiV+GdVgTZXQU2LgIyGHguRdVfZHrzJwVThcAYNcuaCj51EkHc 3et7Muo9M6DjjdM7OdbQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qt34v-00EIgP-1X; Wed, 18 Oct 2023 09:43:01 +0000 Received: from m15.mail.163.com ([45.254.50.220]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qt34r-00EIfG-2t for linux-rockchip@lists.infradead.org; Wed, 18 Oct 2023 09:42:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=gWcp7 Ck1o8pAhe9Dgb62+cMiM53lM5GE6Vwy41G9ck0=; b=lkWgbNwNkcRyvMsLABzPu vFMO5SSBjgtH/f6mh/9tgO3mfQhP49dYM60y3GyE/BddEhiBGM9AOIv703I5M67a s3zmBCIcSpgWpJ0YGFaqzSJxMQ/z9XNQPZDCq6kZ9IKcldq+2QHeoKmYnqULoLp+ SJk4xOvR1wVUMMXln1xmKQ= Received: from ProDesk.. (unknown [58.22.7.114]) by zwqz-smtp-mta-g2-3 (Coremail) with SMTP id _____wAHbw+QqC9lM2uTAw--.3018S2; Wed, 18 Oct 2023 17:42:43 +0800 (CST) From: Andy Yan To: linux-rockchip@lists.infradead.org, dri-devel@lists.freedesktop.org, heiko@sntech.de, jonas@kwiboo.se Cc: s.hauer@pengutronix.de, hjc@rock-chips.com, sebastian.reichel@collabora.com, sjoerd.simons@collabora.com, Andy Yan Subject: [PATCH v3 2/4] drm/rockchip: remove the unsupported format of vop2 cluster window Date: Wed, 18 Oct 2023 17:42:39 +0800 Message-Id: <20231018094239.2475851-1-andyshrk@163.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231018094122.2475668-1-andyshrk@163.com> References: <20231018094122.2475668-1-andyshrk@163.com> MIME-Version: 1.0 X-CM-TRANSID: _____wAHbw+QqC9lM2uTAw--.3018S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxCFy3XFy7KF1fXrWxuFyDWrg_yoW5Cr4xpr W3ZrZrZrW0kF10qFWDJryFyF4fC3ZFkayIvwsakwn7uFyjkFyDW3ZFkFy8Ar93KryxCrWI yF43JrW5Zr48trJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jS-e5UUUUU= X-Originating-IP: [58.22.7.114] X-CM-SenderInfo: 5dqg52xkunqiywtou0bp/1tbiOxUNXmC5n72JFwAAsY X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231018_024258_315950_BB9C8577 X-CRM114-Status: UNSURE ( 9.64 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org From: Andy Yan The cluster windows on vop2 doesn't support linear yuv format(NV12/16/24), it only support afbc based yuv format(DRM_FORMAT_YUV420_8BIT/10BIT), which will be added in next patch. Fixes: 604be85547ce ("drm/rockchip: Add VOP2 driver") Signed-off-by: Andy Yan --- Changes in v3: - make it a split patch drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 24 +------------------- drivers/gpu/drm/rockchip/rockchip_vop2_reg.c | 3 --- 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c index 93b27b03d479..8289ddc95bee 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c @@ -342,10 +342,6 @@ static enum vop2_afbc_format vop2_convert_afbc_format(u32 format) case DRM_FORMAT_RGB565: case DRM_FORMAT_BGR565: return VOP2_AFBC_FMT_RGB565; - case DRM_FORMAT_NV12: - return VOP2_AFBC_FMT_YUV420; - case DRM_FORMAT_NV16: - return VOP2_AFBC_FMT_YUV422; default: return VOP2_AFBC_FMT_INVALID; } @@ -366,25 +362,9 @@ static bool vop2_win_rb_swap(u32 format) } } -static bool vop2_afbc_rb_swap(u32 format) -{ - switch (format) { - case DRM_FORMAT_NV24: - return true; - default: - return false; - } -} - static bool vop2_afbc_uv_swap(u32 format) { - switch (format) { - case DRM_FORMAT_NV12: - case DRM_FORMAT_NV16: - return true; - default: - return false; - } + return false; } static bool vop2_win_uv_swap(u32 format) @@ -1232,7 +1212,6 @@ static void vop2_plane_atomic_update(struct drm_plane *plane, drm_err(vop2->drm, "vp%d %s stride[%d] not 64 pixel aligned\n", vp->id, win->data->name, stride); - rb_swap = vop2_afbc_rb_swap(fb->format->format); uv_swap = vop2_afbc_uv_swap(fb->format->format); /* * This is a workaround for crazy IC design, Cluster @@ -1249,7 +1228,6 @@ static void vop2_plane_atomic_update(struct drm_plane *plane, if (vop2_cluster_window(win)) vop2_win_write(win, VOP2_WIN_AFBC_ENABLE, 1); vop2_win_write(win, VOP2_WIN_AFBC_FORMAT, afbc_format); - vop2_win_write(win, VOP2_WIN_AFBC_RB_SWAP, rb_swap); vop2_win_write(win, VOP2_WIN_AFBC_UV_SWAP, uv_swap); vop2_win_write(win, VOP2_WIN_AFBC_AUTO_GATING_EN, 0); vop2_win_write(win, VOP2_WIN_AFBC_BLOCK_SPLIT_EN, 0); diff --git a/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c index 62b573f282a7..b5e59dd34325 100644 --- a/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c +++ b/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c @@ -24,9 +24,6 @@ static const uint32_t formats_win_full_10bit[] = { DRM_FORMAT_BGR888, DRM_FORMAT_RGB565, DRM_FORMAT_BGR565, - DRM_FORMAT_NV12, - DRM_FORMAT_NV16, - DRM_FORMAT_NV24, }; static const uint32_t formats_win_full_10bit_yuyv[] = { From patchwork Wed Oct 18 09:43:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Yan X-Patchwork-Id: 13426767 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B3319CDB47E for ; Wed, 18 Oct 2023 09:43:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qHiQUWnPmM31S3fJOZu7w8FH5ZxTgtUo49pwhkZQIJY=; b=I4mEZkROIfFlHP NYE5l50VuHmHphruzbQ+uMKtS9tURoByZCP2p9Dj4gf0nf/SO+EbIfWszCC+eQ23/NHdwaaBbfD/7 htiToOyiD4K56B4aaVNaIoCI4f2lupbSWqmHnxJxfiMerkpSL3riUpHokZVOhwqZj4aPUUer508ZH 4h0VljoI0/RskksrOtDs49cBnKWu1z7h4t4os6X34+40M49wwcoZ7RQQvSo0gP+rxDSIAi47azocG MST8eeWxdRzGe8iJSyMam6eaAg/lxCoJdatzwU7yPciqcz7H6tfk9LmIqeMZWw9RoW3tvLGAjiEBA Jo9bjDjAZmab1ykuHvcQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qt35f-00EImR-1q; Wed, 18 Oct 2023 09:43:47 +0000 Received: from m15.mail.163.com ([45.254.50.219]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qt35b-00EIld-12 for linux-rockchip@lists.infradead.org; Wed, 18 Oct 2023 09:43:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=uiQQD tfygYo4EUNy6SV7Ypp0InUq5o+D7+iBms9x5o0=; b=VZQ3cTban/OTlTAhIBn3h ku4ATVFcsSqwmot3V/iYcUoTSsguj5Zemh905yhy5T2LJwQ5GM64jsaCqicfuPqT 0mHM7kuHIZadSKG67MjT+SMLvVu44HrYmFbgExWc67cW4EycrwvZYEfeiAyTlH62 y5nDkhqYL7yY7wx4xV27to= Received: from ProDesk.. (unknown [58.22.7.114]) by zwqz-smtp-mta-g1-1 (Coremail) with SMTP id _____wDXj2O3qC9lom9_Aw--.48679S2; Wed, 18 Oct 2023 17:43:22 +0800 (CST) From: Andy Yan To: linux-rockchip@lists.infradead.org, dri-devel@lists.freedesktop.org, heiko@sntech.de, jonas@kwiboo.se Cc: s.hauer@pengutronix.de, hjc@rock-chips.com, sebastian.reichel@collabora.com, sjoerd.simons@collabora.com, Andy Yan Subject: [PATCH v3 3/4] drm/rockchip: Add more format supported by vop2 Date: Wed, 18 Oct 2023 17:43:18 +0800 Message-Id: <20231018094318.2476081-1-andyshrk@163.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231018094122.2475668-1-andyshrk@163.com> References: <20231018094122.2475668-1-andyshrk@163.com> MIME-Version: 1.0 X-CM-TRANSID: _____wDXj2O3qC9lom9_Aw--.48679S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxKw13tFWxGFWUKrWDWFy5twb_yoW7Zr1rpr WUAFZrXa10vFy8KFsrJr95Ar4rZ3ZrGa1Iq3yqvan2gFyUGFyvqr9xJFy5ZrnFgFyxCw1I kr45Jr4rZr48J3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jSzuAUUUUU= X-Originating-IP: [58.22.7.114] X-CM-SenderInfo: 5dqg52xkunqiywtou0bp/1tbiEB0NXl8YL0Q+bQAAsh X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231018_024344_391200_E0FD0A11 X-CRM114-Status: GOOD ( 10.77 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org From: Andy Yan Add 10 bit RGB and AFBC based YUV format supported by vop2. Signed-off-by: Andy Yan --- Changes in v3: - add format check and convert drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 45 +++++++++++++++++++- drivers/gpu/drm/rockchip/rockchip_vop2_reg.c | 22 +++++++--- 2 files changed, 61 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c index 8289ddc95bee..0f3df8d3eec2 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c @@ -299,6 +299,11 @@ static u32 vop2_get_bpp(const struct drm_format_info *format) static enum vop2_data_format vop2_convert_format(u32 format) { switch (format) { + case DRM_FORMAT_XRGB2101010: + case DRM_FORMAT_ARGB2101010: + case DRM_FORMAT_XBGR2101010: + case DRM_FORMAT_ABGR2101010: + return VOP2_FMT_XRGB101010; case DRM_FORMAT_XRGB8888: case DRM_FORMAT_ARGB8888: case DRM_FORMAT_XBGR8888: @@ -311,10 +316,19 @@ static enum vop2_data_format vop2_convert_format(u32 format) case DRM_FORMAT_BGR565: return VOP2_FMT_RGB565; case DRM_FORMAT_NV12: + case DRM_FORMAT_NV21: + case DRM_FORMAT_YUV420_8BIT: return VOP2_FMT_YUV420SP; + case DRM_FORMAT_NV15: + case DRM_FORMAT_YUV420_10BIT: + return VOP2_FMT_YUV420SP_10; case DRM_FORMAT_NV16: + case DRM_FORMAT_NV61: return VOP2_FMT_YUV422SP; + case DRM_FORMAT_Y210: + return VOP2_FMT_YUV422SP_10; case DRM_FORMAT_NV24: + case DRM_FORMAT_NV42: return VOP2_FMT_YUV444SP; case DRM_FORMAT_YUYV: case DRM_FORMAT_YVYU: @@ -331,6 +345,11 @@ static enum vop2_data_format vop2_convert_format(u32 format) static enum vop2_afbc_format vop2_convert_afbc_format(u32 format) { switch (format) { + case DRM_FORMAT_XRGB2101010: + case DRM_FORMAT_ARGB2101010: + case DRM_FORMAT_XBGR2101010: + case DRM_FORMAT_ABGR2101010: + return VOP2_AFBC_FMT_ARGB2101010; case DRM_FORMAT_XRGB8888: case DRM_FORMAT_ARGB8888: case DRM_FORMAT_XBGR8888: @@ -342,6 +361,17 @@ static enum vop2_afbc_format vop2_convert_afbc_format(u32 format) case DRM_FORMAT_RGB565: case DRM_FORMAT_BGR565: return VOP2_AFBC_FMT_RGB565; + case DRM_FORMAT_YUV420_8BIT: + return VOP2_AFBC_FMT_YUV420; + case DRM_FORMAT_YUV420_10BIT: + return VOP2_AFBC_FMT_YUV420_10BIT; + case DRM_FORMAT_YVYU: + case DRM_FORMAT_YUYV: + case DRM_FORMAT_VYUY: + case DRM_FORMAT_UYVY: + return VOP2_AFBC_FMT_YUV422; + case DRM_FORMAT_Y210: + return VOP2_AFBC_FMT_YUV422_10BIT; default: return VOP2_AFBC_FMT_INVALID; } @@ -352,6 +382,8 @@ static enum vop2_afbc_format vop2_convert_afbc_format(u32 format) static bool vop2_win_rb_swap(u32 format) { switch (format) { + case DRM_FORMAT_XBGR2101010: + case DRM_FORMAT_ABGR2101010: case DRM_FORMAT_XBGR8888: case DRM_FORMAT_ABGR8888: case DRM_FORMAT_BGR888: @@ -364,7 +396,15 @@ static bool vop2_win_rb_swap(u32 format) static bool vop2_afbc_uv_swap(u32 format) { - return false; + switch (format) { + case DRM_FORMAT_YUYV: + case DRM_FORMAT_Y210: + case DRM_FORMAT_YUV420_8BIT: + case DRM_FORMAT_YUV420_10BIT: + return true; + default: + return false; + } } static bool vop2_win_uv_swap(u32 format) @@ -373,6 +413,9 @@ static bool vop2_win_uv_swap(u32 format) case DRM_FORMAT_NV12: case DRM_FORMAT_NV16: case DRM_FORMAT_NV24: + case DRM_FORMAT_NV15: + case DRM_FORMAT_YUYV: + case DRM_FORMAT_UYVY: return true; default: return false; diff --git a/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c index b5e59dd34325..bcc224624a26 100644 --- a/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c +++ b/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c @@ -16,6 +16,10 @@ #include "rockchip_drm_vop2.h" static const uint32_t formats_win_full_10bit[] = { + DRM_FORMAT_XRGB2101010, + DRM_FORMAT_ARGB2101010, + DRM_FORMAT_XBGR2101010, + DRM_FORMAT_ABGR2101010, DRM_FORMAT_XRGB8888, DRM_FORMAT_ARGB8888, DRM_FORMAT_XBGR8888, @@ -24,6 +28,10 @@ static const uint32_t formats_win_full_10bit[] = { DRM_FORMAT_BGR888, DRM_FORMAT_RGB565, DRM_FORMAT_BGR565, + DRM_FORMAT_YUV420_8BIT, /* yuv420_8bit non-Linear mode only */ + DRM_FORMAT_YUV420_10BIT, /* yuv420_10bit non-Linear mode only */ + DRM_FORMAT_YUYV, /* yuv422_8bit non-Linear mode only*/ + DRM_FORMAT_Y210, /* yuv422_10bit non-Linear mode only */ }; static const uint32_t formats_win_full_10bit_yuyv[] = { @@ -35,11 +43,15 @@ static const uint32_t formats_win_full_10bit_yuyv[] = { DRM_FORMAT_BGR888, DRM_FORMAT_RGB565, DRM_FORMAT_BGR565, - DRM_FORMAT_NV12, - DRM_FORMAT_NV16, - DRM_FORMAT_NV24, - DRM_FORMAT_YVYU, - DRM_FORMAT_VYUY, + DRM_FORMAT_NV12, /* yuv420_8bit linear mode, 2 plane */ + DRM_FORMAT_NV21, /* yuv420_8bit linear mode, 2 plane */ + DRM_FORMAT_NV15, /* yuv420_10bit linear mode, 2 plane, no padding */ + DRM_FORMAT_NV16, /* yuv422_8bit linear mode, 2 plane */ + DRM_FORMAT_NV61, /* yuv422_8bit linear mode, 2 plane */ + DRM_FORMAT_NV24, /* yuv444_8bit linear mode, 2 plane */ + DRM_FORMAT_NV42, /* yuv444_8bit linear mode, 2 plane */ + DRM_FORMAT_YVYU, /* yuv422_8bit[YVYU] linear mode */ + DRM_FORMAT_VYUY, /* yuv422_8bit[VYUY] linear mode */ }; static const uint32_t formats_win_lite[] = { From patchwork Wed Oct 18 09:43:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Yan X-Patchwork-Id: 13426768 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 227FDCDB47E for ; Wed, 18 Oct 2023 09:44:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ypqZTL78o7ngXMPRrfpNuqe4BMrX6SF+oGjZHVAGtoA=; b=ubqzh5AqBqxbak MwEF9JuboBW35zVBGPWGGaFce8nPe2xzCA62g52lyEeMaroTIbeW9DrJkfqjCbT+g4CwSkZ5Pfuzr OqSKG+s+05AmSOuGkE5K5+sO+RK96Lo8EehOq6ZCP4BAZIhPh0o4dqYdJfln9Yxsa1AZ7rgZJATY+ 9h/Y5AqiligtZqn3oec1Psfitc/hgs2R7VWc1YnSx2rhEMtC6ASOwM2RqmJyXg9tuFMuIo4+U54To ljD5HWJvmbJt5WmAC7norSGiRRV++Q/ngY5J7yQuhAtduQdr03aaCEx465ZCTchKzuNfU5vwQk8qM NGEzGKdbwVhOsmwMGf2w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qt35y-00EIos-1L; Wed, 18 Oct 2023 09:44:06 +0000 Received: from m12.mail.163.com ([220.181.12.216]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qt35u-00EInw-2o for linux-rockchip@lists.infradead.org; Wed, 18 Oct 2023 09:44:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=UE5ny 2U845hUveTADk37Szj4xJgI4fIwTqY/gMa46xs=; b=oWHm7TY+QbdPJUn6JyF47 0Xwow6Um67Hj/tjh4DW0dc0usDyNBeR2+ZUwsTN/hxqab6mYxkFXUUSYXUfeg/et V/PnezSF2JiAjQbgGISPa1ky8b8PVk/akTgKYO/a0Xom22dMqXSe7Vcz7YdnZGcg R4IrFIdA1KKseuepecNakA= Received: from ProDesk.. (unknown [58.22.7.114]) by zwqz-smtp-mta-g3-1 (Coremail) with SMTP id _____wDnj5TMqC9lLxuJAw--.4745S2; Wed, 18 Oct 2023 17:43:44 +0800 (CST) From: Andy Yan To: linux-rockchip@lists.infradead.org, dri-devel@lists.freedesktop.org, heiko@sntech.de, jonas@kwiboo.se Cc: s.hauer@pengutronix.de, hjc@rock-chips.com, sebastian.reichel@collabora.com, sjoerd.simons@collabora.com, Andy Yan Subject: [PATCH v3 4/4] drm/rockchip: rename windows format for vop2 Date: Wed, 18 Oct 2023 17:43:39 +0800 Message-Id: <20231018094339.2476142-1-andyshrk@163.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231018094122.2475668-1-andyshrk@163.com> References: <20231018094122.2475668-1-andyshrk@163.com> MIME-Version: 1.0 X-CM-TRANSID: _____wDnj5TMqC9lLxuJAw--.4745S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxAF1xKF43Kr4xJF47JF47Arb_yoWrCF1xpa 9F9rnxuF4ruF45Wr1UJayUZr4rC3ZIk3ya9wn5G3Z7KF43KF9rXr1UKas8Cr1DKa48Ar1U Jr4aqryUZr47tFJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jSzuAUUUUU= X-Originating-IP: [58.22.7.114] X-CM-SenderInfo: 5dqg52xkunqiywtou0bp/1tbiTAsNXmI0bm1figACsW X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231018_024403_247602_87DDA43D X-CRM114-Status: UNSURE ( 9.65 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org From: Andy Yan formats_win_full_10bit is for cluster window, formats_win_full_10bit_yuyv is for rk356x esmart, rk3588 esmart window will support more format. formats_win_lite is for smart window. Rename it based the windows type may let meaning is clearer Signed-off-by: Andy Yan --- (no changes since v1) drivers/gpu/drm/rockchip/rockchip_vop2_reg.c | 30 ++++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c index bcc224624a26..fdb48571efce 100644 --- a/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c +++ b/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c @@ -15,7 +15,7 @@ #include "rockchip_drm_vop2.h" -static const uint32_t formats_win_full_10bit[] = { +static const uint32_t formats_cluster[] = { DRM_FORMAT_XRGB2101010, DRM_FORMAT_ARGB2101010, DRM_FORMAT_XBGR2101010, @@ -34,7 +34,7 @@ static const uint32_t formats_win_full_10bit[] = { DRM_FORMAT_Y210, /* yuv422_10bit non-Linear mode only */ }; -static const uint32_t formats_win_full_10bit_yuyv[] = { +static const uint32_t formats_rk356x_esmart[] = { DRM_FORMAT_XRGB8888, DRM_FORMAT_ARGB8888, DRM_FORMAT_XBGR8888, @@ -54,7 +54,7 @@ static const uint32_t formats_win_full_10bit_yuyv[] = { DRM_FORMAT_VYUY, /* yuv422_8bit[VYUY] linear mode */ }; -static const uint32_t formats_win_lite[] = { +static const uint32_t formats_smart[] = { DRM_FORMAT_XRGB8888, DRM_FORMAT_ARGB8888, DRM_FORMAT_XBGR8888, @@ -153,8 +153,8 @@ static const struct vop2_win_data rk3568_vop_win_data[] = { .name = "Smart0-win0", .phys_id = ROCKCHIP_VOP2_SMART0, .base = 0x1c00, - .formats = formats_win_lite, - .nformats = ARRAY_SIZE(formats_win_lite), + .formats = formats_smart, + .nformats = ARRAY_SIZE(formats_smart), .format_modifiers = format_modifiers, .layer_sel_id = 3, .supported_rotations = DRM_MODE_REFLECT_Y, @@ -165,8 +165,8 @@ static const struct vop2_win_data rk3568_vop_win_data[] = { }, { .name = "Smart1-win0", .phys_id = ROCKCHIP_VOP2_SMART1, - .formats = formats_win_lite, - .nformats = ARRAY_SIZE(formats_win_lite), + .formats = formats_smart, + .nformats = ARRAY_SIZE(formats_smart), .format_modifiers = format_modifiers, .base = 0x1e00, .layer_sel_id = 7, @@ -178,8 +178,8 @@ static const struct vop2_win_data rk3568_vop_win_data[] = { }, { .name = "Esmart1-win0", .phys_id = ROCKCHIP_VOP2_ESMART1, - .formats = formats_win_full_10bit_yuyv, - .nformats = ARRAY_SIZE(formats_win_full_10bit_yuyv), + .formats = formats_rk356x_esmart, + .nformats = ARRAY_SIZE(formats_rk356x_esmart), .format_modifiers = format_modifiers, .base = 0x1a00, .layer_sel_id = 6, @@ -191,8 +191,8 @@ static const struct vop2_win_data rk3568_vop_win_data[] = { }, { .name = "Esmart0-win0", .phys_id = ROCKCHIP_VOP2_ESMART0, - .formats = formats_win_full_10bit_yuyv, - .nformats = ARRAY_SIZE(formats_win_full_10bit_yuyv), + .formats = formats_rk356x_esmart, + .nformats = ARRAY_SIZE(formats_rk356x_esmart), .format_modifiers = format_modifiers, .base = 0x1800, .layer_sel_id = 2, @@ -205,8 +205,8 @@ static const struct vop2_win_data rk3568_vop_win_data[] = { .name = "Cluster0-win0", .phys_id = ROCKCHIP_VOP2_CLUSTER0, .base = 0x1000, - .formats = formats_win_full_10bit, - .nformats = ARRAY_SIZE(formats_win_full_10bit), + .formats = formats_cluster, + .nformats = ARRAY_SIZE(formats_cluster), .format_modifiers = format_modifiers_afbc, .layer_sel_id = 0, .supported_rotations = DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270 | @@ -220,8 +220,8 @@ static const struct vop2_win_data rk3568_vop_win_data[] = { .name = "Cluster1-win0", .phys_id = ROCKCHIP_VOP2_CLUSTER1, .base = 0x1200, - .formats = formats_win_full_10bit, - .nformats = ARRAY_SIZE(formats_win_full_10bit), + .formats = formats_cluster, + .nformats = ARRAY_SIZE(formats_cluster), .format_modifiers = format_modifiers_afbc, .layer_sel_id = 1, .supported_rotations = DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270 |