Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1247339pxa; Thu, 20 Aug 2020 06:41:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4BNfVdMe8e/4BCoZ7I9MiV/8cEWlmjWYdbYu7BJfaUUTsy1d3xDTgUGJsO9UiNNLcrbVX X-Received: by 2002:a17:906:f905:: with SMTP id lc5mr3191697ejb.340.1597930912794; Thu, 20 Aug 2020 06:41:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597930912; cv=none; d=google.com; s=arc-20160816; b=T7+9UjDPMMYWIOHGC9wcxfFJzqNljFD/zEoub8pSULp7bmC9tzqle5wRm2/Jm9oNGe NrNZdKFEIzVjmuM5fz8ujKqk0ImQ3SJmgfatgLyl5PLuGMZOyIdQAd+dqUzHNsUGNbSo gjd2jssWhqBHb6Mz06V58PEOtWea8Xbx9SJgbXkf8+SPz9rAtEjsi/T3ntcoRblq62iT hipY4oUeERxTrKgDlYj+tZTx66bGPobsiMq3EEIoPw+f1hbSvjdPWkVN+Ab70Ef63Wve pXDu+hTXyiJehX7o4X6VP+h73QYuND9Dp6Z72F9h/4sN1VVwhIY9lHTBq3g68S4dNHKC 7iig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iXlw4eoOjdzFCCBqPi2YhJASbUTAohmcKP6PZg8IF4w=; b=JkkbUIGWUTJKrfuIjwW4JQUVz77rrFHu/+L1YeWWmo9Ci3aDaL9wZDpKPxHgd8e0FO Eqc84ndHIfhxhimEOqfusHMm7couIOOKARJiEvrvb9XfcFGfI3TJOup2LfIOxcNzKlsx DAG3qCbdIkub/BypLP0749utZsjSRRQlrBKJ64Ywgjaj5kSzlmxZiRLbM140X80bUANI 08ZEy5JBLZSxoi36suyETUZSegP4sL14h6MeDaOX6HRxrONn9cXHYWyUOMJOgoS6rrtO wWTXLWwiyejtWIVOJS6L9NO0uyd1Dlt+r2ZW2V+DX3aVu+cxVbNlu8SwxOKuvXYa7vH8 B5EA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TwW5SyXu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k10si1173592ejd.657.2020.08.20.06.41.28; Thu, 20 Aug 2020 06:41:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TwW5SyXu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730051AbgHTNda (ORCPT + 99 others); Thu, 20 Aug 2020 09:33:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:42326 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726980AbgHTJa4 (ORCPT ); Thu, 20 Aug 2020 05:30:56 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AA15520855; Thu, 20 Aug 2020 09:30:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597915855; bh=9iIh+itXFCiJpzJCgY8kQPXUYNArH99tHwymyYCggEs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TwW5SyXurM9WvGh0eF2jJDf+2Y5wa8Kmp0n78OV++HPiDX/R3FsdoeONWJqHVCYqy EJFo43fpFu/l0P+1CnvrGO3q9vcU2sxalh1ZNq5d77ofPMcAny0KG4mvCUT5lfCjEN TlcjsFUP6QakrPM2c1MG8scrIrr4FJwKEg9rNzco= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Kocialkowski , Ezequiel Garcia , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.8 128/232] media: rockchip: rga: Only set output CSC mode for RGB input Date: Thu, 20 Aug 2020 11:19:39 +0200 Message-Id: <20200820091619.015926855@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091612.692383444@linuxfoundation.org> References: <20200820091612.692383444@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Paul Kocialkowski [ Upstream commit 0f879bab72f47e8ba2421a984e7acfa763d3e84e ] 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 output CSC mode when the output is YUV and the input is RGB. Also add a comment to clarify the rationale. Fixes: f7e7b48e6d79 ("[media] rockchip/rga: v4l2 m2m support") Signed-off-by: Paul Kocialkowski Reviewed-by: Ezequiel Garcia Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/rockchip/rga/rga-hw.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/rockchip/rga/rga-hw.c b/drivers/media/platform/rockchip/rga/rga-hw.c index 5607ee8d19176..aaa96f256356b 100644 --- a/drivers/media/platform/rockchip/rga/rga-hw.c +++ b/drivers/media/platform/rockchip/rga/rga-hw.c @@ -200,6 +200,11 @@ static void rga_cmd_set_trans_info(struct rga_ctx *ctx) dst_info.data.format = ctx->out.fmt->hw_format; dst_info.data.swap = ctx->out.fmt->color_swap; + /* + * CSC mode must only be set when the colorspace families differ between + * input and output. It must remain unset (zeroed) if both are the same. + */ + if (RGA_COLOR_FMT_IS_YUV(ctx->in.fmt->hw_format) && RGA_COLOR_FMT_IS_RGB(ctx->out.fmt->hw_format)) { switch (ctx->in.colorspace) { @@ -212,7 +217,8 @@ static void rga_cmd_set_trans_info(struct rga_ctx *ctx) } } - if (RGA_COLOR_FMT_IS_YUV(ctx->out.fmt->hw_format)) { + if (RGA_COLOR_FMT_IS_RGB(ctx->in.fmt->hw_format) && + RGA_COLOR_FMT_IS_YUV(ctx->out.fmt->hw_format)) { switch (ctx->out.colorspace) { case V4L2_COLORSPACE_REC709: dst_info.data.csc_mode = RGA_SRC_CSC_MODE_BT709_R0; -- 2.25.1