Skip to content

Commit 51df92c

Browse files
vsyrjalalutzbichler
authored andcommitted
drm/i915: Extract intel_crtc_active_timings()
Declutter intel_crtc_update_active_timings() a bit by moving the code that determines the timings into a separate function. Signed-off-by: Ville Syrjälä <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Ankit Nautiyal <[email protected]>
1 parent 6b1cd15 commit 51df92c

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

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

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,23 @@ void intel_wait_for_pipe_scanline_moving(struct intel_crtc *crtc)
501501
wait_for_pipe_scanline_moving(crtc, true);
502502
}
503503

504+
static void intel_crtc_active_timings(struct drm_display_mode *mode,
505+
int *vmax_vblank_start,
506+
const struct intel_crtc_state *crtc_state,
507+
bool vrr_enable)
508+
{
509+
drm_mode_init(mode, &crtc_state->hw.adjusted_mode);
510+
*vmax_vblank_start = 0;
511+
512+
if (!vrr_enable)
513+
return;
514+
515+
mode->crtc_vtotal = intel_vrr_vmax_vtotal(crtc_state);
516+
mode->crtc_vblank_end = intel_vrr_vmax_vtotal(crtc_state);
517+
mode->crtc_vblank_start = intel_vrr_vmin_vblank_start(crtc_state);
518+
*vmax_vblank_start = intel_vrr_vmax_vblank_start(crtc_state);
519+
}
520+
504521
void intel_crtc_update_active_timings(const struct intel_crtc_state *crtc_state,
505522
bool vrr_enable)
506523
{
@@ -511,19 +528,13 @@ void intel_crtc_update_active_timings(const struct intel_crtc_state *crtc_state,
511528
int vmax_vblank_start = 0;
512529
unsigned long irqflags;
513530

514-
drm_mode_init(&adjusted_mode, &crtc_state->hw.adjusted_mode);
515-
516-
if (vrr_enable) {
517-
drm_WARN_ON(display->drm,
518-
(mode_flags & I915_MODE_FLAG_VRR) == 0);
531+
intel_crtc_active_timings(&adjusted_mode, &vmax_vblank_start,
532+
crtc_state, vrr_enable);
519533

520-
adjusted_mode.crtc_vtotal = intel_vrr_vmax_vtotal(crtc_state);
521-
adjusted_mode.crtc_vblank_end = intel_vrr_vmax_vtotal(crtc_state);
522-
adjusted_mode.crtc_vblank_start = intel_vrr_vmin_vblank_start(crtc_state);
523-
vmax_vblank_start = intel_vrr_vmax_vblank_start(crtc_state);
524-
} else {
534+
if (vrr_enable)
535+
drm_WARN_ON(display->drm, (mode_flags & I915_MODE_FLAG_VRR) == 0);
536+
else
525537
mode_flags &= ~I915_MODE_FLAG_VRR;
526-
}
527538

528539
/*
529540
* Belts and suspenders locking to guarantee everyone sees 100%

0 commit comments

Comments
 (0)