Skip to content

Commit

Permalink
drm/radeon: Make classic pageflip completion path less racy.
Browse files Browse the repository at this point in the history
Need to protect mmio flip programming by event lock as well.

Need to also first enable pflip irq, then mmio program,
otherwise a flip completion may get unnoticed in the vblank
of actual completion if the flip is programmed, but
radeon_flip_work_func gets preempted immediately after
mmio programming and before vblank. In that case the
vblank irq handler wouldn't run radeon_crtc_handle_vblank()
with the completion check routine, miss the completed flip,
and only notice one vblank after actual completion, causing
a false/delayed report of flip completion.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Mario Kleiner authored and Alex Deucher committed Jul 17, 2014
1 parent 8264849 commit 5f87e09
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/gpu/drm/radeon/radeon_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,15 +407,15 @@ static void radeon_flip_work_func(struct work_struct *__work)
radeon_fence_unref(&work->fence);
}

/* do the flip (mmio) */
radeon_page_flip(rdev, radeon_crtc->crtc_id, work->base);

/* We borrow the event spin lock for protecting flip_status */
spin_lock_irqsave(&crtc->dev->event_lock, flags);

/* set the proper interrupt */
radeon_irq_kms_pflip_irq_get(rdev, radeon_crtc->crtc_id);

/* do the flip (mmio) */
radeon_page_flip(rdev, radeon_crtc->crtc_id, work->base);

radeon_crtc->flip_status = RADEON_FLIP_SUBMITTED;
spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
up_read(&rdev->exclusive_lock);
Expand Down

0 comments on commit 5f87e09

Please sign in to comment.