From mboxrd@z Thu Jan 1 00:00:00 1970 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 CFC8CC47DAF for ; Mon, 22 Jan 2024 15:17:37 +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=woAkjWKuwWmi9qdGQgb+oPenkgmPhjkOgCF/JgqREeA=; b=2X8y0yHRLPy851 5FZybEFmPcF83QjMfZFvX9CZD8OvVhpaQoBP09ELvg+cpBSJelXiouVtywRgjvu+o1zMA/TzHUNn4 F1yA8quw6zP6Dqc9D8dzyAL7m7SvH603AehBUi2xUby7exAt+psf99yDqbSdJjmj7aH7GhESBTcXe AzxYw8rd1eYaeXLmgV0W+v2mmZ7YCAHA4jSEwpTJ5TLhtUcV/IopVGZIK44BAPu7JzHALYGNaIoq9 vJZmkxC/pKC2luIHr8B2XNjWcRS0T/aPcf0qrtZh6R6jPoeZQdQ2dskztykgt4aAgoPEgF1vToWaC dz56j+qpggPnZckAz+Zg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rRw3H-00CfIL-1s; Mon, 22 Jan 2024 15:17:31 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rRw3C-00CfDy-1p; Mon, 22 Jan 2024 15:17:28 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id 2EAABB80E9B; Mon, 22 Jan 2024 15:17:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D9F0C43399; Mon, 22 Jan 2024 15:17:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705936644; bh=RHgkWSYJcXcEx2L/5M8uPuxxgZbjcV9nKsnWU2sX2aY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NjIe42482DgZ3flZb3z7yHa7Nsmap7ipJx7PcrhTlOy5Zpx9j+0ye0QF4eUNQNhS6 Sv4Bn889j6tpYGT0xFI/B0SbZOJ1wB8bnu8ZCIyTn2PcqF4h7bsvXORkYkrt1/Ydxt HBNh4F8esShRa14SxmIoJ04tSL9EfGR7M/uMBArcNDbeY0QkJBsOETo6ANHFP0RNPZ KMV5CRXGEVEeMgggwoXS4zsuS0NQE50kUusq1ioP79VD6pjzq7jHlzKLlI6rvTMees Irs4RmRTwtenN92Gins2A8pewMQXuRgiZC6+07udDqiCUFSB/Awu7i+dXxUCHJlx3U Z12dF7OHzW8jg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Michael Tretter , Hans Verkuil , Sasha Levin , jacob-chen@iotwrt.com, ezequiel@vanguardiasur.com.ar, mchehab@kernel.org, heiko@sntech.de, linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 5.4 11/24] media: rockchip: rga: fix swizzling for RGB formats Date: Mon, 22 Jan 2024 10:16:25 -0500 Message-ID: <20240122151659.997085-11-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122151659.997085-1-sashal@kernel.org> References: <20240122151659.997085-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 5.4.267 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240122_071726_864655_C424FC49 X-CRM114-Status: GOOD ( 15.50 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org From: Michael Tretter [ Upstream commit 9e7dc39260edac180c206bb6149595a40eabae3e ] When using 32 bit RGB formats, the RGA on the rk3568 produces wrong colors as the wrong color channels are read or written. The reason is that the format description for the channel swizzeling is wrong and the wrong bits are configured. For example, when converting ARGB32 to NV12, the alpha channel is used as blue channel.. This doesn't happen if the color format is the same on both sides. Fix the color_swap settings of the formats to correctly handle 32 bit RGB formats. For RGA_COLOR_FMT_XBGR8888, the RGA_COLOR_ALPHA_SWAP bit doesn't have an effect. Thus, it isn't possible to handle the V4L2_PIX_FMT_XRGB32. Thus, it is removed from the list of supported formats. Signed-off-by: Michael Tretter Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin --- drivers/media/platform/rockchip/rga/rga.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/platform/rockchip/rga/rga.c index e9ff12b6b5bb..302da68075b2 100644 --- a/drivers/media/platform/rockchip/rga/rga.c +++ b/drivers/media/platform/rockchip/rga/rga.c @@ -187,25 +187,16 @@ static int rga_setup_ctrls(struct rga_ctx *ctx) static struct rga_fmt formats[] = { { .fourcc = V4L2_PIX_FMT_ARGB32, - .color_swap = RGA_COLOR_RB_SWAP, + .color_swap = RGA_COLOR_ALPHA_SWAP, .hw_format = RGA_COLOR_FMT_ABGR8888, .depth = 32, .uv_factor = 1, .y_div = 1, .x_div = 1, }, - { - .fourcc = V4L2_PIX_FMT_XRGB32, - .color_swap = RGA_COLOR_RB_SWAP, - .hw_format = RGA_COLOR_FMT_XBGR8888, - .depth = 32, - .uv_factor = 1, - .y_div = 1, - .x_div = 1, - }, { .fourcc = V4L2_PIX_FMT_ABGR32, - .color_swap = RGA_COLOR_ALPHA_SWAP, + .color_swap = RGA_COLOR_RB_SWAP, .hw_format = RGA_COLOR_FMT_ABGR8888, .depth = 32, .uv_factor = 1, @@ -214,7 +205,7 @@ static struct rga_fmt formats[] = { }, { .fourcc = V4L2_PIX_FMT_XBGR32, - .color_swap = RGA_COLOR_ALPHA_SWAP, + .color_swap = RGA_COLOR_RB_SWAP, .hw_format = RGA_COLOR_FMT_XBGR8888, .depth = 32, .uv_factor = 1, -- 2.43.0 _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip