diff options
-rw-r--r-- | src/intel_list.h | 5 | ||||
-rw-r--r-- | src/sna/kgem.c | 23 |
2 files changed, 21 insertions, 7 deletions
diff --git a/src/intel_list.h b/src/intel_list.h index de0b6837..51af825d 100644 --- a/src/intel_list.h +++ b/src/intel_list.h @@ -403,5 +403,10 @@ static inline void list_move_tail(struct list *list, struct list *head) #define container_of(ptr, type, member) \ ((type *)((char *)(ptr) - (char *) &((type *)0)->member)) +static inline int list_is_singular(const struct list *list) +{ + return list->next == list->prev; +} + #endif /* _INTEL_LIST_H_ */ diff --git a/src/sna/kgem.c b/src/sna/kgem.c index 7a7e2f2a..2c394b63 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -5195,6 +5195,16 @@ void kgem_scanout_flush(struct kgem *kgem, struct kgem_bo *bo) bo->domain = DOMAIN_NONE; } +inline static bool nearly_idle(struct kgem *kgem) +{ + int ring = kgem->ring == KGEM_BLT; + + if (list_is_singular(&kgem->requests[ring])) + return true; + + return __kgem_ring_is_idle(kgem, ring); +} + inline static bool needs_semaphore(struct kgem *kgem, struct kgem_bo *bo) { if (kgem->needs_semaphore) @@ -5212,29 +5222,28 @@ inline static bool needs_reservation(struct kgem *kgem, struct kgem_bo *bo) if (kgem->needs_reservation) return false; - if (bo->presumed_offset || kgem_ring_is_idle(kgem, kgem->ring)) + if (bo->presumed_offset) return false; kgem->needs_reservation = true; - return true; + return nearly_idle(kgem); } inline static bool needs_batch_flush(struct kgem *kgem, struct kgem_bo *bo) { - if (kgem->nreloc == 0) - return false; + bool flush = false; if (needs_semaphore(kgem, bo)) { DBG(("%s: flushing before handle=%d for required semaphore\n", __FUNCTION__, bo->handle)); - return true; + flush = true; } if (needs_reservation(kgem, bo)) { DBG(("%s: flushing before handle=%d for new reservation\n", __FUNCTION__, bo->handle)); - return true; + flush = true; } - return false; + return kgem->nreloc ? flush : false; } static bool aperture_check(struct kgem *kgem, unsigned num_pages) |