From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (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 C3C54190477 for ; Tue, 22 Jul 2025 06:16:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753164997; cv=none; b=h8AsFpj6zVng9vy8jclpyBgE17tmSukMU6cWoDojcgow5vpsLB/huSB5Picao4hjCVm7tjzNYZ0A+RWtpO1Cxkh4HFudzHw587YeadS9bgQ/xtLWt/QvMvLglRmdgYsSeB297uSGKuLZDZDuxstBQuLnRXJaPH60qEr+7OuHSt0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753164997; c=relaxed/simple; bh=hQmYNw1nxxnjx5AEwNuBdEzfygugW6y3m3bQETQLK1A=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=dRre388f4yBEXhXpSHUWapJmZpGi3iHm2WV3IM5zfHu5pRqEJ/EONOw7GiRBnN0JPRv4q0ZcmuGfU22HjOQ/Bh/4591F99KIWlgYOg+tnSoYoBXU81Zy4ay1ddwdT0wr3/ZKR0A9vSjLXMhuMpOx0QnZ9cR3yU7TlBwDevmCb2Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=oNLRZH83; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="oNLRZH83" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1753164987; bh=hQmYNw1nxxnjx5AEwNuBdEzfygugW6y3m3bQETQLK1A=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=oNLRZH830rm/on4tkN3zXpzMq0pa4V7HFVCHhV+cb5mNxE5g84KOmLHpDLkzEroQX +olYVd9AZj6OIj+GO5ETwk/R34sIhslu+G57OM03t1nOL4FIYTKo0UxIrVh4PrxeT8 5426rc6mK3G1PE+4HLHi5RLL7W9+LKjuSxWeBWpYZsIRJ6o1sP0o1po2+55EhCfpro ymeA9lxg/w4n9gglwocZs6bqKz+dY7pk4cukbRtX5cQnycKHinZEvr+JqbAqXJnaQ2 tQY9xoK//oO9DHgu9nonm6PRg2fCxhuGqKiBG9Lwsgi/Q7WnXyCHD31Mn/fkFxi017 bkSfPZ1/PoXvg== Received: from [192.168.1.90] (unknown [82.79.138.60]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by bali.collaboradmins.com (Postfix) with ESMTPSA id BB2AC17E0F66; Tue, 22 Jul 2025 08:16:26 +0200 (CEST) Message-ID: Date: Tue, 22 Jul 2025 09:16:26 +0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/5] drm/rockchip: vop2: Add high color depth support To: Andy Yan , Algea Cao Cc: Sandy Huang , =?UTF-8?Q?Heiko_St=C3=BCbner?= , Andy Yan , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , kernel@collabora.com, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org References: <20250721-rk3588-10bpc-v1-0-e95a4abcf482@collabora.com> <20250721-rk3588-10bpc-v1-1-e95a4abcf482@collabora.com> <3ceb2c70.2145.1982ff28b9c.Coremail.andyshrk@163.com> Content-Language: en-US From: Cristian Ciocaltea In-Reply-To: <3ceb2c70.2145.1982ff28b9c.Coremail.andyshrk@163.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi Andy, On 7/22/25 5:24 AM, Andy Yan wrote: > > Hello Cristian, > > At 2025-07-22 01:39:04, "Cristian Ciocaltea" wrote: >> Take the bits per color channel into consideration when computing DCLK >> rate. >> >> Signed-off-by: Cristian Ciocaltea >> --- >> drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c >> index 186f6452a7d359f079662bc580850929632ea8fe..a714bcbb02de16267e7febbaeb1eb270c70aaef2 100644 >> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c >> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c >> @@ -1731,6 +1731,9 @@ static void vop2_crtc_atomic_enable(struct drm_crtc *crtc, >> clock *= 2; >> } >> >> + if (vcstate->output_bpc > 8) >> + clock = DIV_ROUND_CLOSEST(clock * vcstate->output_bpc, 8); > > > This seems not right, regardless of the value of bpc, the dclk of VOP must be > consistent with mode->crtc_clock. > If the dclk of VOP is increased in accordance with the BPC ratio here, then the refresh rate of VOP will also increase proportionally. > This would be inconsistent with the timing described in the mode. > For a hight color depth, the frequency needs to be increased for the HDMI PHY's clock. The HDMI PHY's clock is actually computed at HDMI connector framework level [1], taking into account the current bpc value, which is determined as part of hdmi_compute_config() [2]. That means conn_state->hdmi.tmds_char_rate in dw_hdmi_qp_rockchip_encoder_atomic_check() does already include the bpc related adjustment, and we pass that directly to the PHY via phy_configure(). Note there's still the need to handle bpc separately via phy_configure_opts in order to setup CMN_REG(0086) [3]. Since VOP2 switches to PHY PLL as DCLK source for modes up to 4K@60Hz, it needs to take color depth into account, to keep them in sync. As a matter of fact, the clock adjustment in VOP2 is mainly necessary for legacy reasons, since HDPTX PHY allowed changing TMDS char rate via the Common Clock Framework API. We landed a proper solution for that via the HDMI PHY API, hence the plan would be to make CCF API readonly after the switch to PHY API is completed, which means VOP2 shouldn't deal anymore with clock calculations when using the PHY PLL as DCLK source. Regardless, I should probably move this clock adjustment to the conditional block handling DCLK source switch. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/display/drm_hdmi_state_helper.c?h=v6.16-rc7#n525 [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/display/drm_hdmi_state_helper.c?h=v6.16-rc7#n608 [3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c?h=v6.16-rc7#n1034