Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6634181rdb; Fri, 15 Dec 2023 04:28:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IEwzoXhgCvaJcGeLjqIzdThyQPU6lr8LKBkU8CRlNvTMnfIsJK2OQbRHms6P1vA+53KIYpl X-Received: by 2002:a2e:ab18:0:b0:2cc:1f8d:6a3b with SMTP id ce24-20020a2eab18000000b002cc1f8d6a3bmr6428948ljb.105.1702643301448; Fri, 15 Dec 2023 04:28:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702643301; cv=none; d=google.com; s=arc-20160816; b=AdvoBNKg0yLPrQZPm8fP4kVwmtBR0rhOTzkZQEKnaEmIicuVCmJeLxpRzCgowlyPZl UVvibZMl1NwWuaKJ4P+wL294AjooEdUOfpOQffLKF27hBV8xDgs77jsEk5SyNbEi+Bfe a2iSg8x7FAWfQ5enx2tsFTSkOaBqOoY3KSErfyPcXIKF6Eb2SQEvvgMywSDJrJrtoxpg rKuefD4dLoMdTOZ3B8ti34TtVZiZIzJvYmKIdDDgQkJ2MRxOKxdQtuix0dN4Zh7P4e4L arKLo5r7tC8sYWYaWwj3pi9J/Js94M9TdOQyaqxzdFvycro+oCZZzQhSy+h5V7wg/4Z+ AfCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=PeTxE7/QZUydFY8jR1QJOUIhgT3uqY4sqsym+Jq/SaM=; fh=jejk4hcq7/BxBx++uS6mNE2629zToLBrV5YsK7QQT38=; b=PXGROTlM/s+e8gGblxCvV2IM7T8KD3ZBfpVyKA3BTJW2Vp9bUfiNspvK/5dFxUuJv1 chr+wlfab4Uppky+H2qvEWVoGicKqH3oNhdBR5HOsbaRHTglbEbJtjDo0YQMMxPpmwp1 eXygHfGJLTfAzdmYaG8a5i9tEJ5mw86NUQOlpt6eBjDrkpHH9lGYQm24sNg6VCLVw67Z 9hAHBgudyzwNn095QVVYvyDiMPxWkjmwm7VXSLnhismcyGjk2PoYAq96Xd/IHNRjKeFa iPBw7U52wEG9chmOf+V9BCzNegdlapDJMecVSR2debdWHjrn1Ux2XJlktraSZTp+v1Dq VsgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PiwGHTRv; spf=pass (google.com: domain of linux-kernel+bounces-920-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-920-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 21-20020a508e55000000b0054f4ed7a062si6882748edx.229.2023.12.15.04.28.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 04:28:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-920-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PiwGHTRv; spf=pass (google.com: domain of linux-kernel+bounces-920-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-920-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 09DDC1F239DF for ; Fri, 15 Dec 2023 12:28:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EAED82CCBB; Fri, 15 Dec 2023 12:28:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PiwGHTRv" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C2DA2DB67; Fri, 15 Dec 2023 12:27:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0943C433C7; Fri, 15 Dec 2023 12:27:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702643279; bh=XL7UNfsn2kuSB96q0vIEaREs6aL8WgM5vLyKDuXKvzM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PiwGHTRvZ/t8BhaUy1enbsGWQCN6OfAerSHFHZA7Lg+WyvAWXPDfzbApoCtswfAHF 7wVfoqFToRbpqXIm1K1adb7V0y1aSFlnpG5sycflR6dok9uRzmsPUxnkqau+0fvWEY 3azOXp1/uAUwL1h4j4GEzoBthdCuKpB8phy5k0vsdi3PjRPS+j2sy1zr1mziUeTbMu F8kNGivexxCGEJaWS2nRmvn/JvmQX0u2V7etJh64pAV8M6jmaMW7zHTa5OdxJE4hKS v8l71PU1vboe1WXEh4HLpV6IAaAMuXWd+JTwfWebkA5NRWpzh0kLW5YH67gfMxNinR aVTIaTukcUyzQ== Date: Fri, 15 Dec 2023 13:27:56 +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: <76qlgx4astzjjt37eg6ee3ijslm6hvilcgs5yujhqdr7itp4hw@ugtglocx7lq6> References: <20231213195125.212923-1-knaerzche@gmail.com> <20231213195125.212923-5-knaerzche@gmail.com> <5f4fc919-681f-44ec-bd44-5788e5b718ca@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="aisb4vscal23dfnf" Content-Disposition: inline In-Reply-To: --aisb4vscal23dfnf Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 14, 2023 at 03:05:59PM +0100, Alex Bee wrote: >=20 > Am 14.12.23 um 12:33 schrieb Maxime Ripard: > > On Thu, Dec 14, 2023 at 12:12:08PM +0100, Alex Bee wrote: > > > Hi Maxime > > >=20 > > > Am 14.12.23 um 08:56 schrieb Maxime Ripard: > > > > Hi Alex, > > > >=20 > > > > Thanks for working on this! > > > >=20 > > > > 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 li= mited > > > > > range RGB. This is especially required for HDMI sinks which do no= t 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 su= pport") > > > > > 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/d= rm/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 =3D HDMI_COLORSPACE_RGB; > > > > > + 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_DEFAU= LT; > > > > > + frame.avi.ycc_quantization_range =3D > > > > > + 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(struc= t inno_hdmi *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; > > > > > + } > > > > > } > > > > > } > > > > > @@ -458,6 +479,9 @@ static int inno_hdmi_setup(struct inno_hdmi *= hdmi, > > > > > else > > > > > hdmi->hdmi_data.colorimetry =3D HDMI_COLORIMETRY_ITU_709; > > > > > + hdmi->hdmi_data.rgb_limited_range =3D > > > > > + drm_default_rgb_quant_range(mode) =3D=3D HDMI_QUANTIZATION_RAN= GE_LIMITED; > > > > > + > > > > This patch conflicts heavily with my inno_hdmi patches here (patche= s 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. > > Sorry, I missed that part. > >=20 > > > Your series is not merged yet and it didn't get much feedback so far. > > > What is the status there? > > It didn't have much reviews, but I'll hope to change that. For the > > patches 22 to 38 though, it doesn't really matter. Those changes are > > self-contained and can be applied as is outside of the series. > >=20 > > > Especially because you are removing things from inno-hdmi driver (whi= ch > > > aren't really required to remove there) which will I have to reintrod= uce. > > I'm not entirely sure which part I remove that are actually going to be > > used here. > > I'm refering to [PATCH v5 33/44] which completly removes csc coeffs but t= his > series needs the CSC_RGB_0_255_TO_RGB_16_235_8BIT=A0 coeffs and=A0 [PATCH= v5 > 29/44] which removes writing csc_coeffs to the hardware. Oh, right, feel free to drop those Maxime --aisb4vscal23dfnf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCZXxGTAAKCRDj7w1vZxhR xRLuAQD+nf25Iur4/irNxk+q/jw/ADiwGq9Cr1/ujifale8RzQD+MxLFGEsYSrYS a3s+GC54/U3PIPfijzQD0+MBZkjOYgs= =WsiQ -----END PGP SIGNATURE----- --aisb4vscal23dfnf--