[PATCH 4/4] drm: fix vblank flush_all

Chaitanya Kumar Borah chaitanya.kumar.borah at intel.com
Tue May 7 19:17:50 UTC 2024


Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.borah at intel.com>
---
 drivers/gpu/drm/drm_vblank_work.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank_work.c b/drivers/gpu/drm/drm_vblank_work.c
index 83a81a5e8280..383d9190b4e7 100644
--- a/drivers/gpu/drm/drm_vblank_work.c
+++ b/drivers/gpu/drm/drm_vblank_work.c
@@ -243,11 +243,20 @@ void drm_vblank_work_flush_all(struct drm_crtc *crtc)
 {
 	struct drm_device *dev = crtc->dev;
 	struct drm_vblank_crtc *vblank = &dev->vblank[drm_crtc_index(crtc)];
+	struct drm_vblank_work *work, *next;
+	u64 count = atomic64_read(&vblank->count);
 
 	spin_lock_irq(&dev->event_lock);
-	wait_event_lock_irq(vblank->work_wait_queue,
-			    !waitqueue_active(&vblank->work_wait_queue),
-			    dev->event_lock);
+
+	list_for_each_entry_safe(work, next, &vblank->pending_work, node) {
+		if (!drm_vblank_passed(count, work->count))
+			continue;
+
+		list_del_init(&work->node);
+		drm_vblank_put(vblank->dev, vblank->pipe);
+		kthread_queue_work(vblank->worker, &work->base);
+	}
+
 	spin_unlock_irq(&dev->event_lock);
 
 	kthread_flush_worker(vblank->worker);
-- 
2.25.1



More information about the Intel-gfx-trybot mailing list