Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp5887506ybf; Thu, 5 Mar 2020 08:55:03 -0800 (PST) X-Google-Smtp-Source: ADFU+vswSCkRw/4mcYD5LX5stNZIntto6OQ/EXlm+qai4hpkoUhCEBXXsrQtg0DjGW/223jTn/x/ X-Received: by 2002:aca:c5ca:: with SMTP id v193mr6185411oif.164.1583427302907; Thu, 05 Mar 2020 08:55:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583427302; cv=none; d=google.com; s=arc-20160816; b=V4I+civeXdZLqsJQMSBQCRAyJujkM449z4PQMAInXwhmEnxl9n2tk6WfHkpz/qn3VY BtyetHQH0xa8wfxIM23FPTveNFlHvUoGMHdfv9Gn/ks1j7lW7C/NnE9rcQi6X8CnS2Sl 1yqb4582KdcHCIrHr0awujbcilorfZLiefJgbd5fkS/T7ZToRJjIc/rckaPswOwRgbfG oXKV0FNxDhrZ//duF75RJXHrFeOXHUU28gqwHOMzLJROxFiHoX0uxAFM0+qsy1Xfh69x VKawVI51vkbkJd00V5ecJuPIQzl3w4QP02dYFUkHwg2ENpj8Eg3OVWUVpRCu/wNGiE2l RNtw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=z9axb9PhDwbKS/EUELMMPveSJvTNUfnLK+7LF+NEaoU=; b=oybepvWgVa93HwyvkxBdqNmmAnKu1rBC+nyPT4ASaIkA+HP/7TcGeu1z9PkyYD2ZNm nm+r3WA0VgmOs6vatbIeFw1f6uES4BUWCqVxDml3PL+I1oXnALtdhaEb6U/VLYxU0L/g r5WiuSOkx8lDfFNVnkZzNqOHgKnWIsX2XUfN7N3ZeyN/qzEg8Yq0vb7b7jwUnqCuvKLQ XMPA2beKgkXkY4InxKIro9fK9Jg6DaWWk5VhPkLs79dE3frxYFe6CxAvvdWxTOaTIQjJ LI9H/0HemX4TAgFs65UfEwKQC+dR7K0THsBqmG/NBwc03aXuimVLYdMuLOv+lR8xk1QD bAPg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=siol.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x16si3820765otp.180.2020.03.05.08.54.50; Thu, 05 Mar 2020 08:55:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=siol.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726368AbgCEQxb convert rfc822-to-8bit (ORCPT + 99 others); Thu, 5 Mar 2020 11:53:31 -0500 Received: from mailoutvs59.siol.net ([185.57.226.250]:56086 "EHLO mail.siol.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726036AbgCEQxb (ORCPT ); Thu, 5 Mar 2020 11:53:31 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTP id 1829A523028; Thu, 5 Mar 2020 17:53:26 +0100 (CET) X-Virus-Scanned: amavisd-new at psrvmta11.zcs-production.pri Received: from mail.siol.net ([127.0.0.1]) by localhost (psrvmta11.zcs-production.pri [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id IahrWYT3sMxp; Thu, 5 Mar 2020 17:53:25 +0100 (CET) Received: from mail.siol.net (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTPS id 9E9BC5230A3; Thu, 5 Mar 2020 17:53:25 +0100 (CET) Received: from jernej-laptop.localnet (cpe-194-152-20-232.static.triera.net [194.152.20.232]) (Authenticated sender: jernej.skrabec@siol.net) by mail.siol.net (Postfix) with ESMTPA id 9DDB9522F5B; Thu, 5 Mar 2020 17:53:23 +0100 (CET) From: Jernej =?utf-8?B?xaBrcmFiZWM=?= To: Laurent Pinchart Cc: a.hajda@samsung.com, narmstrong@baylibre.com, jonas@kwiboo.se, airlied@linux.ie, daniel@ffwll.ch, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 4/4] drm/bridge: dw-hdmi: rework csc related functions Date: Thu, 05 Mar 2020 17:53:22 +0100 Message-ID: <2518078.mvXUDI8C0e@jernej-laptop> In-Reply-To: <20200304235149.GH28814@pendragon.ideasonboard.com> References: <20200304232512.51616-1-jernej.skrabec@siol.net> <20200304232512.51616-5-jernej.skrabec@siol.net> <20200304235149.GH28814@pendragon.ideasonboard.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Laurent, Dne Ĩetrtek, 05. marec 2020 ob 00:51:49 CET je Laurent Pinchart napisal(a): > Hi Jernej, > > Thank you for the patch. > > On Thu, Mar 05, 2020 at 12:25:12AM +0100, Jernej Skrabec wrote: > > is_color_space_conversion() is a misnomer. It checks not only if color > > space conversion is needed, but also if format conversion is needed. > > This is actually desired behaviour because result of this function > > determines if CSC block should be enabled or not (CSC block can also do > > format conversion). > > > > In order to clear misunderstandings, let's rework > > is_color_space_conversion() to do exactly what is supposed to do and add > > another function which will determine if CSC block must be enabled or > > not. > > > > Signed-off-by: Jernej Skrabec > > --- > > > > drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 31 +++++++++++++++-------- > > 1 file changed, 21 insertions(+), 10 deletions(-) > > > > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c > > b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index > > c8a02e5b5e1b..7724191e0a8b 100644 > > --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c > > +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c > > @@ -963,11 +963,14 @@ static void hdmi_video_sample(struct dw_hdmi *hdmi) > > > > static int is_color_space_conversion(struct dw_hdmi *hdmi) > > { > > > > - return (hdmi->hdmi_data.enc_in_bus_format != > > - hdmi->hdmi_data.enc_out_bus_format) || > > - (hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_in_bus_format) && > > - hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format) && > > - hdmi->hdmi_data.rgb_limited_range); > > + struct hdmi_data_info *hdmi_data = &hdmi->hdmi_data; > > + bool is_input_rgb, is_output_rgb; > > + > > + is_input_rgb = hdmi_bus_fmt_is_rgb(hdmi_data->enc_in_bus_format); > > + is_output_rgb = hdmi_bus_fmt_is_rgb(hdmi_data- >enc_out_bus_format); > > + > > + return (is_input_rgb != is_output_rgb) || > > + (is_input_rgb && is_output_rgb && hdmi_data- >rgb_limited_range); > > > > } > > > > static int is_color_space_decimation(struct dw_hdmi *hdmi) > > > > @@ -994,6 +997,13 @@ static int is_color_space_interpolation(struct > > dw_hdmi *hdmi)> > > return 0; > > > > } > > > > +static bool is_conversion_needed(struct dw_hdmi *hdmi) > > Maybe is_csc_needed ? Ok, I'll fix during applying. > > Reviewed-by: Laurent Pinchart Thanks! Best regards, Jernej > > > +{ > > + return is_color_space_conversion(hdmi) || > > + is_color_space_decimation(hdmi) || > > + is_color_space_interpolation(hdmi); > > +} > > + > > > > static void dw_hdmi_update_csc_coeffs(struct dw_hdmi *hdmi) > > { > > > > const u16 (*csc_coeff)[3][4] = &csc_coeff_default; > > > > @@ -2014,18 +2024,19 @@ static void dw_hdmi_enable_video_path(struct > > dw_hdmi *hdmi)> > > hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS); > > > > /* Enable csc path */ > > > > - if (is_color_space_conversion(hdmi)) { > > + if (is_conversion_needed(hdmi)) { > > > > hdmi->mc_clkdis &= ~HDMI_MC_CLKDIS_CSCCLK_DISABLE; > > hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS); > > > > - } > > > > - /* Enable color space conversion if needed */ > > - if (is_color_space_conversion(hdmi)) > > > > hdmi_writeb(hdmi, HDMI_MC_FLOWCTRL_FEED_THROUGH_OFF_CSC_IN_PATH, > > > > HDMI_MC_FLOWCTRL); > > > > - else > > + } else { > > + hdmi->mc_clkdis |= HDMI_MC_CLKDIS_CSCCLK_DISABLE; > > + hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS); > > + > > > > hdmi_writeb(hdmi, HDMI_MC_FLOWCTRL_FEED_THROUGH_OFF_CSC_BYPASS, > > > > HDMI_MC_FLOWCTRL); > > > > + } > > > > } > > > > /* Workaround to clear the overflow condition */