Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp165975lqo; Thu, 16 May 2024 02:37:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWuFTaTpVwjJhUl1NxKExEVyM8V2a6DGjxdpg5dfno3nfCPHd8Y0uF4Lc7UUem1bbF6GdBshbEHzVg8ThEkRPa7cFJ0dGULOw4fDsn3/g== X-Google-Smtp-Source: AGHT+IGjrlA2WWYtnj//F1j30BsEThPDfjKUwd43U69JbvhzyffHBZlLv4QtamzNnm+MTkUhLgxk X-Received: by 2002:a05:6a20:ce4d:b0:1b0:8b2:702a with SMTP id adf61e73a8af0-1b008b27175mr10096090637.51.1715852255137; Thu, 16 May 2024 02:37:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715852255; cv=pass; d=google.com; s=arc-20160816; b=gvBAJuMbOs9r41bLSNn1bmMs6RuOqiZUEGbWsdat+iA1HPYuTwew3Aka797HEKoIB+ JVpFbOhL4JnCrbzqyqB+kIE3Y/75lMOoAb3Ufrb9DYeo1q9ki9es6sDfvBKUoSX/Rs5I TTp5nwAPDspJUQUBkYhDzI3ouwVh4iE2s/Wm/Jl25sI0MrKprDF0XVqs0tvyJG1Vpq5/ AT2bvXMo/QSFP38A/03xFg9wZQ0KSOth292biiktGf8Zm21bF2Zn1UUEJNci5rDh52Y5 lkPeZMxtaJtW1QYi9rvhRsi4pAewRE8EzoGQqRhkxvYmv4sMzdSVasAiLfiDJ25SydT5 P4FA== ARC-Message-Signature: i=2; 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=dKNWBGnGTbZsyKxZvWkehRax8eTAFdQyevqnktE/L18=; fh=6xBozFkbHpBRTNoI1LLd6tlMaTk1U3noKiYxVVg2xyE=; b=onVhCURfCsIdwuaiwl+ZM3+pUASc9c1Sl3utuK1eCQOnPAdAy0HML4Xb/U3Dbl8VFJ j0hFLUhQEy9EZNGozCfthuk+QsHPxMJTMEtlZNQNGQk7OuPn9lcg0wv4f2gpLVfcQL9f NUKy4pYzdhYHyd5L70BmYwnUc2/F3rX5+Nf5Vlx4ps6TVoGKWhaQ4ouvoJ43hTQAthFM mB+dDdFUADdnz89B8CpgXP38MvS/xVk/SkOFW5xT2643K5JQh1F2XzpcZIpX3LAz8+VQ wLmF4OVGjgdt/wjOXIFkdBpNK6Ona7tPbgt4fggJZuhfin9UYz17xMEEyw8BDdelFqxG QZiQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QBKJ+EGR; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-180853-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180853-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2b628a69202si17578491a91.80.2024.05.16.02.37.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 02:37:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-180853-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QBKJ+EGR; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-180853-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180853-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id AE5822822F4 for ; Thu, 16 May 2024 09:36:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DA5C6143874; Thu, 16 May 2024 09:36:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QBKJ+EGR" 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 CF82514374C; Thu, 16 May 2024 09:36:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715852180; cv=none; b=IKqo7b8Rmk0OR32pWwex7gsBbwpokxI06tE3QupVG5zdY5NcX3EMJVYx9EhtUHrTW/KuFP7LKHqD1wnuMznA8OpgTiM6oXr6nBqpTZ1kY5apJNOCgnNTGM59OgHJ6zMKC4YsjqyYmTQ8adFZshEE8F5e248renFiwJa+3dWiYkI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715852180; c=relaxed/simple; bh=DD6VkVQwYr5qx+QtEY3TjdvNx99y2R6fc5bKmJrT/yU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=g4UXSiNbsvx5RZinRosr2sRCd7cTIDBFd9Ijj9+VasB8vcZyRURZOs62QTnHPYrg3xqdAVyS2wpw/EU9yCXNbtCN3KVhDBqaC7qOqSTAiUKRJUKPUtDCZ1jkv79LbR8JWPJ144/iEyHGuBxNm0CDYFCWXr35gb7RCGSooRT0YzI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QBKJ+EGR; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2DFAC32786; Thu, 16 May 2024 09:36:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715852180; bh=DD6VkVQwYr5qx+QtEY3TjdvNx99y2R6fc5bKmJrT/yU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QBKJ+EGRMsSNdlLBhmx53NWlpf+CzZyD6Xltp3lapOO4kKjqkEIyYWYTJ6IgNfD+J dpGkuxqkwdVly4WexTyd0WNIiGgZ93P9AaZVBpOxARuVE03VwQRspXwiSG56EiR3hz dTFlBUMwmy5ZDKI3/+8pcHBnYMLn2JmGwFOS8W95AywbGZdhpupmQzo475khgSIRoo RTrao7VNnZ0ENZondAbSeVjp4MpC5Fd0b3RtR/5A+uJKniHE9J9D0mfpvF3DEckH7O FSPYDwomE7Erk+SMone0rTuL5aHot6mbrHEYsWD/zCSDwyUs/QjZ17V0rlze2utFsC U9B7RXNH6AoOw== Date: Thu, 16 May 2024 11:36:17 +0200 From: Maxime Ripard To: Andy Yan Cc: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Jonathan Corbet , Sandy Huang , Heiko =?utf-8?Q?St=C3=BCbner?= , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Andy Yan , Hans Verkuil , Sebastian Wick , Ville =?utf-8?B?U3lyasOkbMOk?= , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: Re: [PATCH v13 27/28] drm/rockchip: inno_hdmi: Switch to HDMI connector Message-ID: <20240516-romantic-goose-of-fame-ef968f@penduick> References: <20240507-kms-hdmi-connector-state-v13-0-8fafc5efe8be@kernel.org> <20240507-kms-hdmi-connector-state-v13-27-8fafc5efe8be@kernel.org> <2d3073ce.16e2.18f6bec1d61.Coremail.andyshrk@163.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-sha384; protocol="application/pgp-signature"; boundary="uaerwrggzaiekave" Content-Disposition: inline In-Reply-To: <2d3073ce.16e2.18f6bec1d61.Coremail.andyshrk@163.com> --uaerwrggzaiekave Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Andy, On Sun, May 12, 2024 at 04:29:47PM +0800, Andy Yan wrote: > At 2024-05-07 21:17:45, "Maxime Ripard" wrote: > >The new HDMI connector infrastructure allows to remove some boilerplate, > >especially to generate infoframes. Let's switch to it. > > > >Reviewed-by: Heiko Stuebner > >Acked-by: Heiko Stuebner > >Signed-off-by: Maxime Ripard > >--- > > drivers/gpu/drm/rockchip/Kconfig | 3 + > > drivers/gpu/drm/rockchip/inno_hdmi.c | 153 ++++++++++++--------------= ------- > > drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 3 + > > 3 files changed, 61 insertions(+), 98 deletions(-) > > > >diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip= /Kconfig > >index 1bf3e2829cd0..7df875e38517 100644 > >--- a/drivers/gpu/drm/rockchip/Kconfig > >+++ b/drivers/gpu/drm/rockchip/Kconfig > >@@ -72,10 +72,13 @@ config ROCKCHIP_DW_MIPI_DSI > > enable MIPI DSI on RK3288 or RK3399 based SoC, you should > > select this option. > >=20 > > config ROCKCHIP_INNO_HDMI > > bool "Rockchip specific extensions for Innosilicon HDMI" > >+ select DRM_DISPLAY_HDMI_HELPER > >+ select DRM_DISPLAY_HDMI_STATE_HELPER > >+ select DRM_DISPLAY_HELPER > > help > > This selects support for Rockchip SoC specific extensions > > for the Innosilicon HDMI driver. If you want to enable > > HDMI on RK3036 based SoC, you should select this option. > >=20 > >diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rock= chip/inno_hdmi.c > >index 3df2cfcf9998..5069403c3b80 100644 > >--- a/drivers/gpu/drm/rockchip/inno_hdmi.c > >+++ b/drivers/gpu/drm/rockchip/inno_hdmi.c > >@@ -20,10 +20,13 @@ > > #include > > #include > > #include > > #include > >=20 > >+#include > >+#include > >+ > ...... > >=20 > > static int inno_hdmi_config_video_csc(struct inno_hdmi *hdmi) > > { > > struct drm_connector *connector =3D &hdmi->connector; > > struct drm_connector_state *conn_state =3D connector->state; > >@@ -359,12 +323,12 @@ static int inno_hdmi_config_video_csc(struct inno_= hdmi *hdmi) > > value =3D v_VIDEO_INPUT_BITS(VIDEO_INPUT_8BITS) | > > v_VIDEO_OUTPUT_COLOR(0) | > > v_VIDEO_INPUT_CSP(0); > > hdmi_writeb(hdmi, HDMI_VIDEO_CONTRL2, value); > >=20 > >- if (inno_conn_state->enc_out_format =3D=3D HDMI_COLORSPACE_RGB) { > >- if (inno_conn_state->rgb_limited_range) { > >+ if (conn_state->hdmi.output_format =3D=3D HDMI_COLORSPACE_RGB) { > >+ if (conn_state->hdmi.is_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; > >=20 > >@@ -378,18 +342,18 @@ static int inno_hdmi_config_video_csc(struct inno_= hdmi *hdmi) > > v_VIDEO_C0_C2_SWAP(C0_C2_CHANGE_DISABLE)); > > return 0; > > } > > } else { > > if (inno_conn_state->colorimetry =3D=3D HDMI_COLORIMETRY_ITU_601) { > >- if (inno_conn_state->enc_out_format =3D=3D HDMI_COLORSPACE_YUV444) { > >+ if (conn_state->hdmi.output_format =3D=3D HDMI_COLORSPACE_YUV444) { > > csc_mode =3D CSC_RGB_0_255_TO_ITU601_16_235_8BIT; > > auto_csc =3D AUTO_CSC_DISABLE; > > c0_c2_change =3D C0_C2_CHANGE_DISABLE; > > csc_enable =3D v_CSC_ENABLE; > > } > > } else { > >- if (inno_conn_state->enc_out_format =3D=3D HDMI_COLORSPACE_YUV444) { > >+ if (conn_state->hdmi.output_format =3D=3D HDMI_COLORSPACE_YUV444) { > > csc_mode =3D CSC_RGB_0_255_TO_ITU709_16_235_8BIT; > > auto_csc =3D AUTO_CSC_DISABLE; > > c0_c2_change =3D C0_C2_CHANGE_DISABLE; > > csc_enable =3D v_CSC_ENABLE; > > } > >@@ -460,14 +424,16 @@ static int inno_hdmi_config_video_timing(struct in= no_hdmi *hdmi, > >=20 > > return 0; > > } > >=20 > > static int inno_hdmi_setup(struct inno_hdmi *hdmi, > >- struct drm_display_mode *mode) > >+ struct drm_crtc_state *new_crtc_state, > >+ struct drm_connector_state *new_conn_state) > > { > >- struct drm_display_info *display =3D &hdmi->connector.display_info; > >- unsigned long mpixelclock =3D mode->clock * 1000; > >+ struct drm_connector *connector =3D &hdmi->connector; > >+ struct drm_display_info *display =3D &connector->display_info; > >+ struct drm_display_mode *mode =3D &new_crtc_state->adjusted_mode; > >=20 > > /* Mute video and audio output */ > > hdmi_modb(hdmi, HDMI_AV_MUTE, m_AUDIO_MUTE | m_VIDEO_BLACK, > > v_AUDIO_MUTE(1) | v_VIDEO_MUTE(1)); > >=20 > >@@ -477,26 +443,26 @@ static int inno_hdmi_setup(struct inno_hdmi *hdmi, > >=20 > > inno_hdmi_config_video_timing(hdmi, mode); > >=20 > > inno_hdmi_config_video_csc(hdmi); > >=20 > >- if (display->is_hdmi) > >- inno_hdmi_config_video_avi(hdmi, mode); > >+ drm_atomic_helper_connector_hdmi_update_infoframes(connector, > >+ new_conn_state->state); > >=20 >=20 > new_conn_state->state will be set NULL in drm_atomic_helper_swap_state, > so this will cause a NULL pointer reference panic here. That's a good catch, I'll fix it, thanks! Maxime --uaerwrggzaiekave Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iJUEABMJAB0WIQTkHFbLp4ejekA/qfgnX84Zoj2+dgUCZkXTkAAKCRAnX84Zoj2+ drHFAX0WNL3Wj3Fov5y9wmbhRlVOE3cZBO2OqCK8lFoIx3jXXKZebGyaAtxrBPIm NWKddK8BgK5/Qs7oRmknzpUJJMceIrrXhv1HUGmQ9aVTrxk9JlXkqf8DDsZaKwVr nNmDraUwrg== =4TDG -----END PGP SIGNATURE----- --uaerwrggzaiekave--