xf86-video-intel: 2 commits - src/intel_list.h src/sna/kgem.c src/sna/sna_display.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Jun 25 05:23:30 PDT 2014


 src/intel_list.h      |    5 +++++
 src/sna/kgem.c        |   30 +++++++++++++++++++++---------
 src/sna/sna_display.c |    2 ++
 3 files changed, 28 insertions(+), 9 deletions(-)

New commits:
commit 5ad1661b870b5b189e52383e45a9b8f570b40501
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jun 25 13:21:58 2014 +0100

    sna: Only mark throttle as done after success
    
    References: https://bugs.freedesktop.org/show_bug.cgi?id=77436
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 2c394b6..50a7da2 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -967,8 +967,10 @@ static bool __kgem_throttle(struct kgem *kgem)
 	 * too much and completely starve X. We will sleep again shortly,
 	 * and so catch up or detect the hang.
 	 */
-	if (ioctl(kgem->fd, DRM_IOCTL_I915_GEM_THROTTLE) == 0)
+	if (ioctl(kgem->fd, DRM_IOCTL_I915_GEM_THROTTLE) == 0) {
+		kgem->need_throttle = 0;
 		return false;
+	}
 
 	return errno == EIO;
 }
@@ -3398,7 +3400,6 @@ static void find_hang_state(struct kgem *kgem, char *path, int maxlen)
 
 void kgem_throttle(struct kgem *kgem)
 {
-	kgem->need_throttle = 0;
 	if (kgem->wedged)
 		return;
 
@@ -3414,6 +3415,8 @@ void kgem_throttle(struct kgem *kgem)
 			xf86DrvMsg(kgem_get_screen_index(kgem), X_ERROR,
 				   "When reporting this, please include %s and the full dmesg.\n",
 				   path);
+
+		kgem->need_throttle = false;
 	}
 }
 
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 706a7eb..799d7d4 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -1120,6 +1120,8 @@ static bool wait_for_shadow(struct sna *sna,
 	if (sna->mode.flip_active) {
 		/* raw cmd to avoid setting wedged in the middle of an op */
 		drmIoctl(sna->kgem.fd, DRM_IOCTL_I915_GEM_THROTTLE, 0);
+		sna->kgem.need_throttle = false;
+
 		while (sna->mode.flip_active && sna_mode_has_pending_events(sna))
 			sna_mode_wakeup(sna);
 	}
commit c3e4518e84300aeb8e12a0af56c2d66a1df9d8d7
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jun 25 11:18:01 2014 +0100

    sna: Track desired flushes better after starting a new batch
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/intel_list.h b/src/intel_list.h
index de0b683..51af825 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 7a7e2f2..2c394b6 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)


More information about the xorg-commit mailing list