xf86-video-intel: src/intel_list.h src/sna/sna_dri2.c

Chris Wilson ickle at kemper.freedesktop.org
Tue Aug 11 11:50:08 PDT 2015


 src/intel_list.h   |   10 ++++++++++
 src/sna/sna_dri2.c |    6 +++---
 2 files changed, 13 insertions(+), 3 deletions(-)

New commits:
commit 5a9a3e73a9252cffbaf5f361e98c096095725a64
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Aug 11 10:48:48 2015 +0100

    sna/dri2: Keep the most-recent back buffer cache when reaping on idle
    
    When the client misses a swap, we consider it idle and unlikely to swap
    again for a while. We try to take advantage of that and remove the old
    back buffers. But it is likely to swap again and so having some of that
    cache around would be advantageous.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/intel_list.h b/src/intel_list.h
index d0408be..df912a8 100644
--- a/src/intel_list.h
+++ b/src/intel_list.h
@@ -347,6 +347,11 @@ list_is_empty(const struct list *head)
 	 &pos->member != (head);					\
 	 pos = tmp, tmp = __container_of(pos->member.next, tmp, member))
 
+#define list_for_each_entry_safe_from(pos, tmp, head, member)		\
+    for (tmp = __container_of(pos->member.next, pos, member);		\
+	 &pos->member != (head);					\
+	 pos = tmp, tmp = __container_of(pos->member.next, tmp, member))
+
 #else
 
 #include <list.h>
@@ -396,6 +401,11 @@ static inline void list_move_tail(struct list *list, struct list *head)
 	 &pos->member != (head);					\
 	 pos = __container_of(pos->member.prev, pos, member))
 
+#define list_for_each_entry_safe_from(pos, tmp, head, member)		\
+    for (tmp = __container_of(pos->member.next, pos, member)		\
+	 &pos->member != (head);					\
+	 pos = tmp)
+
 #endif
 
 #undef container_of
diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c
index bae9314..e6f4d43 100644
--- a/src/sna/sna_dri2.c
+++ b/src/sna/sna_dri2.c
@@ -1510,10 +1510,10 @@ sna_dri2_remove_event(WindowPtr win, struct sna_dri2_event *info)
 
 	priv->chain = info->chain;
 	if (priv->chain == NULL) {
-		while (!list_is_empty(&priv->cache)) {
-			struct dri_bo *c;
+		struct dri_bo *c, *tmp;
 
-			c = list_first_entry(&priv->cache, struct dri_bo, link);
+		c = list_entry(priv->cache.next->next, struct dri_bo, link);
+		list_for_each_entry_safe_from(c, tmp, &priv->cache, link) {
 			list_del(&c->link);
 
 			DBG(("%s: releasing cached handle=%d\n", __FUNCTION__, c->bo ? c->bo->handle : 0));


More information about the xorg-commit mailing list