Skip to content

Commit c65b5da

Browse files
committed
SUNLIGHT: drm/amd/display: Clean up stale page flip state on timeout
Description: - When a page flip times out waiting for hw_done or flip_done completion, the event and pflip_status are left in a stale state. This causes WARN_ON triggers in prepare_flip_isr on subsequent commits because the hardware never signaled completion of the previous flip. Add cleanup logic to manually send the vblank event, release the vblank reference, and reset pflip_status to AMDGPU_FLIP_NONE when a timeout occurs. This prevents state corruption and eliminates spurious warnings on future commits. Change-Id: I2c59946fadf179f071f999291b4cc30225fcb9a6 Signed-off-by: Ionut Nechita <[email protected]>
1 parent 2d676b4 commit c65b5da

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10685,10 +10685,29 @@ static int do_aquire_global_lock(struct drm_device *dev,
1068510685
ret = wait_for_completion_interruptible_timeout(
1068610686
&commit->flip_done, 10*HZ);
1068710687

10688-
if (ret == 0)
10688+
if (ret == 0) {
10689+
struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
10690+
unsigned long flags;
10691+
1068910692
drm_err(dev, "[CRTC:%d:%s] hw_done or flip_done timed out\n",
1069010693
crtc->base.id, crtc->name);
1069110694

10695+
/*
10696+
* Clean up stale event and pflip_status to prevent
10697+
* WARN_ON in prepare_flip_isr on subsequent commits.
10698+
* If the flip timed out, the hardware did not signal
10699+
* completion, so we need to manually clean up the state.
10700+
*/
10701+
spin_lock_irqsave(&dev->event_lock, flags);
10702+
if (acrtc->event) {
10703+
drm_crtc_send_vblank_event(crtc, acrtc->event);
10704+
acrtc->event = NULL;
10705+
drm_crtc_vblank_put(crtc);
10706+
}
10707+
acrtc->pflip_status = AMDGPU_FLIP_NONE;
10708+
spin_unlock_irqrestore(&dev->event_lock, flags);
10709+
}
10710+
1069210711
drm_crtc_commit_put(commit);
1069310712
}
1069410713

0 commit comments

Comments
 (0)