Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp413542rdb; Mon, 22 Jan 2024 08:02:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IHOSALGp1WhA35EkUFuIsaLxKcxrCCTCX60yzy3PrufpF3hZ0EDf1nfo6mrbbKRkCPNeDSm X-Received: by 2002:a2e:924f:0:b0:2cc:94df:6d7d with SMTP id v15-20020a2e924f000000b002cc94df6d7dmr1725485ljg.8.1705939359554; Mon, 22 Jan 2024 08:02:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705939359; cv=pass; d=google.com; s=arc-20160816; b=sdC72lV6kkxEjNcXv+QLGDy5DhyR10RNf1E0WWHHT+Yz0K9xlRazlm/booBT+ypVQa YSmmABKufIxV3fsndU7TX6XywIhrMLHXxeIBILWeoMOb8SkcBmMv5XJRgoyoqHZAoucF VtrEu3uOCkSwOUre2BEMH8MGBEfX1hgexkOQUkWgm7h8zC27C/R/U0+PpidVJiI+gNnN DB+50hR1ss6ctxaQd0wKEaag5Ky9EMI+lnqg7sMdw04t97EON7gUuqGz62R3vuAZHjPt BA88Y/SiKf4XgyEy8Fgl0TzDpgeMXcjI2Tlgkk2sOVk820tSOYeYHPyvhXnoH2CbWDXl uVew== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=pss5MFH5kOdU8VtAPmcekfTS9l0NL6VkJVWM3mFSoW0=; fh=kfNVkwKD5bseF55aispXYRY8nGINkgohhxgeCNifwo4=; b=AWjV05DDEljCumH8TpjuJe2ZvXWPVl7n8HXesxLEobL7WvBEl0i2eLJzaukuRWoLZU MfKX7nYP0jNuYwXxhfrhhEh6h9Nyv2sLsI+QjGigo2cUCewRSCmDHnSvONDAihHMKy1U IheLJfrvoOaVowd/v/76XAGVAtHOAazxNPzVsJGXTdeIONUS7KjXOc15EPJnjbzRLUw+ RXxj8HOThWTe0DmUeogpnvzIx03IG4ibo+NPFuU6+qdlHaz/ET55FYSSqX5VjxVqPdC6 nNQ2Y7i95f12iT004EEQ8WTGIczx9dusbBhBwozjwPTDVYZvueBkvuUoz/WIgRrFm+6P MiSg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=khwrRQR+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-33420-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33420-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id c7-20020a509f87000000b0055c661cc0a3si317200edf.622.2024.01.22.08.02.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 08:02:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33420-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=khwrRQR+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-33420-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33420-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 304651F23398 for ; Mon, 22 Jan 2024 16:02:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4EEC0823B0; Mon, 22 Jan 2024 15:10:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="khwrRQR+" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 735A481ADD; Mon, 22 Jan 2024 15:10:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705936244; cv=none; b=nqSsXRcYgxNhRyfcj5iRJIMjqtYEgC+n2iSmKNdPfx6gsknn08ujHpzgWJI7dmj4OoywjgKy0IQ5vgBGDKaZ4QxegMw0oFtWUrsbONUJN5dUyBpeEZFj+olR5+7mAM84kkKOTHaEnaBfa5zO5wnJvGDSOyCkpMG6EDSC1EcdXO0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705936244; c=relaxed/simple; bh=ScpW/6WC62ysJwDGUoS4zNo08oaRgl4SxUxfje9EcN8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cTjkAhpnEDm7Rzxz3MmnGm0Mg25gEmrie0QkrCoLpYM7uCfHuobd6Oow8o8PyoR27Mdq2UeIExhrG1qFl8LIGhuoh4dcoWBCpeJ3Bg10kXWLBR7dEFzPFimzVzqbEaYgTkKLxXuJ4aUg8qb1QGIn0L7YgoN2H33Cv7hxNjTytUM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=khwrRQR+; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 855ACC433C7; Mon, 22 Jan 2024 15:10:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705936244; bh=ScpW/6WC62ysJwDGUoS4zNo08oaRgl4SxUxfje9EcN8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=khwrRQR+x2gI/rDvj99XRXJFzEz0NseIB5LmxRXXUtg8twnZY7m2v3yONCB2eh6m2 D+RdK7kmqFBecpmgzhYhBBTyPGMkZx+SxYpf//xLjHnP0eWa40YimZvfNcVJXE1eLw 7I0eMOGUFkDR6T+LNNch35UOdjNY26iFOqjPlCRT56H5BcJTAxBa3jZb7mRR9BYmI+ ONzm+j45JPMYm0K/kKjEXgx3iRsTR8Tr4e0nudot6jGBDJ5gCi7LLqj4LUHdQEb5d6 GcQJC8g0uBCMFMJl/z1Gh06qrMI9yQQ/UUnRkfrh2b0BMnOe6F3j9jNiBHuSRj4Sgx 3SD02zTS6Lu2w== 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 6.1 20/53] media: rockchip: rga: fix swizzling for RGB formats Date: Mon, 22 Jan 2024 10:08:21 -0500 Message-ID: <20240122150949.994249-20-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122150949.994249-1-sashal@kernel.org> References: <20240122150949.994249-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.1.74 Content-Transfer-Encoding: 8bit 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 61b25fcf826e..9b20cef5afc6 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