diff mbox series

[07/12] drm/i915: Relocate is_in_vrr_range()

Message ID 20230901130440.2085-8-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: VRR, LRR, and M/N stuff | expand

Commit Message

Ville Syrjala Sept. 1, 2023, 1:04 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Move is_in_vrr_range() into intel_vrr.c in anticipation of
more users, and rename it accordingly.

Cc: Manasi Navare <navaremanasi@chromium.org>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_panel.c | 17 ++++-------------
 drivers/gpu/drm/i915/display/intel_vrr.c   |  9 +++++++++
 drivers/gpu/drm/i915/display/intel_vrr.h   |  1 +
 3 files changed, 14 insertions(+), 13 deletions(-)

Comments

Manasi Navare Sept. 7, 2023, 6:43 p.m. UTC | #1
Reviewed-by: Manasi Navare <navaremanasi@chromium.org>

Manasi

On Fri, Sep 1, 2023 at 6:05 AM Ville Syrjala
<ville.syrjala@linux.intel.com> wrote:
>
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Move is_in_vrr_range() into intel_vrr.c in anticipation of
> more users, and rename it accordingly.
>
> Cc: Manasi Navare <navaremanasi@chromium.org>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_panel.c | 17 ++++-------------
>  drivers/gpu/drm/i915/display/intel_vrr.c   |  9 +++++++++
>  drivers/gpu/drm/i915/display/intel_vrr.h   |  1 +
>  3 files changed, 14 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_panel.c b/drivers/gpu/drm/i915/display/intel_panel.c
> index 9232a305b1e6..086cb8dbe22c 100644
> --- a/drivers/gpu/drm/i915/display/intel_panel.c
> +++ b/drivers/gpu/drm/i915/display/intel_panel.c
> @@ -59,15 +59,6 @@ intel_panel_preferred_fixed_mode(struct intel_connector *connector)
>                                         struct drm_display_mode, head);
>  }
>
> -static bool is_in_vrr_range(struct intel_connector *connector, int vrefresh)
> -{
> -       const struct drm_display_info *info = &connector->base.display_info;
> -
> -       return intel_vrr_is_capable(connector) &&
> -               vrefresh >= info->monitor_range.min_vfreq &&
> -               vrefresh <= info->monitor_range.max_vfreq;
> -}
> -
>  static bool is_best_fixed_mode(struct intel_connector *connector,
>                                int vrefresh, int fixed_mode_vrefresh,
>                                const struct drm_display_mode *best_mode)
> @@ -81,8 +72,8 @@ static bool is_best_fixed_mode(struct intel_connector *connector,
>          * vrefresh, which we can then reduce to match the requested
>          * vrefresh by extending the vblank length.
>          */
> -       if (is_in_vrr_range(connector, vrefresh) &&
> -           is_in_vrr_range(connector, fixed_mode_vrefresh) &&
> +       if (intel_vrr_is_in_range(connector, vrefresh) &&
> +           intel_vrr_is_in_range(connector, fixed_mode_vrefresh) &&
>             fixed_mode_vrefresh < vrefresh)
>                 return false;
>
> @@ -224,8 +215,8 @@ int intel_panel_compute_config(struct intel_connector *connector,
>          * Assume that we shouldn't muck about with the
>          * timings if they don't land in the VRR range.
>          */
> -       is_vrr = is_in_vrr_range(connector, vrefresh) &&
> -               is_in_vrr_range(connector, fixed_mode_vrefresh);
> +       is_vrr = intel_vrr_is_in_range(connector, vrefresh) &&
> +               intel_vrr_is_in_range(connector, fixed_mode_vrefresh);
>
>         if (!is_vrr) {
>                 /*
> diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c b/drivers/gpu/drm/i915/display/intel_vrr.c
> index 88e4759b538b..6ef782538337 100644
> --- a/drivers/gpu/drm/i915/display/intel_vrr.c
> +++ b/drivers/gpu/drm/i915/display/intel_vrr.c
> @@ -42,6 +42,15 @@ bool intel_vrr_is_capable(struct intel_connector *connector)
>                 info->monitor_range.max_vfreq - info->monitor_range.min_vfreq > 10;
>  }
>
> +bool intel_vrr_is_in_range(struct intel_connector *connector, int vrefresh)
> +{
> +       const struct drm_display_info *info = &connector->base.display_info;
> +
> +       return intel_vrr_is_capable(connector) &&
> +               vrefresh >= info->monitor_range.min_vfreq &&
> +               vrefresh <= info->monitor_range.max_vfreq;
> +}
> +
>  void
>  intel_vrr_check_modeset(struct intel_atomic_state *state)
>  {
> diff --git a/drivers/gpu/drm/i915/display/intel_vrr.h b/drivers/gpu/drm/i915/display/intel_vrr.h
> index de16960c4929..89937858200d 100644
> --- a/drivers/gpu/drm/i915/display/intel_vrr.h
> +++ b/drivers/gpu/drm/i915/display/intel_vrr.h
> @@ -14,6 +14,7 @@ struct intel_connector;
>  struct intel_crtc_state;
>
>  bool intel_vrr_is_capable(struct intel_connector *connector);
> +bool intel_vrr_is_in_range(struct intel_connector *connector, int vrefresh);
>  void intel_vrr_check_modeset(struct intel_atomic_state *state);
>  void intel_vrr_compute_config(struct intel_crtc_state *crtc_state,
>                               struct drm_connector_state *conn_state);
> --
> 2.41.0
>
Golani, Mitulkumar Ajitkumar Sept. 15, 2023, 5:38 a.m. UTC | #2
> -----Original Message-----
> From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Ville
> Syrjala
> Sent: 01 September 2023 18:35
> To: intel-gfx@lists.freedesktop.org
> Subject: [Intel-gfx] [PATCH 07/12] drm/i915: Relocate is_in_vrr_range()
> 
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Move is_in_vrr_range() into intel_vrr.c in anticipation of more users, and
> rename it accordingly.
> 
> Cc: Manasi Navare <navaremanasi@chromium.org>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_panel.c | 17 ++++-------------
>  drivers/gpu/drm/i915/display/intel_vrr.c   |  9 +++++++++
>  drivers/gpu/drm/i915/display/intel_vrr.h   |  1 +
>  3 files changed, 14 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_panel.c
> b/drivers/gpu/drm/i915/display/intel_panel.c
> index 9232a305b1e6..086cb8dbe22c 100644
> --- a/drivers/gpu/drm/i915/display/intel_panel.c
> +++ b/drivers/gpu/drm/i915/display/intel_panel.c
> @@ -59,15 +59,6 @@ intel_panel_preferred_fixed_mode(struct
> intel_connector *connector)
>  					struct drm_display_mode, head);
>  }
> 
> -static bool is_in_vrr_range(struct intel_connector *connector, int vrefresh) -{
> -	const struct drm_display_info *info = &connector-
> >base.display_info;
> -
> -	return intel_vrr_is_capable(connector) &&
> -		vrefresh >= info->monitor_range.min_vfreq &&
> -		vrefresh <= info->monitor_range.max_vfreq;
> -}
> -
>  static bool is_best_fixed_mode(struct intel_connector *connector,
>  			       int vrefresh, int fixed_mode_vrefresh,
>  			       const struct drm_display_mode *best_mode)
> @@ -81,8 +72,8 @@ static bool is_best_fixed_mode(struct intel_connector
> *connector,
>  	 * vrefresh, which we can then reduce to match the requested
>  	 * vrefresh by extending the vblank length.
>  	 */
> -	if (is_in_vrr_range(connector, vrefresh) &&
> -	    is_in_vrr_range(connector, fixed_mode_vrefresh) &&
> +	if (intel_vrr_is_in_range(connector, vrefresh) &&
> +	    intel_vrr_is_in_range(connector, fixed_mode_vrefresh) &&
>  	    fixed_mode_vrefresh < vrefresh)
>  		return false;
> 
> @@ -224,8 +215,8 @@ int intel_panel_compute_config(struct
> intel_connector *connector,
>  	 * Assume that we shouldn't muck about with the
>  	 * timings if they don't land in the VRR range.
>  	 */
> -	is_vrr = is_in_vrr_range(connector, vrefresh) &&
> -		is_in_vrr_range(connector, fixed_mode_vrefresh);
> +	is_vrr = intel_vrr_is_in_range(connector, vrefresh) &&
> +		intel_vrr_is_in_range(connector, fixed_mode_vrefresh);
> 
>  	if (!is_vrr) {
>  		/*
> diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c
> b/drivers/gpu/drm/i915/display/intel_vrr.c
> index 88e4759b538b..6ef782538337 100644
> --- a/drivers/gpu/drm/i915/display/intel_vrr.c
> +++ b/drivers/gpu/drm/i915/display/intel_vrr.c
> @@ -42,6 +42,15 @@ bool intel_vrr_is_capable(struct intel_connector
> *connector)
>  		info->monitor_range.max_vfreq - info-
> >monitor_range.min_vfreq > 10;  }
> 
> +bool intel_vrr_is_in_range(struct intel_connector *connector, int
> +vrefresh) {
> +	const struct drm_display_info *info = &connector-
> >base.display_info;
> +
> +	return intel_vrr_is_capable(connector) &&
> +		vrefresh >= info->monitor_range.min_vfreq &&
> +		vrefresh <= info->monitor_range.max_vfreq; }
> +

Changes LGTM
Reviewed-by: Mitul Golani <mitulkumar.ajitkumar.golani@intel.com>

Regards,
Mitul
>  void
>  intel_vrr_check_modeset(struct intel_atomic_state *state)  { diff --git
> a/drivers/gpu/drm/i915/display/intel_vrr.h
> b/drivers/gpu/drm/i915/display/intel_vrr.h
> index de16960c4929..89937858200d 100644
> --- a/drivers/gpu/drm/i915/display/intel_vrr.h
> +++ b/drivers/gpu/drm/i915/display/intel_vrr.h
> @@ -14,6 +14,7 @@ struct intel_connector;  struct intel_crtc_state;
> 
>  bool intel_vrr_is_capable(struct intel_connector *connector);
> +bool intel_vrr_is_in_range(struct intel_connector *connector, int
> +vrefresh);
>  void intel_vrr_check_modeset(struct intel_atomic_state *state);  void
> intel_vrr_compute_config(struct intel_crtc_state *crtc_state,
>  			      struct drm_connector_state *conn_state);
> --
> 2.41.0
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_panel.c b/drivers/gpu/drm/i915/display/intel_panel.c
index 9232a305b1e6..086cb8dbe22c 100644
--- a/drivers/gpu/drm/i915/display/intel_panel.c
+++ b/drivers/gpu/drm/i915/display/intel_panel.c
@@ -59,15 +59,6 @@  intel_panel_preferred_fixed_mode(struct intel_connector *connector)
 					struct drm_display_mode, head);
 }
 
-static bool is_in_vrr_range(struct intel_connector *connector, int vrefresh)
-{
-	const struct drm_display_info *info = &connector->base.display_info;
-
-	return intel_vrr_is_capable(connector) &&
-		vrefresh >= info->monitor_range.min_vfreq &&
-		vrefresh <= info->monitor_range.max_vfreq;
-}
-
 static bool is_best_fixed_mode(struct intel_connector *connector,
 			       int vrefresh, int fixed_mode_vrefresh,
 			       const struct drm_display_mode *best_mode)
@@ -81,8 +72,8 @@  static bool is_best_fixed_mode(struct intel_connector *connector,
 	 * vrefresh, which we can then reduce to match the requested
 	 * vrefresh by extending the vblank length.
 	 */
-	if (is_in_vrr_range(connector, vrefresh) &&
-	    is_in_vrr_range(connector, fixed_mode_vrefresh) &&
+	if (intel_vrr_is_in_range(connector, vrefresh) &&
+	    intel_vrr_is_in_range(connector, fixed_mode_vrefresh) &&
 	    fixed_mode_vrefresh < vrefresh)
 		return false;
 
@@ -224,8 +215,8 @@  int intel_panel_compute_config(struct intel_connector *connector,
 	 * Assume that we shouldn't muck about with the
 	 * timings if they don't land in the VRR range.
 	 */
-	is_vrr = is_in_vrr_range(connector, vrefresh) &&
-		is_in_vrr_range(connector, fixed_mode_vrefresh);
+	is_vrr = intel_vrr_is_in_range(connector, vrefresh) &&
+		intel_vrr_is_in_range(connector, fixed_mode_vrefresh);
 
 	if (!is_vrr) {
 		/*
diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c b/drivers/gpu/drm/i915/display/intel_vrr.c
index 88e4759b538b..6ef782538337 100644
--- a/drivers/gpu/drm/i915/display/intel_vrr.c
+++ b/drivers/gpu/drm/i915/display/intel_vrr.c
@@ -42,6 +42,15 @@  bool intel_vrr_is_capable(struct intel_connector *connector)
 		info->monitor_range.max_vfreq - info->monitor_range.min_vfreq > 10;
 }
 
+bool intel_vrr_is_in_range(struct intel_connector *connector, int vrefresh)
+{
+	const struct drm_display_info *info = &connector->base.display_info;
+
+	return intel_vrr_is_capable(connector) &&
+		vrefresh >= info->monitor_range.min_vfreq &&
+		vrefresh <= info->monitor_range.max_vfreq;
+}
+
 void
 intel_vrr_check_modeset(struct intel_atomic_state *state)
 {
diff --git a/drivers/gpu/drm/i915/display/intel_vrr.h b/drivers/gpu/drm/i915/display/intel_vrr.h
index de16960c4929..89937858200d 100644
--- a/drivers/gpu/drm/i915/display/intel_vrr.h
+++ b/drivers/gpu/drm/i915/display/intel_vrr.h
@@ -14,6 +14,7 @@  struct intel_connector;
 struct intel_crtc_state;
 
 bool intel_vrr_is_capable(struct intel_connector *connector);
+bool intel_vrr_is_in_range(struct intel_connector *connector, int vrefresh);
 void intel_vrr_check_modeset(struct intel_atomic_state *state);
 void intel_vrr_compute_config(struct intel_crtc_state *crtc_state,
 			      struct drm_connector_state *conn_state);