summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-06-25 11:18:01 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-06-25 11:51:12 +0100
commitc3e4518e84300aeb8e12a0af56c2d66a1df9d8d7 (patch)
treee568892751c19d825fb84b0c0a466ac7227ffa91 /src
parent85bb55e4a62666fa51af34d08699950be362aa57 (diff)
sna: Track desired flushes better after starting a new batch
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/intel_list.h5
-rw-r--r--src/sna/kgem.c23
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)