diff mbox series

[08/12] drm/i915: Validate that the timings are within the VRR range

Message ID 20230901130440.2085-9-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>

Let's assume there are some crazy displays where the high
end of the VRR range ends up being lower than the refresh
rate as determined by the actual timings. In that case
when we toggle VRR on/off we would step outside the VRR
range when toggling VRR on/off. Let's just make sure that
never happens by not using VRR in such cases. If the user
really wants VRR they should then select the timings to
land within the VRR range.

Cc: Manasi Navare <navaremanasi@chromium.org>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_vrr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Manasi Navare Sept. 7, 2023, 6:44 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>
>
> Let's assume there are some crazy displays where the high
> end of the VRR range ends up being lower than the refresh
> rate as determined by the actual timings. In that case
> when we toggle VRR on/off we would step outside the VRR
> range when toggling VRR on/off. Let's just make sure that
> never happens by not using VRR in such cases. If the user
> really wants VRR they should then select the timings to
> land within the VRR range.
>
> Cc: Manasi Navare <navaremanasi@chromium.org>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_vrr.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c b/drivers/gpu/drm/i915/display/intel_vrr.c
> index 6ef782538337..12731ad725a8 100644
> --- a/drivers/gpu/drm/i915/display/intel_vrr.c
> +++ b/drivers/gpu/drm/i915/display/intel_vrr.c
> @@ -117,10 +117,10 @@ intel_vrr_compute_config(struct intel_crtc_state *crtc_state,
>         const struct drm_display_info *info = &connector->base.display_info;
>         int vmin, vmax;
>
> -       if (!intel_vrr_is_capable(connector))
> +       if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
>                 return;
>
> -       if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
> +       if (!intel_vrr_is_in_range(connector, drm_mode_vrefresh(adjusted_mode)))
>                 return;
>
>         vmin = DIV_ROUND_UP(adjusted_mode->crtc_clock * 1000,
> --
> 2.41.0
>
Golani, Mitulkumar Ajitkumar Sept. 15, 2023, 5:39 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 08/12] drm/i915: Validate that the timings are
> within the VRR range
> 
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Let's assume there are some crazy displays where the high end of the VRR
> range ends up being lower than the refresh rate as determined by the actual
> timings. In that case when we toggle VRR on/off we would step outside the
> VRR range when toggling VRR on/off. Let's just make sure that never happens
> by not using VRR in such cases. If the user really wants VRR they should then
> select the timings to land within the VRR range.
> 
> Cc: Manasi Navare <navaremanasi@chromium.org>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_vrr.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c
> b/drivers/gpu/drm/i915/display/intel_vrr.c
> index 6ef782538337..12731ad725a8 100644
> --- a/drivers/gpu/drm/i915/display/intel_vrr.c
> +++ b/drivers/gpu/drm/i915/display/intel_vrr.c
> @@ -117,10 +117,10 @@ intel_vrr_compute_config(struct intel_crtc_state
> *crtc_state,
>  	const struct drm_display_info *info = &connector-
> >base.display_info;
>  	int vmin, vmax;
> 
> -	if (!intel_vrr_is_capable(connector))
> +	if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
>  		return;
> 
> -	if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
> +	if (!intel_vrr_is_in_range(connector,
> +drm_mode_vrefresh(adjusted_mode)))

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

Regards,
Mitul
>  		return;
> 
>  	vmin = DIV_ROUND_UP(adjusted_mode->crtc_clock * 1000,
> --
> 2.41.0
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c b/drivers/gpu/drm/i915/display/intel_vrr.c
index 6ef782538337..12731ad725a8 100644
--- a/drivers/gpu/drm/i915/display/intel_vrr.c
+++ b/drivers/gpu/drm/i915/display/intel_vrr.c
@@ -117,10 +117,10 @@  intel_vrr_compute_config(struct intel_crtc_state *crtc_state,
 	const struct drm_display_info *info = &connector->base.display_info;
 	int vmin, vmax;
 
-	if (!intel_vrr_is_capable(connector))
+	if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
 		return;
 
-	if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
+	if (!intel_vrr_is_in_range(connector, drm_mode_vrefresh(adjusted_mode)))
 		return;
 
 	vmin = DIV_ROUND_UP(adjusted_mode->crtc_clock * 1000,