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

Chris Wilson ickle at kemper.freedesktop.org
Wed May 27 00:40:10 PDT 2015


 src/sna/sna_dri2.c |   23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

New commits:
commit fb1643f0f904eb258da71cd0b8deb8d3ec6dafed
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed May 27 07:37:35 2015 +0100

    sna/dri2: Refine ring selection with multiple active rings
    
    The preference given multiple rings is to the previous writer, or if
    none, to the render ring if active.
    
    References: https://bugs.freedesktop.org/show_bug.cgi?id=90671
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c
index dbdde32..be33480 100644
--- a/src/sna/sna_dri2.c
+++ b/src/sna/sna_dri2.c
@@ -870,6 +870,22 @@ static void set_bo(PixmapPtr pixmap, struct kgem_bo *bo)
 	}
 }
 
+#if defined(__GNUC__)
+#define popcount(x) __builtin_popcount(x)
+#else
+static int popcount(unsigned int x)
+{
+	int count = 0;
+
+	while (x) {
+		count += x&1;
+		x >>= 1;
+	}
+
+	return count;
+}
+#endif
+
 static void sna_dri2_select_mode(struct sna *sna, struct kgem_bo *dst, struct kgem_bo *src, bool sync)
 {
 	struct drm_i915_gem_busy busy;
@@ -940,9 +956,12 @@ static void sna_dri2_select_mode(struct sna *sna, struct kgem_bo *dst, struct kg
 	 * The ultimate question is whether preserving the ring outweighs
 	 * the cost of the query.
 	 */
-	mode = KGEM_RENDER;
-	if (busy.busy & (0xfffe << 16))
+	if (popcount(busy.busy >> 16) > 1)
+		mode = busy.busy & 0xffff ? KGEM_BLT : KGEM_RENDER;
+	else if (busy.busy & (0xfffe << 16))
 		mode = KGEM_BLT;
+	else
+		mode = KGEM_RENDER;
 	kgem_bo_mark_busy(&sna->kgem, busy.handle == src->handle ? src : dst, mode);
 	_kgem_set_mode(&sna->kgem, mode);
 }


More information about the xorg-commit mailing list