Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp388425rdb; Mon, 22 Jan 2024 07:19:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IEgukw4dP0nj5InD8vtRpTt/7/qpGZWe8bgAZYlLd9tkqocVrVTvR4z3Zb6Zm8YqMo5vxXP X-Received: by 2002:a05:6a20:43ac:b0:199:9036:b35 with SMTP id i44-20020a056a2043ac00b0019990360b35mr6108403pzl.38.1705936793211; Mon, 22 Jan 2024 07:19:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705936793; cv=pass; d=google.com; s=arc-20160816; b=O3ds1U2vwTr0IFMzkEPQZhuYKuyxa8gPGa1GB2bjw5HwNW2+wG2xXZeWYcL0iW4MMs ZUYQxaGSFPShD7sajUsIkoypBOjijX0zkbJTF6KNy0NU1TGNYR9Z2zuBiLSCSvNvd8ba 4kXNphb2XrOFOP59u10dL4WZzXouoQKyN30PBAMXp0AKE2bGmyACq+LIzu8e0Hx8IVCf pwpq4uZWABDGKEcGUK0XGKeLcoklaZvcvlZjpPOXSVJtbq+95WbQyHL83+CpARG5lS6I xU67OQA0i4hg4GKpdaWRIDqT7QxoOONh+4Wzq7c8rCeXY5Zr1nROji/ECZuewL5sM2Tk lRFw== 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=4lAe8zjxeK9gI7zTQEbTXbQwwAO6ZUmCRJrMtUzYKUA=; fh=kfNVkwKD5bseF55aispXYRY8nGINkgohhxgeCNifwo4=; b=B9nw2A2OSLLu/53OcinXCT/qMsYf2vBR8x1BPWiM0ifH5PBCCmGt0abE+Wuw5KqFJW +TEYbdBz4fO2KIaqsP7bsEmUE6TncJ1uB8g5HKBAqTvA6YVtd6JCw4vA8aynlEzyQmvi RcxSnjKvdf08V04gL+4cbTqh4DbQbhPwA9RhH4qEGbZ2fQFoafuUbx3NopQzhidafapW /A1SN92m7uKDy9vF0CV7FH76FGR9sVBITn8MYAXbMx8MAOAaSA73hBpG24r9qG3jIE3o 4F9PBk8/3KeGSJ7tMlkDTer0qoWUuEPC6JVJHXyGWc/Oz/C4Xa5CwOGwHlMrUIIyKBOo RECA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UJ25wzEd; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-33246-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33246-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 21-20020a631555000000b005cdf37ce92asi8396663pgv.705.2024.01.22.07.19.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 07:19:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33246-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UJ25wzEd; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-33246-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33246-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 9FDF328E373 for ; Mon, 22 Jan 2024 15:12:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 266684F886; Mon, 22 Jan 2024 14:58:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UJ25wzEd" 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 4BE254F60C; Mon, 22 Jan 2024 14:58:05 +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=1705935485; cv=none; b=rzexT8rs1d4Iq5sc5rw9MNOKOioOpypY2pDx8Mf7Qmf2gTI+pIne50keOYZYXRYWvsX6DJTjAf7vn09YM1bK/HyTuqX0bP+WrABknAru+Y9eGY+bnau4pLCvgo2DlzDTTVNRLw0wCVKJxMlwxtV0koaEOFG8CLC4Y5NeUu1v4E0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705935485; c=relaxed/simple; bh=4lNMdeEVMvwU2ZC+YYaASXkC7INSwaNBxa6w96wgbts=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MGxCE9C6084toz5CMHgA0euNUtWX76Mg1y5MEW7AYJaJRSaEJ+gN5893GWBdWJYviSWu2gMjpk2FG/4SKWeQymB4DCT9x0+H7yQtwogRJOsjo39cmC09mOMoOWkeB5AZepaYPVbNnC9TqPZ7Uv5yv6dxczlcQsyXmrI7JjHkqkM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UJ25wzEd; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B9B0C43390; Mon, 22 Jan 2024 14:58:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705935484; bh=4lNMdeEVMvwU2ZC+YYaASXkC7INSwaNBxa6w96wgbts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UJ25wzEd6+pkvzFCmyYkcwlz/veoFYqXMoZp4T9VjA+TrGLZ+R0TFk69jKqPsdZSA sorBJpaS52jabM/IvWWvokCsYTJg+/TgpJmkOoojrZG0ilrDhan4gi7e0d2sh2L9o0 PnvrSmhjk+afOL0Pjw2bohQquDtyujWDPD2P4RYsMky6F6f8TSb5CcDzUQygWDB5HE BG3aqOaUe1BNCzfcO249XlphoQMXnsnHoB4U635WbUO52LaApu/TXEfm5CuZqlPwQ9 SYG1i5R+AQV04b37Ka+/EJO8pCiwlivmr3BU7Mt4g5e/S0BkJzFIrL0OSzKNdeF/0O QwzPoBvexN08A== 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.7 28/88] media: rockchip: rga: fix swizzling for RGB formats Date: Mon, 22 Jan 2024 09:51:01 -0500 Message-ID: <20240122145608.990137-28-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122145608.990137-1-sashal@kernel.org> References: <20240122145608.990137-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.7.1 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 f1c532a5802a..25f5b5eebf13 100644 --- a/drivers/media/platform/rockchip/rga/rga.c +++ b/drivers/media/platform/rockchip/rga/rga.c @@ -184,25 +184,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, @@ -211,7 +202,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