[Intel-gfx] [PATCH v2 16/19] drm/i915: Introudce intel_crtc_scanline_to_hw()

Shankar, Uma uma.shankar at intel.com
Wed Sep 13 17:37:12 UTC 2023



> -----Original Message-----
> From: Intel-gfx <intel-gfx-bounces at lists.freedesktop.org> On Behalf Of Ville
> Syrjala
> Sent: Wednesday, June 7, 2023 12:45 AM
> To: intel-gfx at lists.freedesktop.org
> Subject: [Intel-gfx] [PATCH v2 16/19] drm/i915: Introudce
> intel_crtc_scanline_to_hw()

Typo in introduce

With this fixed, this is:
Reviewed-by: Uma Shankar <uma.shankar at intel.com>

> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 
> Add a helper to convert our idea of a scanline to the hw's idea of the same
> scanline (ie. apply crtc->scanline_offset in reverse).
> We'll need this to tell the DSB do stuff on a specific scanline.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_vblank.c | 14 ++++++++++++++
> drivers/gpu/drm/i915/display/intel_vblank.h |  1 +
>  2 files changed, 15 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_vblank.c
> b/drivers/gpu/drm/i915/display/intel_vblank.c
> index f5659ebd08eb..2cec2abf9746 100644
> --- a/drivers/gpu/drm/i915/display/intel_vblank.c
> +++ b/drivers/gpu/drm/i915/display/intel_vblank.c
> @@ -251,6 +251,20 @@ static int __intel_get_crtc_scanline(struct intel_crtc
> *crtc)
>  	return (position + crtc->scanline_offset) % vtotal;  }
> 
> +int intel_crtc_scanline_to_hw(struct intel_crtc *crtc, int scanline) {
> +	const struct drm_vblank_crtc *vblank =
> +		&crtc->base.dev->vblank[drm_crtc_index(&crtc->base)];
> +	const struct drm_display_mode *mode = &vblank->hwmode;
> +	int vtotal;
> +
> +	vtotal = mode->crtc_vtotal;
> +	if (mode->flags & DRM_MODE_FLAG_INTERLACE)
> +		vtotal /= 2;
> +
> +	return (scanline + vtotal - crtc->scanline_offset) % vtotal; }
> +
>  static bool i915_get_crtc_scanoutpos(struct drm_crtc *_crtc,
>  				     bool in_vblank_irq,
>  				     int *vpos, int *hpos,
> diff --git a/drivers/gpu/drm/i915/display/intel_vblank.h
> b/drivers/gpu/drm/i915/display/intel_vblank.h
> index 08e706b29149..17636f140c71 100644
> --- a/drivers/gpu/drm/i915/display/intel_vblank.h
> +++ b/drivers/gpu/drm/i915/display/intel_vblank.h
> @@ -22,5 +22,6 @@ void intel_wait_for_pipe_scanline_stopped(struct intel_crtc
> *crtc);  void intel_wait_for_pipe_scanline_moving(struct intel_crtc *crtc);  void
> intel_crtc_update_active_timings(const struct intel_crtc_state *crtc_state,
>  				      bool vrr_enable);
> +int intel_crtc_scanline_to_hw(struct intel_crtc *crtc, int scanline);
> 
>  #endif /* __INTEL_VBLANK_H__ */
> --
> 2.39.3



More information about the Intel-gfx mailing list