Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Suraj Kandpal <suraj.kandpal@intel.com>,
	intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Cc: ankit.k.nautiyal@intel.com, uma.shankar@intel.com,
	chaitanya.kumar.borah@intel.com,
	Suraj Kandpal <suraj.kandpal@intel.com>
Subject: Re: [PATCH 09/15] drm/i915/pipelock: Compute pipelock groups for DP tiled displays
Date: Thu, 26 Nov 2026 10:56:10 +0200	[thread overview]
Message-ID: <a7978ac0dc0b9405d91729e5352b07e79bf7c2d5@intel.com> (raw)
In-Reply-To: <20261126063459.863698-10-suraj.kandpal@intel.com>

On Thu, 26 Nov 2026, Suraj Kandpal <suraj.kandpal@intel.com> wrote:
> Port sync has been off on NVL since it was defeatured, so the tiles of
> a tiled DP display run unsynchronized there. Use pipelock to sync them
> instead.
>
> On top of the port sync checks, pipelock needs the tiles to have the
> same PLL, bpp, set context latency, VRR timings and guardband, and the
> same SDPs. DP to HDMI protocol converters can't be locked, as they
> retime the signal. The timing generator start delay is computed from
> the link M/N ratio, plus the MTP slots left unused for 128b/132b. If
> the delay doesn't fit in a line, fall back to syncing just once, which
> is only allowed when the refresh rate can't change.
>
> Also make sure a CRTC only computes a sync group it's part of, so that
> a tile that can't be locked doesn't end up as a secondary.
>
> Bspec: 68938, 73521
> Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_ddi.c      | 15 ++-
>  drivers/gpu/drm/i915/display/intel_pipelock.c | 91 +++++++++++++++++++
>  drivers/gpu/drm/i915/display/intel_pipelock.h |  6 ++
>  3 files changed, 111 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
> index 54c4f90cdfea..f6352e9ece6e 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -79,6 +79,7 @@
>  #include "intel_modeset_lock.h"
>  #include "intel_panel.h"
>  #include "intel_pfit.h"
> +#include "intel_pipelock.h"
>  #include "intel_pps.h"
>  #include "intel_psr.h"
>  #include "intel_quirks.h"
> @@ -4670,7 +4671,7 @@ intel_ddi_port_sync_transcoders(const struct intel_crtc_state *ref_crtc_state,
>  	 * From, xe3lpd onwards we have defeatured this with reference to
>  	 * Wa_16024710867
>  	 */
> -	if (!IS_DISPLAY_VER(display, 9, 30))
> +	if (!IS_DISPLAY_VER(display, 9, 30) && !HAS_PIPELOCK(display))

Smells like the first one should be HAS_PORT_SYNC(). The above mixture
isn't great.

>  		return 0;
>  
>  	if (!intel_crtc_has_type(ref_crtc_state, INTEL_OUTPUT_DP))
> @@ -4692,9 +4693,18 @@ intel_ddi_port_sync_transcoders(const struct intel_crtc_state *ref_crtc_state,
>  		if (!crtcs_port_sync_compatible(ref_crtc_state,
>  						crtc_state))
>  			continue;
> +
> +		if (HAS_PIPELOCK(display) &&
> +		    (!intel_pipelock_possible(crtc_state, to_intel_connector(connector)) ||
> +		     !intel_pipelock_compatible(ref_crtc_state, crtc_state)))
> +			continue;
> +
>  		transcoders |= BIT(crtc_state->cpu_transcoder);
>  	}
>  
> +	if (!(transcoders & BIT(ref_crtc_state->cpu_transcoder)))
> +		return 0;
> +
>  	return transcoders;

Commenting on existing code like Sashiko, I think "something-plural"
like transcoders is not a great name for a bit mask. Probably the
function and the variable name should be transcoder_mask.

>  }
>  
> @@ -4737,6 +4747,9 @@ static int intel_ddi_compute_config_late(struct intel_atomic_state *state,
>  			~REG_BIT(crtc_state->cpu_transcoder);
>  	}
>  
> +	if (HAS_PIPELOCK(display))
> +		intel_pipelock_compute_config(crtc_state);
> +
>  	return 0;
>  }
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_pipelock.c b/drivers/gpu/drm/i915/display/intel_pipelock.c
> index 67c643b6626c..23b6db074385 100644
> --- a/drivers/gpu/drm/i915/display/intel_pipelock.c
> +++ b/drivers/gpu/drm/i915/display/intel_pipelock.c
> @@ -3,9 +3,20 @@
>   * Copyright © 2026 Intel Corporation
>   */
>  
> +#include <linux/math64.h>
> +
> +#include <drm/display/drm_dp_helper.h>
> +#include <drm/drm_print.h>
> +
>  #include "intel_display_core.h"
>  #include "intel_display_types.h"
> +#include "intel_dp.h"
> +#include "intel_dpll_mgr.h"
>  #include "intel_pipelock.h"
> +#include "intel_vrr.h"
> +
> +#define PIPELOCK_CLOCK_CROSSING_DELAY	8
> +#define MTP_TIME_SLOTS			64
>  
>  bool intel_pipelock_connector_possible(const struct intel_connector *connector)
>  {
> @@ -15,3 +26,83 @@ bool intel_pipelock_connector_possible(const struct intel_connector *connector)
>  		connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort &&
>  		!connector->mst.dp;
>  }
> +
> +static int pipelock_tg_start_delay(const struct intel_crtc_state *crtc_state)
> +{
> +	const struct intel_link_m_n *m_n = &crtc_state->dp_m_n;
> +	int delay = PIPELOCK_CLOCK_CROSSING_DELAY;
> +
> +	delay += DIV_ROUND_UP(m_n->link_n, m_n->link_m);
> +
> +	if (intel_dp_is_uhbr(crtc_state))
> +		delay += MTP_TIME_SLOTS - m_n->tu;
> +
> +	return delay;
> +}
> +
> +static int pipelock_line_time(const struct intel_crtc_state *crtc_state)
> +{
> +	const struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode;
> +	int symbol_clock = intel_dp_link_symbol_clock(crtc_state->port_clock);
> +
> +	return div_u64(mul_u32_u32(adjusted_mode->crtc_htotal, symbol_clock),
> +		       adjusted_mode->crtc_clock);
> +}
> +
> +static bool pipelock_per_frame_sync(const struct intel_crtc_state *crtc_state)
> +{
> +	return pipelock_tg_start_delay(crtc_state) < pipelock_line_time(crtc_state);
> +}
> +
> +bool intel_pipelock_possible(const struct intel_crtc_state *crtc_state,
> +			     struct intel_connector *connector)
> +{
> +	struct intel_display *display = to_intel_display(crtc_state);
> +	struct intel_dp *intel_dp = intel_attached_dp(connector);
> +
> +	if (!intel_pipelock_connector_possible(connector))
> +		return false;
> +
> +	if (drm_dp_is_branch(intel_dp->dpcd) && intel_dp_has_hdmi_sink(intel_dp)) {
> +		drm_dbg_kms(display->drm,
> +			    "[CONNECTOR:%d:%s] No pipelock behind an HDMI converter\n",
> +			    connector->base.base.id, connector->base.name);
> +		return false;
> +	}
> +
> +	if (!pipelock_per_frame_sync(crtc_state) &&
> +	    (!intel_vrr_is_fixed_rr(crtc_state) || crtc_state->vrr.in_range)) {
> +		drm_dbg_kms(display->drm,
> +			    "[CONNECTOR:%d:%s] No pipelock, start delay too long for VRR\n",
> +			    connector->base.base.id, connector->base.name);
> +		return false;
> +	}
> +
> +	return true;
> +}
> +
> +bool intel_pipelock_compatible(const struct intel_crtc_state *crtc_state1,
> +			       const struct intel_crtc_state *crtc_state2)
> +{
> +	struct intel_display *display = to_intel_display(crtc_state1);
> +
> +	return crtc_state1->pipe_bpp == crtc_state2->pipe_bpp &&
> +		crtc_state1->set_context_latency == crtc_state2->set_context_latency &&
> +		crtc_state1->vrr.enable == crtc_state2->vrr.enable &&
> +		crtc_state1->vrr.vmin == crtc_state2->vrr.vmin &&
> +		crtc_state1->vrr.vmax == crtc_state2->vrr.vmax &&
> +		crtc_state1->vrr.flipline == crtc_state2->vrr.flipline &&
> +		crtc_state1->vrr.guardband == crtc_state2->vrr.guardband &&
> +		crtc_state1->infoframes.enable == crtc_state2->infoframes.enable &&
> +		intel_dpll_compare_hw_state(display, &crtc_state1->dpll_hw_state,
> +					    &crtc_state2->dpll_hw_state);
> +}
> +
> +void intel_pipelock_compute_config(struct intel_crtc_state *crtc_state)
> +{
> +	if (crtc_state->sync_primary_transcoder == INVALID_TRANSCODER)
> +		return;
> +
> +	crtc_state->pipelock.tg_start_delay = pipelock_tg_start_delay(crtc_state);
> +	crtc_state->pipelock.per_frame_sync = pipelock_per_frame_sync(crtc_state);
> +}
> diff --git a/drivers/gpu/drm/i915/display/intel_pipelock.h b/drivers/gpu/drm/i915/display/intel_pipelock.h
> index b08b10f8da34..b75efa71a831 100644
> --- a/drivers/gpu/drm/i915/display/intel_pipelock.h
> +++ b/drivers/gpu/drm/i915/display/intel_pipelock.h
> @@ -9,7 +9,13 @@
>  #include <linux/types.h>
>  
>  struct intel_connector;
> +struct intel_crtc_state;
>  
>  bool intel_pipelock_connector_possible(const struct intel_connector *connector);
> +bool intel_pipelock_possible(const struct intel_crtc_state *crtc_state,
> +			     struct intel_connector *connector);
> +bool intel_pipelock_compatible(const struct intel_crtc_state *crtc_state1,
> +			       const struct intel_crtc_state *crtc_state2);
> +void intel_pipelock_compute_config(struct intel_crtc_state *crtc_state);
>  
>  #endif /* __INTEL_PIPELOCK_H__ */

-- 
Jani Nikula, Intel

  reply	other threads:[~2026-11-26  8:59 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  6:34 [PATCH 00/15] drm/i915/display: Sync tiled displays with pipelock Suraj Kandpal
2026-11-26  6:34 ` [PATCH 01/15] drm/i915/display: Rename port sync master/slave to primary/secondary Suraj Kandpal
2026-11-26  6:43   ` sashiko-bot
2026-11-26  6:34 ` [PATCH 02/15] drm/i915/display: Add HAS_PIPELOCK() Suraj Kandpal
2026-11-26  6:34 ` [PATCH 03/15] drm/i915/display: Add pipelock bits to TRANS_DDI_FUNC_CTL2 Suraj Kandpal
2026-11-26  8:45   ` Jani Nikula
2026-11-26  6:34 ` [PATCH 04/15] drm/i915/ddi: Program pipelock in TRANS_DDI_FUNC_CTL2 Suraj Kandpal
2026-11-26  6:34 ` [PATCH 05/15] drm/i915/ddi: Don't hold the DP link in idle with pipelock Suraj Kandpal
2026-11-26  6:34 ` [PATCH 06/15] drm/i915/display: Enable the pipelock primary before its secondaries Suraj Kandpal
2026-11-26  6:34 ` [PATCH 07/15] drm/i915/display: Read out and verify pipelock state Suraj Kandpal
2026-11-26  6:34 ` [PATCH 08/15] drm/i915/pipelock: Keep SSC, PSR and CMRR off on pipelock tiles Suraj Kandpal
2026-11-26  8:52   ` Jani Nikula
2026-11-26  9:14     ` Kandpal, Suraj
2026-11-26  6:34 ` [PATCH 09/15] drm/i915/pipelock: Compute pipelock groups for DP tiled displays Suraj Kandpal
2026-11-26  8:56   ` Jani Nikula [this message]
2026-11-26  9:16     ` Kandpal, Suraj
2026-11-26  6:34 ` [PATCH 10/15] drm/i915/vrr: Split out setting the guardband Suraj Kandpal
2026-11-26  6:44   ` sashiko-bot
2026-11-26  8:58   ` Jani Nikula
2026-11-26  9:17     ` Kandpal, Suraj
2026-11-26  6:34 ` [PATCH 11/15] drm/i915/pipelock: Equalize the guardband across a pipelock group Suraj Kandpal
2026-11-26  6:49   ` sashiko-bot
2026-11-26  6:34 ` [PATCH 12/15] drm/i915/dp: Apply link training fallback to the whole tile group Suraj Kandpal
2026-11-26  7:06   ` sashiko-bot
2026-11-26  6:34 ` [PATCH 13/15] drm/i915/display: Show transcoder sync state in i915_display_info Suraj Kandpal
2026-11-26  6:34 ` [PATCH 14/15] drm/i915/display: Use pipelock on PTL Suraj Kandpal
2026-11-26  6:54   ` sashiko-bot
2026-11-26  6:34 ` [PATCH 15/15] drm/i915/ddi: Disable port sync " Suraj Kandpal
2026-11-26  6:42 ` ✗ CI.checkpatch: warning for drm/i915/display: Sync tiled displays with pipelock Patchwork
2026-11-26  6:45 ` ✓ CI.KUnit: success " Patchwork
2026-11-26  7:26 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-26 12:54 ` ✓ Xe.CI.FULL: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a7978ac0dc0b9405d91729e5352b07e79bf7c2d5@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=ankit.k.nautiyal@intel.com \
    --cc=chaitanya.kumar.borah@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=suraj.kandpal@intel.com \
    --cc=uma.shankar@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox