All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/panel: anchor to highest vrefresh fixed mode without a VRR reference
@ 2026-12-02 12:35 cengjianeng
  2026-12-02 12:53 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: cengjianeng @ 2026-12-02 12:35 UTC (permalink / raw)
  To: intel-gfx
  Cc: jani.nikula, rodrigo.vivi, joonas.lahtinen, tursulin, airlied,
	simona, linux-kernel, Jianeng Ceng

From: Jianeng Ceng <cengjianeng@huaqin.corp-partner.google.com>

intel_panel_fixed_mode_vrr() picks the fixed mode whose vrefresh is
closest to the requested one. When the pipe is newly enabled, or when a
seamless update has no compatible reference mode, there is no
vrr_ref_mode to constrain the choice, and the closest-vrefresh pick
happens to select a fixed mode from a different pixel clock family on
panels with non-VRR-compatible fixed modes. The pipe is then anchored on
that lower clock family.

Since VRR can only extend the vblank to lower the effective refresh
rate, a later seamless switch to a higher vrefresh cannot be done from
that anchor: the pixel clock differs, so the switch requires a full
modeset and the panel blinks.

Instead, when there is no vrr_ref_mode, anchor on the highest vrefresh
fixed mode of the requested resolution, so that every lower refresh rate
stays in the same clock family and can be reached by stretching the
vblank. The seamless switch to the higher refresh rate then no longer
needs a full modeset.

Signed-off-by: Jianeng Ceng <cengjianeng@huaqin.corp-partner.google.com>
---
 drivers/gpu/drm/i915/display/intel_panel.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_panel.c b/drivers/gpu/drm/i915/display/intel_panel.c
index 81e638d0c7b3..3a6ed5c5a8d8 100644
--- a/drivers/gpu/drm/i915/display/intel_panel.c
+++ b/drivers/gpu/drm/i915/display/intel_panel.c
@@ -115,6 +115,27 @@ intel_panel_fixed_mode_vrr(struct intel_connector *connector,
 		    !is_vrr_compatible(fixed_mode, vrr_ref_mode))
 			continue;
 
+		/*
+		 * Without a vrr_ref_mode (pipe newly enabled, or a seamless
+		 * update without a compatible reference) always anchor at the
+		 * highest vrefresh mode of the requested resolution. VRR can
+		 * only stretch the vblank down, so picking the closest mode
+		 * would anchor the pipe to a lower clock family, and a
+		 * subsequent seamless switch to a higher vrefresh would need a
+		 * full modeset and blink the panel.
+		 */
+		if (!vrr_ref_mode) {
+			if (fixed_mode->hdisplay != mode->hdisplay ||
+			    fixed_mode->vdisplay != mode->vdisplay)
+				continue;
+
+			if (!best_mode || fixed_mode_vrefresh >
+			    drm_mode_vrefresh(best_mode))
+				best_mode = fixed_mode;
+
+			continue;
+		}
+
 		if (is_best_fixed_mode(connector, vrefresh,
 				       fixed_mode_vrefresh, best_mode))
 			best_mode = fixed_mode;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/i915/panel: anchor to highest vrefresh fixed mode without a VRR reference
  2026-12-02 12:35 [PATCH] drm/i915/panel: anchor to highest vrefresh fixed mode without a VRR reference cengjianeng
@ 2026-12-02 12:53 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-12-02 12:53 UTC (permalink / raw)
  To: cengjianeng, intel-gfx

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] drm/i915/panel: resolution check in
  intel_panel_fixed_mode_vrr() breaks pfit
- [Medium] drm/i915/panel: highest-vrefresh pick in
  intel_panel_fixed_mode_vrr() issues
--

commit d8dd1559a8bbd09428dc3a244bd9e5fd5dc86f8d
Author: Jianeng Ceng <cengjianeng@huaqin.corp-partner.google.com>

drm/i915/panel: anchor to highest vrefresh fixed mode without a VRR reference

This commit updates intel_panel_fixed_mode_vrr() to select the highest
vrefresh fixed mode of the requested resolution when vrr_ref_mode is NULL.

> diff --git a/drivers/gpu/drm/i915/display/intel_panel.c b/drivers/gpu/drm/i915/display/intel_panel.c
> index 81e638d0c7b33..3a6ed5c5a8d8a 100644
> --- a/drivers/gpu/drm/i915/display/intel_panel.c
> +++ b/drivers/gpu/drm/i915/display/intel_panel.c
> @@ -115,6 +115,27 @@ intel_panel_fixed_mode_vrr(struct intel_connector *connector,
>  		    !is_vrr_compatible(fixed_mode, vrr_ref_mode))
>  			continue;
>  
> +		/*
> +		 * Without a vrr_ref_mode (pipe newly enabled, or a seamless
> +		 * update without a compatible reference) always anchor at the
> +		 * highest vrefresh mode of the requested resolution. VRR can
> +		 * only stretch the vblank down, so picking the closest mode
> +		 * would anchor the pipe to a lower clock family, and a
> +		 * subsequent seamless switch to a higher vrefresh would need a
> +		 * full modeset and blink the panel.
> +		 */
> +		if (!vrr_ref_mode) {
> +			if (fixed_mode->hdisplay != mode->hdisplay ||
> +			    fixed_mode->vdisplay != mode->vdisplay)
> +				continue;

[Severity: High]
Won't comparing fixed_mode against mode->hdisplay and mode->vdisplay reject
every entry in connector->panel.fixed_modes when userspace requests a
non-native resolution to be scaled by the panel fitter?

is_alt_fixed_mode() only adds fixed modes matching the preferred mode's
native hdisplay and vdisplay, and intel_panel_compute_config() runs before
intel_pfit_compute_config() to replace the requested mode in adjusted_mode
with a native panel fixed mode.  With this check, any non-native scaled
mode causes intel_panel_fixed_mode_vrr() to return NULL and fall back to
intel_panel_compute_config_fixed_rr(), which fails with -EINVAL whenever
the requested refresh rate is more than 1 Hz away from a fixed mode (and
otherwise picks the closest-vrefresh fixed mode without VRR vtotal
adjustment).

> +
> +			if (!best_mode || fixed_mode_vrefresh >
> +			    drm_mode_vrefresh(best_mode))
> +				best_mode = fixed_mode;
> +
> +			continue;
> +		}

[Severity: Medium]
In intel_panel_compute_config_vrr(), vrr_ref_mode is NULL on every commit
with state->base.allow_modeset == true as well as on the !allow_modeset
fallback.  Does unconditionally picking the highest-vrefresh fixed mode
whenever vrr_ref_mode is NULL cause several unintended regressions?

First, commit 4a2bdf0c87c7 ("drm/i915/panel: Attempt VRR based refresh rate
change for !allow_modeset") kept closest-vrefresh selection when
allow_modeset is true so lower-clock fixed modes can be used to save power;
always anchoring to the highest-vrefresh mode makes lower-clock fixed modes
in the VRR range unreachable, and breaks fastboot takeover if BIOS booted
the panel in a lower-clock fixed mode.

Second, on panels with VRR-compatible fixed modes sharing the same clock,
an allow_modeset=true commit at a lower refresh rate will synthesize vtotal
from the integer vrefresh of the highest-vrefresh mode, whereas a later
allow_modeset=false commit (where vrr_ref_mode is non-NULL) picks the exact
lower-vrefresh EDID fixed mode via is_best_fixed_mode().  When a
!allow_modeset commit has no compatible reference and falls back to
vrr_ref_mode == NULL, switching to a different clock family still fails
intel_pipe_config_compare() and returns -EINVAL.

Third, intel_panel_mode_valid() validates target_clock against
intel_panel_fixed_mode() (closest vrefresh), so intel_panel_fixed_mode_vrr()
can now pick a highest-vrefresh fixed mode whose clock was not validated for
the requested mode and exceeds link or dotclock limits.

Finally, because intel_vrr_compute_guardband() clamps vrr.guardband to
intel_vrr_max_guardband() (which shrinks with a shorter vblank at the
highest refresh rate) and intel_pipe_config_compare() checks vrr.guardband
on fastset, anchoring at the highest-vrefresh fixed mode still requires a
full modeset when switching to the highest refresh rate whenever
vrr.guardband changes.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202123523.1181723-1-cengjianeng@huaqin.corp-partner.google.com?part=1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-02 12:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 12:35 [PATCH] drm/i915/panel: anchor to highest vrefresh fixed mode without a VRR reference cengjianeng
2026-12-02 12:53 ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.