Skip to content

Commit d4f9a05

Browse files
committed
drm/i915: Introduce intel_scanlines_to_usecs()
Introduce intel_scanlines_to_usecs() as a counterpart to intel_usecs_to_scanlines(). We'll have some use for this in DSB code as we want to do relative scanline waits to evade the delayed vblank, but unfortunately DSB can't do relative scanline waits (only absolute). So we'll instead convert the relative scanline count to usec and do a relative usec wait instead (which the DSB knows how to do). Reviewed-by: Animesh Manna <animesh.manna@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240930170415.23841-9-ville.syrjala@linux.intel.com
1 parent d6dfbc6 commit d4f9a05

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

drivers/gpu/drm/i915/display/intel_crtc.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,17 @@ int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode,
483483
1000 * adjusted_mode->crtc_htotal);
484484
}
485485

486+
int intel_scanlines_to_usecs(const struct drm_display_mode *adjusted_mode,
487+
int scanlines)
488+
{
489+
/* paranoia */
490+
if (!adjusted_mode->crtc_clock)
491+
return 1;
492+
493+
return DIV_ROUND_UP_ULL(mul_u32_u32(scanlines, adjusted_mode->crtc_htotal * 1000),
494+
adjusted_mode->crtc_clock);
495+
}
496+
486497
/**
487498
* intel_pipe_update_start() - start update of a set of display registers
488499
* @state: the atomic state

drivers/gpu/drm/i915/display/intel_crtc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ struct intel_display;
3131

3232
int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode,
3333
int usecs);
34+
int intel_scanlines_to_usecs(const struct drm_display_mode *adjusted_mode,
35+
int scanlines);
3436
void intel_crtc_arm_vblank_event(struct intel_crtc_state *crtc_state);
3537
u32 intel_crtc_max_vblank_count(const struct intel_crtc_state *crtc_state);
3638
int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe);

0 commit comments

Comments
 (0)