summaryrefslogtreecommitdiff
path: root/bsd/drm/lock.c
diff options
context:
space:
mode:
Diffstat (limited to 'bsd/drm/lock.c')
-rw-r--r--bsd/drm/lock.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/bsd/drm/lock.c b/bsd/drm/lock.c
index 1affcd1d..ec295b2b 100644
--- a/bsd/drm/lock.c
+++ b/bsd/drm/lock.c
@@ -135,9 +135,12 @@ static int drm_flush_queue(drm_device_t *dev, int context)
if (atomic_read(&q->use_count) > 1) {
atomic_inc(&q->block_write);
atomic_inc(&q->block_count);
- error = tsleep(&q->flush_queue, PCATCH|PZERO, "drmfq", 0);
- if (error)
- return error;
+ for (;;) {
+ if (!DRM_BUFCOUNT(&q->waitlist)) break;
+ error = tsleep(&q->flush_queue, PCATCH|PZERO, "drmfq", 0);
+ if (error)
+ return error;
+ }
atomic_dec(&q->block_count);
}
atomic_dec(&q->use_count);