Skip to content

Commit dd6ec89

Browse files
committed
drm/i915: Extract intel_crtc_prepare_vblank_event()
Extract the code for staging the vblank event for the flip done interrupt handler. We'll reuse this for DSB stuff later. Reviewed-by: Animesh Manna <[email protected]> Signed-off-by: Ville Syrjälä <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 08222ca commit dd6ec89

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

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

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -521,12 +521,8 @@ void intel_pipe_update_start(struct intel_atomic_state *state,
521521
intel_psr_lock(new_crtc_state);
522522

523523
if (new_crtc_state->do_async_flip) {
524-
spin_lock_irq(&crtc->base.dev->event_lock);
525-
/* arm the event for the flip done irq handler */
526-
crtc->flip_done_event = new_crtc_state->uapi.event;
527-
spin_unlock_irq(&crtc->base.dev->event_lock);
528-
529-
new_crtc_state->uapi.event = NULL;
524+
intel_crtc_prepare_vblank_event(new_crtc_state,
525+
&crtc->flip_done_event);
530526
return;
531527
}
532528

@@ -626,6 +622,19 @@ void intel_crtc_arm_vblank_event(struct intel_crtc_state *crtc_state)
626622
crtc_state->uapi.event = NULL;
627623
}
628624

625+
void intel_crtc_prepare_vblank_event(struct intel_crtc_state *crtc_state,
626+
struct drm_pending_vblank_event **event)
627+
{
628+
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
629+
unsigned long irqflags;
630+
631+
spin_lock_irqsave(&crtc->base.dev->event_lock, irqflags);
632+
*event = crtc_state->uapi.event;
633+
spin_unlock_irqrestore(&crtc->base.dev->event_lock, irqflags);
634+
635+
crtc_state->uapi.event = NULL;
636+
}
637+
629638
/**
630639
* intel_pipe_update_end() - end update of a set of display registers
631640
* @state: the atomic state

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ struct drm_device;
1414
struct drm_display_mode;
1515
struct drm_file;
1616
struct drm_i915_private;
17+
struct drm_pending_vblank_event;
1718
struct intel_atomic_state;
1819
struct intel_crtc;
1920
struct intel_crtc_state;
@@ -34,6 +35,8 @@ int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode,
3435
int intel_scanlines_to_usecs(const struct drm_display_mode *adjusted_mode,
3536
int scanlines);
3637
void intel_crtc_arm_vblank_event(struct intel_crtc_state *crtc_state);
38+
void intel_crtc_prepare_vblank_event(struct intel_crtc_state *crtc_state,
39+
struct drm_pending_vblank_event **event);
3740
u32 intel_crtc_max_vblank_count(const struct intel_crtc_state *crtc_state);
3841
int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe);
3942
int intel_crtc_get_pipe_from_crtc_id_ioctl(struct drm_device *dev, void *data,

0 commit comments

Comments
 (0)