Commit ca721b79 authored by Michel Dänzer's avatar Michel Dänzer Committed by Alex Deucher

Revert "drm/radeon: remove drm_vblank_get|put from pflip handling"

This reverts commit 75f36d86.

drm_vblank_get() is necessary to ensure the DRM vblank counter value is
up to date in drm_send_vblank_event().

Seems to fix weston hangs waiting for page flips to complete.
Signed-off-by: default avatarMichel Dänzer <michel.daenzer@amd.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent f2263fc7
...@@ -358,6 +358,7 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id) ...@@ -358,6 +358,7 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id)
spin_unlock_irqrestore(&rdev->ddev->event_lock, flags); spin_unlock_irqrestore(&rdev->ddev->event_lock, flags);
drm_vblank_put(rdev->ddev, radeon_crtc->crtc_id);
radeon_fence_unref(&work->fence); radeon_fence_unref(&work->fence);
radeon_irq_kms_pflip_irq_get(rdev, work->crtc_id); radeon_irq_kms_pflip_irq_get(rdev, work->crtc_id);
queue_work(radeon_crtc->flip_queue, &work->unpin_work); queue_work(radeon_crtc->flip_queue, &work->unpin_work);
...@@ -460,6 +461,12 @@ static void radeon_flip_work_func(struct work_struct *__work) ...@@ -460,6 +461,12 @@ static void radeon_flip_work_func(struct work_struct *__work)
base &= ~7; base &= ~7;
} }
r = drm_vblank_get(crtc->dev, radeon_crtc->crtc_id);
if (r) {
DRM_ERROR("failed to get vblank before flip\n");
goto pflip_cleanup;
}
/* We borrow the event spin lock for protecting flip_work */ /* We borrow the event spin lock for protecting flip_work */
spin_lock_irqsave(&crtc->dev->event_lock, flags); spin_lock_irqsave(&crtc->dev->event_lock, flags);
...@@ -474,6 +481,16 @@ static void radeon_flip_work_func(struct work_struct *__work) ...@@ -474,6 +481,16 @@ static void radeon_flip_work_func(struct work_struct *__work)
return; return;
pflip_cleanup:
if (unlikely(radeon_bo_reserve(work->new_rbo, false) != 0)) {
DRM_ERROR("failed to reserve new rbo in error path\n");
goto cleanup;
}
if (unlikely(radeon_bo_unpin(work->new_rbo) != 0)) {
DRM_ERROR("failed to unpin new rbo in error path\n");
}
radeon_bo_unreserve(work->new_rbo);
cleanup: cleanup:
drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base); drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base);
radeon_fence_unref(&work->fence); radeon_fence_unref(&work->fence);
......
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