summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/drm_fence.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/linux-core/drm_fence.c b/linux-core/drm_fence.c
index 41fe62a8..cb7aee09 100644
--- a/linux-core/drm_fence.c
+++ b/linux-core/drm_fence.c
@@ -31,6 +31,7 @@
#include "drmP.h"
+
/*
* Typically called by the IRQ handler.
*/
@@ -44,14 +45,20 @@ void drm_fence_handler(drm_device_t * dev, uint32_t sequence, uint32_t type)
drm_fence_driver_t *driver = dev->driver->fence_driver;
struct list_head *list, *prev;
drm_fence_object_t *fence;
+ int found = 0;
+
+ if (list_empty(&fm->ring))
+ return;
list_for_each_entry(fence, &fm->ring, ring) {
diff = (sequence - fence->sequence) & driver->sequence_mask;
- if (diff > driver->wrap_diff)
+ if (diff > driver->wrap_diff) {
+ found = 1;
break;
+ }
}
- list = fence->ring.prev;
+ list = (found) ? fence->ring.prev : fm->ring.prev;
prev = list->prev;
for (; list != &fm->ring; list = prev, prev = list->prev) {