From patchwork Thu Apr 23 20:09:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Kocialkowski X-Patchwork-Id: 11506517 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 77644912 for ; Thu, 23 Apr 2020 20:11:20 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 5558720780 for ; Thu, 23 Apr 2020 20:11:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bJ8/HNek" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5558720780 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+KvkyQ+sBO58Fmzv6dLME6z8oY3NUZrtSNSoITllAm8=; b=bJ8/HNekrp3Rkf Q+K6tZ1U56goEO6ygt1LKBcZPZKViuVEW/hzmX8GTQcDWsg+oKLLFoj7CaMTPCSs6qr4NcErKQWgd EHQyWxOfBIBawGPHxW3QvRzr/HFN75e8FU9+gGsvXwAGq9nL0zzRStI60jKIjN5pUZ7pGZfyV4w2Q 9x5phVSesV26uZtPKVvBRYGHUEU5aGjSYiApQbnIgFxvGN4lOUNnqn33JLVmLVvj/dyS3ab8xmskr apkJCBww6qPqOpTqP98YcMhBasqbu6ELIFXQBNq37FdVtbl7HaSJTE8CkTRrb5mziKwR+WFTU56EQ lu3svei1SX22oUwq8BGQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jRiBn-0004Ug-F2; Thu, 23 Apr 2020 20:11:15 +0000 Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jRiAX-000119-UI; Thu, 23 Apr 2020 20:10:00 +0000 X-Originating-IP: 93.29.109.196 Received: from localhost.localdomain (196.109.29.93.rev.sfr.net [93.29.109.196]) (Authenticated sender: paul.kocialkowski@bootlin.com) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id DB045E000A; Thu, 23 Apr 2020 20:09:54 +0000 (UTC) From: Paul Kocialkowski To: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/4] media: rockchip: rga: Only set output CSC mode for RGB input Date: Thu, 23 Apr 2020 22:09:37 +0200 Message-Id: <20200423200937.1039257-5-paul.kocialkowski@bootlin.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200423200937.1039257-1-paul.kocialkowski@bootlin.com> References: <20200423200937.1039257-1-paul.kocialkowski@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200423_130958_103925_79852A8D X-CRM114-Status: GOOD ( 12.40 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [217.70.183.196 listed in wl.mailspike.net] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [217.70.183.196 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paul Kocialkowski , justin.swartz@risingedge.co.za, Heiko Stuebner , Hans Verkuil , Rob Herring , Thomas Petazzoni , Johan Jonker , Mauro Carvalho Chehab , Ezequiel Garcia Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org Setting the output CSC mode is required for a YUV output, but must not be set when the input is also YUV. Doing this (as tested with a YUV420P to YUV420P conversion) results in wrong colors. Adapt the logic to only set the CSC mode when the output is YUV and the input is RGB. Fixes: f7e7b48e6d79 ("[media] rockchip/rga: v4l2 m2m support") Signed-off-by: Paul Kocialkowski --- drivers/media/platform/rockchip/rga/rga-hw.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/rockchip/rga/rga-hw.c b/drivers/media/platform/rockchip/rga/rga-hw.c index 4be6dcf292ff..cbffcf986ccf 100644 --- a/drivers/media/platform/rockchip/rga/rga-hw.c +++ b/drivers/media/platform/rockchip/rga/rga-hw.c @@ -216,13 +216,17 @@ static void rga_cmd_set_trans_info(struct rga_ctx *ctx) } if (ctx->out.fmt->hw_format >= RGA_COLOR_FMT_YUV422SP) { - switch (ctx->out.colorspace) { - case V4L2_COLORSPACE_REC709: - dst_info.data.csc_mode = RGA_SRC_CSC_MODE_BT709_R0; - break; - default: - dst_info.data.csc_mode = RGA_DST_CSC_MODE_BT601_R0; - break; + if (ctx->in.fmt->hw_format < RGA_COLOR_FMT_YUV422SP) { + switch (ctx->out.colorspace) { + case V4L2_COLORSPACE_REC709: + dst_info.data.csc_mode = + RGA_SRC_CSC_MODE_BT709_R0; + break; + default: + dst_info.data.csc_mode = + RGA_DST_CSC_MODE_BT601_R0; + break; + } } }