Commit edd27f8e authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Reuse intel_mode_vblank_start()

Replace a few hand rolled copies of intel_mode_vblank_start() with
the real thing.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240528185647.7765-2-ville.syrjala@linux.intel.comReviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
parent b84641c0
...@@ -328,14 +328,10 @@ static int intel_dsb_dewake_scanline(const struct intel_crtc_state *crtc_state) ...@@ -328,14 +328,10 @@ static int intel_dsb_dewake_scanline(const struct intel_crtc_state *crtc_state)
unsigned int latency = skl_watermark_max_latency(i915, 0); unsigned int latency = skl_watermark_max_latency(i915, 0);
int vblank_start; int vblank_start;
if (crtc_state->vrr.enable) { if (crtc_state->vrr.enable)
vblank_start = intel_vrr_vmin_vblank_start(crtc_state); vblank_start = intel_vrr_vmin_vblank_start(crtc_state);
} else { else
vblank_start = adjusted_mode->crtc_vblank_start; vblank_start = intel_mode_vblank_start(adjusted_mode);
if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
vblank_start = DIV_ROUND_UP(vblank_start, 2);
}
return max(0, vblank_start - intel_usecs_to_scanlines(adjusted_mode, latency)); return max(0, vblank_start - intel_usecs_to_scanlines(adjusted_mode, latency));
} }
......
...@@ -89,9 +89,7 @@ u32 i915_get_vblank_counter(struct drm_crtc *crtc) ...@@ -89,9 +89,7 @@ u32 i915_get_vblank_counter(struct drm_crtc *crtc)
htotal = mode->crtc_htotal; htotal = mode->crtc_htotal;
hsync_start = mode->crtc_hsync_start; hsync_start = mode->crtc_hsync_start;
vbl_start = mode->crtc_vblank_start; vbl_start = intel_mode_vblank_start(mode);
if (mode->flags & DRM_MODE_FLAG_INTERLACE)
vbl_start = DIV_ROUND_UP(vbl_start, 2);
/* Convert to pixel count */ /* Convert to pixel count */
vbl_start *= htotal; vbl_start *= htotal;
...@@ -313,11 +311,10 @@ static bool i915_get_crtc_scanoutpos(struct drm_crtc *_crtc, ...@@ -313,11 +311,10 @@ static bool i915_get_crtc_scanoutpos(struct drm_crtc *_crtc,
htotal = mode->crtc_htotal; htotal = mode->crtc_htotal;
hsync_start = mode->crtc_hsync_start; hsync_start = mode->crtc_hsync_start;
vtotal = mode->crtc_vtotal; vtotal = mode->crtc_vtotal;
vbl_start = mode->crtc_vblank_start; vbl_start = intel_mode_vblank_start(mode);
vbl_end = mode->crtc_vblank_end; vbl_end = mode->crtc_vblank_end;
if (mode->flags & DRM_MODE_FLAG_INTERLACE) { if (mode->flags & DRM_MODE_FLAG_INTERLACE) {
vbl_start = DIV_ROUND_UP(vbl_start, 2);
vbl_end /= 2; vbl_end /= 2;
vtotal /= 2; vtotal /= 2;
} }
...@@ -577,7 +574,7 @@ void intel_crtc_update_active_timings(const struct intel_crtc_state *crtc_state, ...@@ -577,7 +574,7 @@ void intel_crtc_update_active_timings(const struct intel_crtc_state *crtc_state,
spin_unlock_irqrestore(&i915->drm.vblank_time_lock, irqflags); spin_unlock_irqrestore(&i915->drm.vblank_time_lock, irqflags);
} }
static int intel_mode_vblank_start(const struct drm_display_mode *mode) int intel_mode_vblank_start(const struct drm_display_mode *mode)
{ {
int vblank_start = mode->crtc_vblank_start; int vblank_start = mode->crtc_vblank_start;
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/types.h> #include <linux/types.h>
struct drm_crtc; struct drm_crtc;
struct drm_display_mode;
struct intel_crtc; struct intel_crtc;
struct intel_crtc_state; struct intel_crtc_state;
...@@ -19,6 +20,8 @@ struct intel_vblank_evade_ctx { ...@@ -19,6 +20,8 @@ struct intel_vblank_evade_ctx {
bool need_vlv_dsi_wa; bool need_vlv_dsi_wa;
}; };
int intel_mode_vblank_start(const struct drm_display_mode *mode);
void intel_vblank_evade_init(const struct intel_crtc_state *old_crtc_state, void intel_vblank_evade_init(const struct intel_crtc_state *old_crtc_state,
const struct intel_crtc_state *new_crtc_state, const struct intel_crtc_state *new_crtc_state,
struct intel_vblank_evade_ctx *evade); struct intel_vblank_evade_ctx *evade);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment