Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5909700rdb; Thu, 14 Dec 2023 03:18:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IE6OhQrE0QmFj2EuC9X22E0QdDrggqcivn1JAq5WKnA072ql/wyaiJN+g8ZzFY5g/HKwlaV X-Received: by 2002:a17:902:7842:b0:1d0:b229:faa2 with SMTP id e2-20020a170902784200b001d0b229faa2mr7421609pln.68.1702552702704; Thu, 14 Dec 2023 03:18:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702552702; cv=none; d=google.com; s=arc-20160816; b=BBlgP+l3+VR1Qu/Wgm33rlGjI0R8zWpVKuMX1Re+38WJqfDmb18FRKhq04Afdnt1kY SDx3pmYPIXUuT+xuUNXzaKj3C0QhPwdMsD+EU2HSyblIh1wppdD8GNEjA4OoYatJLpve cyGPDT5yNwTlqv7PPHLAQfW/LM3ucA2xuBnOTR/45jLvIKk4/muGob0+2VUEGWdYxF1F mdevSHcAvPOhQAmYZty4zVhhgkGZWh9Hg6mCEhs3Js8BNp18mq6Jbc4+1d2gsJV/Zgp8 Gt7Aq/4hgbxIPQqi6fQCVwrXGxp0OSfaBlouIvpr1RRopja7Qyw2Mj8Ysu5PoyYwMJdH IyeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=LO1O/94nOsweWMfvpTye7p5TvfOaDdYxCCPwogjc5a4=; fh=Ggb6WTvo8oED8Fr2f1+TOEkVv2agMXpEnergtx1E4dA=; b=RCdUT86mKbmjOB6YmfTEGPEzcBWe09Mckdh47R74W9VV6BnMOZlOC/QgBYMIfJPQiK Ns4CXAW9bBR8WzsQDQw+gqwEBbVJ3C09ooeTvJkkeij+83gBcD7xCrsA8yrpB87jJDJ9 wz8oAyGIu9sxcxrDg2Xjpn+AbduURjIx+eBRdneDEwVR7sEUSJVTmZCQBKbsRCxojeag eHppAI2HqvSDVy0L2H04Tv4Rcb/GjKV//817ykb9xVrFAq1P0q1MbwWh15pzM1MjEDRw Scw5V1D9qxf5megDFs0uI7M+EjQ3KAnpwd3rMnzYCsy4dqwRL2Va7iEA56JJd6A1Hb0+ fgrA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sntech.de Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id b4-20020a170902d88400b001d098d9fb92si10974111plz.170.2023.12.14.03.18.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 03:18:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sntech.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 622958247774; Thu, 14 Dec 2023 03:18:19 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443765AbjLNLR5 (ORCPT + 99 others); Thu, 14 Dec 2023 06:17:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443730AbjLNLRz (ORCPT ); Thu, 14 Dec 2023 06:17:55 -0500 Received: from gloria.sntech.de (gloria.sntech.de [185.11.138.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBE2011D; Thu, 14 Dec 2023 03:17:59 -0800 (PST) Received: from i53875b61.versanet.de ([83.135.91.97] helo=diego.localnet) by gloria.sntech.de with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rDjii-0002lZ-0Q; Thu, 14 Dec 2023 12:17:36 +0100 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: Maxime Ripard , Alex Bee Cc: Sandy Huang , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 04/11] drm/rockchip: inno_hdmi: Correctly setup HDMI quantization range Date: Thu, 14 Dec 2023 12:17:34 +0100 Message-ID: <3053311.k3LOHGUjKi@diego> In-Reply-To: <5f4fc919-681f-44ec-bd44-5788e5b718ca@gmail.com> References: <20231213195125.212923-1-knaerzche@gmail.com> <5f4fc919-681f-44ec-bd44-5788e5b718ca@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 14 Dec 2023 03:18:19 -0800 (PST) Am Donnerstag, 14. Dezember 2023, 12:12:08 CET schrieb Alex Bee: > Hi Maxime > > Am 14.12.23 um 08:56 schrieb Maxime Ripard: > > Hi Alex, > > > > Thanks for working on this! > > > > On Wed, Dec 13, 2023 at 08:51:18PM +0100, Alex Bee wrote: > >> The display controller will always give full range RGB regardless of the > >> mode set, but HDMI requires certain modes to be transmitted in limited > >> range RGB. This is especially required for HDMI sinks which do not support > >> non-standard quantization ranges. > >> > >> This enables color space conversion for those modes and sets the > >> quantization range accordingly in the AVI infoframe. > >> > >> Fixes: 412d4ae6b7a5 ("drm/rockchip: hdmi: add Innosilicon HDMI support") > >> Signed-off-by: Alex Bee > >> --- > >> drivers/gpu/drm/rockchip/inno_hdmi.c | 40 ++++++++++++++++++++++------ > >> 1 file changed, 32 insertions(+), 8 deletions(-) > >> > >> diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c > >> index 345253e033c5..32626a75723c 100644 > >> --- a/drivers/gpu/drm/rockchip/inno_hdmi.c > >> +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c > >> @@ -33,6 +33,7 @@ struct hdmi_data_info { > >> unsigned int enc_in_format; > >> unsigned int enc_out_format; > >> unsigned int colorimetry; > >> + bool rgb_limited_range; > >> }; > >> > >> struct inno_hdmi_i2c { > >> @@ -308,6 +309,18 @@ static int inno_hdmi_config_video_avi(struct inno_hdmi *hdmi, > >> else > >> frame.avi.colorspace = HDMI_COLORSPACE_RGB; > >> > >> + if (hdmi->hdmi_data.enc_out_format == HDMI_COLORSPACE_RGB) { > >> + drm_hdmi_avi_infoframe_quant_range(&frame.avi, > >> + &hdmi->connector, mode, > >> + hdmi->hdmi_data.rgb_limited_range ? > >> + HDMI_QUANTIZATION_RANGE_LIMITED : > >> + HDMI_QUANTIZATION_RANGE_FULL); > >> + } else { > >> + frame.avi.quantization_range = HDMI_QUANTIZATION_RANGE_DEFAULT; > >> + frame.avi.ycc_quantization_range = > >> + HDMI_YCC_QUANTIZATION_RANGE_LIMITED; > >> + } > >> + > >> return inno_hdmi_upload_frame(hdmi, rc, &frame, INFOFRAME_AVI, 0, 0, 0); > >> } > >> > >> @@ -334,14 +347,22 @@ static int inno_hdmi_config_video_csc(struct inno_hdmi *hdmi) > >> if (data->enc_in_format == data->enc_out_format) { > >> if ((data->enc_in_format == HDMI_COLORSPACE_RGB) || > >> (data->enc_in_format >= HDMI_COLORSPACE_YUV444)) { > >> - value = v_SOF_DISABLE | v_COLOR_DEPTH_NOT_INDICATED(1); > >> - hdmi_writeb(hdmi, HDMI_VIDEO_CONTRL3, value); > >> - > >> - hdmi_modb(hdmi, HDMI_VIDEO_CONTRL, > >> - m_VIDEO_AUTO_CSC | m_VIDEO_C0_C2_SWAP, > >> - v_VIDEO_AUTO_CSC(AUTO_CSC_DISABLE) | > >> - v_VIDEO_C0_C2_SWAP(C0_C2_CHANGE_DISABLE)); > >> - return 0; > >> + if (data->enc_in_format == HDMI_COLORSPACE_RGB && > >> + data->enc_out_format == HDMI_COLORSPACE_RGB && > >> + hdmi->hdmi_data.rgb_limited_range) { > >> + csc_mode = CSC_RGB_0_255_TO_RGB_16_235_8BIT; > >> + auto_csc = AUTO_CSC_DISABLE; > >> + c0_c2_change = C0_C2_CHANGE_DISABLE; > >> + csc_enable = v_CSC_ENABLE; > >> + } else { > >> + value = v_SOF_DISABLE | v_COLOR_DEPTH_NOT_INDICATED(1); > >> + hdmi_writeb(hdmi, HDMI_VIDEO_CONTRL3, value); > >> + hdmi_modb(hdmi, HDMI_VIDEO_CONTRL, > >> + m_VIDEO_AUTO_CSC | m_VIDEO_C0_C2_SWAP, > >> + v_VIDEO_AUTO_CSC(AUTO_CSC_DISABLE) | > >> + v_VIDEO_C0_C2_SWAP(C0_C2_CHANGE_DISABLE)); > >> + return 0; > >> + } > >> } > >> } > >> > >> @@ -458,6 +479,9 @@ static int inno_hdmi_setup(struct inno_hdmi *hdmi, > >> else > >> hdmi->hdmi_data.colorimetry = HDMI_COLORIMETRY_ITU_709; > >> > >> + hdmi->hdmi_data.rgb_limited_range = > >> + drm_default_rgb_quant_range(mode) == HDMI_QUANTIZATION_RANGE_LIMITED; > >> + > > This patch conflicts heavily with my inno_hdmi patches here (patches 22 to 38): > > https://lore.kernel.org/dri-devel/20231207-kms-hdmi-connector-state-v5-0-6538e19d634d@kernel.org/ > I'm aware of that and I mentioned it in the cover letter. Your series is > not merged yet and it didn't get much feedback so far. What is the > status there? Especially because you are removing things from inno-hdmi > driver (which aren't really required to remove there) which will I have > to reintroduce. Sadly I haven't found the time to look closer at Maxime's series so far, but I got the impression that it separates into multiple cleanup steps for a number of controllers. So the sentence below suggests that Maxime wanted you to pick the appropriate patches from there and incorporate them into your series (as it looks like you developed a nice working knowledge of the inno-hdmi driver). So there is no need to first drop and then reintroduce stuff, but there may be other interesting cleanups there. > > I would appreciate if you could test and merge them into your series. Heiko > > In particular, there's no need to store the range here: enc_out_format > rgb_limited_range is currently not only used for csc, but also for for > infoframe creation. So it makes sense to have this stored to avoid > calling drm_default_rgb_quant_range twice. > > > is always RGB, so you'll always end up calling > > drm_hdmi_avi_infoframe_quant_range(), and you'll always have the same csc values. > > I don't think that's true. Non-VIC modes like 800x600 or 1024x764 want > full range RGB and csc must not be done in those cases.