diff mbox series

[06/14] drm/i915/dsb: Fix dewake scanline

Message ID 20240624191032.27333-7-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/dsb: Use chained DSBs for LUT programming | expand

Commit Message

Ville Syrjala June 24, 2024, 7:10 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Currently we calculate the DEwake scanline based on
the delayed vblank start, while in reality it should be computed
based on the undelayed vblank start (as that is where the DSB
actually starts). Currently it doesn't really matter as we
don't have any vblank delay configured, but that may change
in the future so let's be accurate in what we do.

We can also remove the max() as intel_crtc_scanline_to_hw()
can deal with negative numbers, which there really shouldn't
be anyway.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_dsb.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

Comments

Manna, Animesh July 3, 2024, 5:59 a.m. UTC | #1
> -----Original Message-----
> From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Ville
> Syrjala
> Sent: Tuesday, June 25, 2024 12:40 AM
> To: intel-gfx@lists.freedesktop.org
> Subject: [PATCH 06/14] drm/i915/dsb: Fix dewake scanline
> 
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Currently we calculate the DEwake scanline based on the delayed vblank
> start, while in reality it should be computed based on the undelayed vblank
> start (as that is where the DSB actually starts). Currently it doesn't really
> matter as we don't have any vblank delay configured, but that may change in
> the future so let's be accurate in what we do.
> 
> We can also remove the max() as intel_crtc_scanline_to_hw() can deal with
> negative numbers, which there really shouldn't be anyway.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Animesh Manna <animesh.manna@intel.com>
 
> ---
>  drivers/gpu/drm/i915/display/intel_dsb.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dsb.c
> b/drivers/gpu/drm/i915/display/intel_dsb.c
> index d3e5e5263603..e871af5517b5 100644
> --- a/drivers/gpu/drm/i915/display/intel_dsb.c
> +++ b/drivers/gpu/drm/i915/display/intel_dsb.c
> @@ -86,16 +86,10 @@ struct intel_dsb {
>  static int dsb_dewake_scanline(const struct intel_crtc_state *crtc_state)  {
>  	struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev);
> -	const struct drm_display_mode *adjusted_mode = &crtc_state-
> >hw.adjusted_mode;
>  	unsigned int latency = skl_watermark_max_latency(i915, 0);
> -	int vblank_start;
> 
> -	if (crtc_state->vrr.enable)
> -		vblank_start = intel_vrr_vmin_vblank_start(crtc_state);
> -	else
> -		vblank_start = intel_mode_vblank_start(adjusted_mode);
> -
> -	return max(0, vblank_start -
> intel_usecs_to_scanlines(adjusted_mode, latency));
> +	return intel_mode_vdisplay(&crtc_state->hw.adjusted_mode) -
> +		intel_usecs_to_scanlines(&crtc_state->hw.adjusted_mode,
> latency);
>  }
> 
>  static u32 dsb_chicken(struct intel_crtc *crtc)
> --
> 2.44.2
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_dsb.c b/drivers/gpu/drm/i915/display/intel_dsb.c
index d3e5e5263603..e871af5517b5 100644
--- a/drivers/gpu/drm/i915/display/intel_dsb.c
+++ b/drivers/gpu/drm/i915/display/intel_dsb.c
@@ -86,16 +86,10 @@  struct intel_dsb {
 static int dsb_dewake_scanline(const struct intel_crtc_state *crtc_state)
 {
 	struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev);
-	const struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode;
 	unsigned int latency = skl_watermark_max_latency(i915, 0);
-	int vblank_start;
 
-	if (crtc_state->vrr.enable)
-		vblank_start = intel_vrr_vmin_vblank_start(crtc_state);
-	else
-		vblank_start = intel_mode_vblank_start(adjusted_mode);
-
-	return max(0, vblank_start - intel_usecs_to_scanlines(adjusted_mode, latency));
+	return intel_mode_vdisplay(&crtc_state->hw.adjusted_mode) -
+		intel_usecs_to_scanlines(&crtc_state->hw.adjusted_mode, latency);
 }
 
 static u32 dsb_chicken(struct intel_crtc *crtc)