> -----Original Message----- > From: Intel-gfx <intel-gfx-boun...@lists.freedesktop.org> On Behalf Of Ankit > Nautiyal > Sent: 18 August 2025 13:01 > To: intel-gfx@lists.freedesktop.org; intel...@lists.freedesktop.org > Cc: ville.syrj...@linux.intel.com; Nautiyal, Ankit K > <ankit.k.nauti...@intel.com> > Subject: [PATCH 11/12] drm/i915/panel: Refactor helper to get highest fixed > mode > > Refactor intel_panel_highest_mode() to return the fixed mode with the > highest pixel clock, removing the fallback to the adjusted mode. This makes > the > function semantics clearer and better suited for future use cases where > fallback is not desirable. > > Update the caller in intel_dp_mode_clock() to handle the NULL case explicitly > by falling back to the adjusted mode's crtc_clock. This also addresses the > existing FIXME comment about ambiguity between clock and crtc_clock, by > using mode->clock for fixed modes and mode->crtc_clock for adjusted modes. > > v2: Avoid introducing a new function and refactor existing one instead. > (Jani). > > Signed-off-by: Ankit Nautiyal <ankit.k.nauti...@intel.com> > --- > drivers/gpu/drm/i915/display/intel_dp.c | 14 +++++++++----- > drivers/gpu/drm/i915/display/intel_panel.c | 11 +++++------ > drivers/gpu/drm/i915/display/intel_panel.h | 3 +-- > 3 files changed, 15 insertions(+), 13 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_dp.c > b/drivers/gpu/drm/i915/display/intel_dp.c > index 0c2bec1fbe42..2fa80b2750f8 100644 > --- a/drivers/gpu/drm/i915/display/intel_dp.c > +++ b/drivers/gpu/drm/i915/display/intel_dp.c > @@ -1759,11 +1759,15 @@ static int intel_dp_mode_clock(const struct > intel_crtc_state *crtc_state, > struct intel_connector *connector = to_intel_connector(conn_state- > >connector); > const struct drm_display_mode *adjusted_mode = &crtc_state- > >hw.adjusted_mode; > > - /* FIXME a bit of a mess wrt clock vs. crtc_clock */ > - if (has_seamless_m_n(connector)) > - return intel_panel_highest_mode(connector, > adjusted_mode)->clock; > - else > - return adjusted_mode->crtc_clock; > + if (has_seamless_m_n(connector)) { > + const struct drm_display_mode *highest_mode; > + > + highest_mode = intel_panel_highest_mode(connector); > + if (highest_mode) > + return highest_mode->clock; > + } > + > + return adjusted_mode->crtc_clock; > } > > /* Optimize link config in order: max bpp, min clock, min lanes */ diff --git > a/drivers/gpu/drm/i915/display/intel_panel.c > b/drivers/gpu/drm/i915/display/intel_panel.c > index 2a20aaaaac39..ac0f04073ecb 100644 > --- a/drivers/gpu/drm/i915/display/intel_panel.c > +++ b/drivers/gpu/drm/i915/display/intel_panel.c > @@ -144,18 +144,17 @@ intel_panel_downclock_mode(struct > intel_connector *connector, } > > const struct drm_display_mode * > -intel_panel_highest_mode(struct intel_connector *connector, > - const struct drm_display_mode *adjusted_mode) > +intel_panel_highest_mode(struct intel_connector *connector) > { > - const struct drm_display_mode *fixed_mode, *best_mode = > adjusted_mode; > + const struct drm_display_mode *fixed_mode, *highest_mode = NULL; > > /* pick the fixed_mode that has the highest clock */ > list_for_each_entry(fixed_mode, &connector->panel.fixed_modes, > head) { > - if (fixed_mode->clock > best_mode->clock) > - best_mode = fixed_mode; > + if (!highest_mode || fixed_mode->clock > highest_mode- > >clock) > + highest_mode = fixed_mode; > } > > - return best_mode; > + return highest_mode; > } > > int intel_panel_get_modes(struct intel_connector *connector) diff --git > a/drivers/gpu/drm/i915/display/intel_panel.h > b/drivers/gpu/drm/i915/display/intel_panel.h > index 56a6412cf0fb..8a17600e46a3 100644 > --- a/drivers/gpu/drm/i915/display/intel_panel.h > +++ b/drivers/gpu/drm/i915/display/intel_panel.h > @@ -37,8 +37,7 @@ const struct drm_display_mode * > intel_panel_downclock_mode(struct intel_connector *connector, > const struct drm_display_mode *adjusted_mode); > const struct drm_display_mode * -intel_panel_highest_mode(struct > intel_connector *connector, > - const struct drm_display_mode *adjusted_mode); > +intel_panel_highest_mode(struct intel_connector *connector); Reviewed-by: Mitul Golani <mitulkumar.ajitkumar.gol...@intel.com> > int intel_panel_get_modes(struct intel_connector *connector); enum > drrs_type intel_panel_drrs_type(struct intel_connector *connector); enum > drm_mode_status > -- > 2.45.2
RE: [PATCH 11/12] drm/i915/panel: Refactor helper to get highest fixed mode
Golani, Mitulkumar Ajitkumar Tue, 19 Aug 2025 02:09:55 -0700
- RE: [PATCH 04/12] drm/i915/display: ... Golani, Mitulkumar Ajitkumar
- [PATCH 06/12] drm/i915/alpm: Add functio... Ankit Nautiyal
- RE: [PATCH 06/12] drm/i915/alpm: Add... Golani, Mitulkumar Ajitkumar
- [PATCH 07/12] drm/i915/vrr: Use vrr.sync... Ankit Nautiyal
- [PATCH 08/12] drm/i915/display: Add guar... Ankit Nautiyal
- RE: [PATCH 08/12] drm/i915/display: ... Golani, Mitulkumar Ajitkumar
- [PATCH 09/12] drm/i915/skl_watermark: Re... Ankit Nautiyal
- [PATCH 10/12] drm/i915/vrr: Use static g... Ankit Nautiyal
- RE: [PATCH 10/12] drm/i915/vrr: Use ... Golani, Mitulkumar Ajitkumar
- [PATCH 11/12] drm/i915/panel: Refactor h... Ankit Nautiyal
- RE: [PATCH 11/12] drm/i915/panel: Re... Golani, Mitulkumar Ajitkumar
- [PATCH 12/12] drm/i915/vrr: Fix seamless... Ankit Nautiyal
- RE: [PATCH 12/12] drm/i915/vrr: Fix ... Golani, Mitulkumar Ajitkumar
- ✓ i915.CI.BAT: success for Optimize vrr.... Patchwork
- ✓ i915.CI.Full: success for Optimize vrr... Patchwork
- [PATCH 00/12] Optimize vrr.guardband and fix ... Ankit Nautiyal
- [PATCH 01/12] drm/i915/skl_watermark: Fi... Ankit Nautiyal
- [PATCH 05/12] drm/i915/dp: Add SDP laten... Ankit Nautiyal
- [PATCH 02/12] drm/i915/skl_watermark: Pa... Ankit Nautiyal
- [PATCH 06/12] drm/i915/alpm: Add functio... Ankit Nautiyal
- [PATCH 04/12] drm/i915/display: Extract ... Ankit Nautiyal