xf86-video-intel: src/sna/kgem.c src/sna/kgem.h src/sna/sna_accel.c

Chris Wilson ickle at kemper.freedesktop.org
Mon Aug 27 05:29:50 PDT 2012


 src/sna/kgem.c      |    6 ++++++
 src/sna/kgem.h      |    6 ++++++
 src/sna/sna_accel.c |    6 ++----
 3 files changed, 14 insertions(+), 4 deletions(-)

New commits:
commit 3c6758fc4a50ecfce9ed317fec669cc48addedcf
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Aug 27 11:58:05 2012 +0100

    sna: Flush the batch if it references a ShmPixmap and the GPU is idle
    
    This helps minimise the stall when syncing with the GPU before sending
    the next reply to the Client.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 568d120..7495fb9 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -3438,6 +3438,8 @@ bool kgem_check_bo(struct kgem *kgem, ...)
 	int num_exec = 0;
 	int num_pages = 0;
 
+	kgem_flush(kgem);
+
 	va_start(ap, kgem);
 	while ((bo = va_arg(ap, struct kgem_bo *))) {
 		if (bo->exec)
@@ -3472,6 +3474,8 @@ bool kgem_check_bo_fenced(struct kgem *kgem, struct kgem_bo *bo)
 {
 	uint32_t size;
 
+	kgem_flush(kgem);
+
 	while (bo->proxy)
 		bo = bo->proxy;
 	if (bo->exec) {
@@ -3515,6 +3519,8 @@ bool kgem_check_many_bo_fenced(struct kgem *kgem, ...)
 	int num_pages = 0;
 	int fenced_size = 0;
 
+	kgem_flush(kgem);
+
 	va_start(ap, kgem);
 	while ((bo = va_arg(ap, struct kgem_bo *))) {
 		while (bo->proxy)
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index d8018b8..3bf0152 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -277,6 +277,12 @@ static inline void kgem_submit(struct kgem *kgem)
 		_kgem_submit(kgem);
 }
 
+static inline void kgem_flush(struct kgem *kgem)
+{
+	if (kgem->flush && kgem_is_idle(kgem))
+		_kgem_submit(kgem);
+}
+
 static inline void kgem_bo_submit(struct kgem *kgem, struct kgem_bo *bo)
 {
 	if (bo->exec)
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index fd9728c..02d4b13 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1025,10 +1025,8 @@ void sna_add_flush_pixmap(struct sna *sna,
 	assert(bo);
 	list_move(&priv->list, &sna->flush_pixmaps);
 
-	if (bo->exec == NULL && sna->kgem.need_retire)
-		kgem_retire(&sna->kgem);
-	if (bo->exec == NULL || !sna->kgem.need_retire) {
-		DBG(("%s: flush bo idle, flushing\n", __FUNCTION__));
+	if (bo->exec == NULL) {
+		DBG(("%s: new flush bo, flushin before\n", __FUNCTION__));
 		kgem_submit(&sna->kgem);
 	}
 }


More information about the xorg-commit mailing list