Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5825086rdb; Wed, 13 Dec 2023 23:56:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IFbbOrrBoxEZ1HQ2wFeMz6xD2RdgVscRPBB3dodYjI24Y51otRYuAkS4yH67lVEdsQvoAh3 X-Received: by 2002:a05:6870:a113:b0:203:38e6:62cf with SMTP id m19-20020a056870a11300b0020338e662cfmr1563282oae.89.1702540609683; Wed, 13 Dec 2023 23:56:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702540609; cv=none; d=google.com; s=arc-20160816; b=FF8eGd3HerochlzIOvcuCpqh/8T+K7HMUD2A0SWBcOV+5dNfll8dt0kWfkLASn0ZMr 0eqSHQRDu3232kohi9DwmBxkaPbjtuyV/6xiBlKUEOHs1I9aHRTDcTyDCjHAHFdr9F9s PJFnk5PIFBSVDeU55WpLJASlRfAiUNzOPaFNzFU048sr/nX5ZdcGJgcenCKlOJ1nXCft AigmZJeUaAY8gJ5FBDeGWtXbjRpQePx9xFhFA6W9kAVsidmjkutU055mR6E4EKlHHWhl BXjcDA/LXacxQ8KbjysSuNSowobsPP8aP0kKlqEhCNvEByOmaR7e2Dohv4IjMq9uagtu cb8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=2pPJ4QY/a1xjpQc59oSvZiiZNKGYfBIVue1m2Wg6UVo=; fh=jejk4hcq7/BxBx++uS6mNE2629zToLBrV5YsK7QQT38=; b=JqAumiCO6XS/AcL7R4opJgiQV6dbqr3y1btSiFYM4eFe++pRRiGhwEpQw+SshDspDL U3jk5XanWx6uZy35QUrUCWitNwezqdX/y/lzZ9r/wqDLpAkCasl+7iKLtUZj4iEeMWEm LCDKHLpU8CgiSRw1HYkHO39CGQArBL7g/zqGQ4uoKLX+6TBfLA5PMJH81xCOawQL4nGz JA+VMMFSMA/KK8Ocv4zDH2YuUnBENl36IgvII/hAHRNSQKp6Q8zwS+qzZ1xFPO+sRk6F 7gsDybIe4sOEZTCPdr8mkCGNvze1JjvzKiYV1l/2XcXkfYwkswT9vH4efhUXqf3ccfVp XHwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="uowK/QL/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id s15-20020a63214f000000b005c66af62bacsi10868771pgm.174.2023.12.13.23.56.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 23:56:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="uowK/QL/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id C919A801BFCA; Wed, 13 Dec 2023 23:56:46 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230023AbjLNH42 (ORCPT + 99 others); Thu, 14 Dec 2023 02:56:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229869AbjLNH41 (ORCPT ); Thu, 14 Dec 2023 02:56:27 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C256CB9 for ; Wed, 13 Dec 2023 23:56:33 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD1F3C433C8; Thu, 14 Dec 2023 07:56:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702540593; bh=GYohYaQkBJpAai27f5S7MwTGcNP4zAZuDnDW4xihkPo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uowK/QL/FkkxE5NB64tUf0DVzc4N6MUTuJQF606GCL/VcAsOId9mQ0m4fWxzGfazt qHcm7bIS5x8Dq6UiU57YEPp7O9Iy95cu9z13GwrEoDuNAl/QlMCv0FjABfjopPXQ08 9ctRxUDqO12iD6kYv43QC1FSdDZIkGZVFbFw+Mw7rHYD9af5nrsFvrQuEKz1/9nVN2 bn/sRJhTU0Zik2EzgvH7izTeJOqxFCAPZ+MWXD58NIM/ziiGkf+UAK55tcKj9k3puY IhisxNTQcLRwyQX2UvFgVqNGA4b3HxIuSHlLBR90g2hZpo+cpkBWltHiNdMUkjnSx7 MHTst425A2IQQ== Date: Thu, 14 Dec 2023 08:56:30 +0100 From: Maxime Ripard To: Alex Bee Cc: Sandy Huang , Heiko =?utf-8?Q?St=C3=BCbner?= , 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 Message-ID: References: <20231213195125.212923-1-knaerzche@gmail.com> <20231213195125.212923-5-knaerzche@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="itw4ikaomo7ux2j5" Content-Disposition: inline In-Reply-To: <20231213195125.212923-5-knaerzche@gmail.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Wed, 13 Dec 2023 23:56:46 -0800 (PST) --itw4ikaomo7ux2j5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. >=20 > This enables color space conversion for those modes and sets the > quantization range accordingly in the AVI infoframe. >=20 > 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(-) >=20 > diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockc= hip/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; > }; > =20 > struct inno_hdmi_i2c { > @@ -308,6 +309,18 @@ static int inno_hdmi_config_video_avi(struct inno_hd= mi *hdmi, > else > frame.avi.colorspace =3D HDMI_COLORSPACE_RGB; > =20 > + if (hdmi->hdmi_data.enc_out_format =3D=3D 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 =3D HDMI_QUANTIZATION_RANGE_DEFAULT; > + frame.avi.ycc_quantization_range =3D > + HDMI_YCC_QUANTIZATION_RANGE_LIMITED; > + } > + > return inno_hdmi_upload_frame(hdmi, rc, &frame, INFOFRAME_AVI, 0, 0, 0); > } > =20 > @@ -334,14 +347,22 @@ static int inno_hdmi_config_video_csc(struct inno_h= dmi *hdmi) > if (data->enc_in_format =3D=3D data->enc_out_format) { > if ((data->enc_in_format =3D=3D HDMI_COLORSPACE_RGB) || > (data->enc_in_format >=3D HDMI_COLORSPACE_YUV444)) { > - value =3D 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 =3D=3D HDMI_COLORSPACE_RGB && > + data->enc_out_format =3D=3D HDMI_COLORSPACE_RGB && > + hdmi->hdmi_data.rgb_limited_range) { > + csc_mode =3D CSC_RGB_0_255_TO_RGB_16_235_8BIT; > + auto_csc =3D AUTO_CSC_DISABLE; > + c0_c2_change =3D C0_C2_CHANGE_DISABLE; > + csc_enable =3D v_CSC_ENABLE; > + } else { > + value =3D 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; > + } > } > } > =20 > @@ -458,6 +479,9 @@ static int inno_hdmi_setup(struct inno_hdmi *hdmi, > else > hdmi->hdmi_data.colorimetry =3D HDMI_COLORIMETRY_ITU_709; > =20 > + hdmi->hdmi_data.rgb_limited_range =3D > + drm_default_rgb_quant_range(mode) =3D=3D HDMI_QUANTIZATION_RANGE_LIMIT= ED; > + 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-65= 38e19d634d@kernel.org/ I would appreciate if you could test and merge them into your series. In particular, there's no need to store the range here: enc_out_format is always RGB, so you'll always end up calling drm_hdmi_avi_infoframe_quant_range(), and you'll always have the same csc v= alues. Maxime --itw4ikaomo7ux2j5 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCZXq1LgAKCRDj7w1vZxhR xedRAQCky8rnjv5SW+uCycoYjs8EQF9UmdfoKp6IC/V0MmQyIwD+L0A/RR8/pzVb fQgZ59YS2O+f5TpHQ/8+FtU01s5a3go= =AiiD -----END PGP SIGNATURE----- --itw4ikaomo7ux2j5--