xf86-video-intel: 4 commits - src/sna/gen6_render.c src/sna/gen7_render.c src/sna/gen8_render.c src/sna/sna.h src/sna/sna_render.c src/sna/sna_trapezoids_boxes.c test/lowlevel-blt-bench.c test/test_display.c test/test.h

Chris Wilson ickle at kemper.freedesktop.org
Wed Jul 2 13:24:35 PDT 2014


 src/sna/gen6_render.c          |   11 +++++++----
 src/sna/gen7_render.c          |   11 +++++++----
 src/sna/gen8_render.c          |    9 ++++++---
 src/sna/sna.h                  |    8 ++++++++
 src/sna/sna_render.c           |   20 ++++++++++----------
 src/sna/sna_trapezoids_boxes.c |   24 ++++++++++++------------
 test/lowlevel-blt-bench.c      |   19 ++++++++++++-------
 test/test.h                    |    1 +
 test/test_display.c            |    2 ++
 9 files changed, 65 insertions(+), 40 deletions(-)

New commits:
commit 24c9bac7eb6e17b55044d719bab74d16fd68c450
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jul 2 21:17:54 2014 +0100

    sna: Limit the size of the tiling object to be smaller than either the originals
    
    When we tile, we do so in order to fit an operation involving two
    objects larger than the aperture. If we then choose an intermediate
    tiling object that is larger than either of those two, the error will
    persist and we will be forced to recuse.
    
    In the worst case, this will provide an upper bound to the recursion.
    
    Reported-by: Bruno Prémont <bonbons at linux-vserver.org>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna.h b/src/sna/sna.h
index 68a6500..431fe97 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -635,6 +635,7 @@ static inline bool sna_pixmap_is_scanout(struct sna *sna, PixmapPtr pixmap)
 
 static inline int sna_max_tile_copy_size(struct sna *sna, struct kgem_bo *src, struct kgem_bo *dst)
 {
+	int min_object;
 	int max_size;
 
 	max_size = sna->kgem.aperture_high * PAGE_SIZE;
@@ -646,6 +647,13 @@ static inline int sna_max_tile_copy_size(struct sna *sna, struct kgem_bo *src, s
 
 	if (max_size > sna->kgem.max_copy_tile_size)
 		max_size = sna->kgem.max_copy_tile_size;
+
+	min_object = MIN(kgem_bo_size(src), kgem_bo_size(dst)) / 2;
+	if (max_size > min_object)
+		max_size = min_object;
+	if (max_size <= 4096)
+		max_size = 0;
+
 	DBG(("%s: using max tile size of %d\n", __FUNCTION__, max_size));
 	return max_size;
 }
commit 710bb0d37c681f2ffdeaf263b6ee7d9488670bc0
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jul 2 09:16:07 2014 +0000

    test: Create separate SHM segments for ref/out
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/test/lowlevel-blt-bench.c b/test/lowlevel-blt-bench.c
index 63f6815..99b96c0 100644
--- a/test/lowlevel-blt-bench.c
+++ b/test/lowlevel-blt-bench.c
@@ -218,10 +218,11 @@ static Picture source_radial_generic(struct test_display *t, struct test_target
 	return XRenderCreateRadialGradient(t->dpy, &gradient, stops, colors, 2);
 }
 
-static XShmSegmentInfo shm;
+static XShmSegmentInfo shmref, shmout;
 
 static void setup_shm(struct test *t)
 {
+	XShmSegmentInfo shm;
 	int size;
 
 	shm.shmid = -1;
@@ -244,24 +245,28 @@ static void setup_shm(struct test *t)
 	}
 
 	shm.readOnly = False;
-	XShmAttach(t->ref.dpy, &shm);
+
+	shmref = shm;
+	XShmAttach(t->ref.dpy, &shmref);
 	XSync(t->ref.dpy, True);
 
-	XShmAttach(t->out.dpy, &shm);
+	shmout = shm;
+	XShmAttach(t->out.dpy, &shmout);
 	XSync(t->out.dpy, True);
 }
 
 static Picture source_shm(struct test_display *t, struct test_target *target)
 {
+	XShmSegmentInfo *shm = t->target == REF ? &shmref : &shmout;
 	Pixmap pixmap;
 	Picture picture;
 	int size;
 
-	if (shm.shmid == -1)
+	if (shm->shmid == -1)
 		return 0;
 
 	pixmap = XShmCreatePixmap(t->dpy, t->root,
-				  shm.shmaddr, &shm,
+				  shm->shmaddr, shm,
 				  target->width, target->height, 32);
 
 	picture = XRenderCreatePicture(t->dpy, pixmap,
@@ -270,8 +275,8 @@ static Picture source_shm(struct test_display *t, struct test_target *target)
 	XFreePixmap(t->dpy, pixmap);
 
 	size = target->width * target->height * 4;
-	memset(shm.shmaddr, 0x80, size/2);
-	memset(shm.shmaddr+size/2, 0xff, size/2);
+	memset(shm->shmaddr, 0x80, size/2);
+	memset(shm->shmaddr+size/2, 0xff, size/2);
 
 	return picture;
 }
diff --git a/test/test.h b/test/test.h
index bf0e5e6..a3ef979 100644
--- a/test/test.h
+++ b/test/test.h
@@ -34,6 +34,7 @@ struct test {
 		int has_shm_pixmaps;
 		int width, height, depth;
 		XRenderPictFormat *format;
+		enum { REF, OUT } target;
 	} out, ref;
 };
 
diff --git a/test/test_display.c b/test/test_display.c
index d5a8a02..98ee4e8 100644
--- a/test/test_display.c
+++ b/test/test_display.c
@@ -136,11 +136,13 @@ static void test_get_displays(int argc, char **argv,
 	default_setup(out);
 	shm_setup(out);
 	out->root = get_root(out);
+	out->target = OUT;
 
 	ref->dpy = ref_display(out->width, out->height, out->depth);
 	default_setup(ref);
 	shm_setup(ref);
 	ref->root = get_root(ref);
+	ref->target = REF;
 }
 
 void test_init(struct test *test, int argc, char **argv)
commit 87e659b887f4c738cfc91439efdac0d48fd294f0
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jul 2 10:47:32 2014 +0000

    sna: Use the threaded compositor for picture conversions
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c
index 5135c11..89be5a5 100644
--- a/src/sna/sna_render.c
+++ b/src/sna/sna_render.c
@@ -1699,11 +1699,11 @@ do_fixup:
 		dst = pixman_image_create_bits(channel->pict_format,
 					       w, h, ptr, channel->bo->pitch);
 		if (dst) {
-			pixman_image_composite(PictOpSrc, src, NULL, dst,
-					       0, 0,
-					       0, 0,
-					       0, 0,
-					       w, h);
+			sna_image_composite(PictOpSrc, src, NULL, dst,
+					    0, 0,
+					    0, 0,
+					    0, 0,
+					    w, h);
 			pixman_image_unref(src);
 		} else {
 			memset(ptr, 0, __kgem_buffer_size(channel->bo));
@@ -1891,11 +1891,11 @@ sna_render_picture_convert(struct sna *sna,
 		}
 
 		if (sigtrap_get() == 0) {
-			pixman_image_composite(PictOpSrc, src, NULL, dst,
-					       box.x1, box.y1,
-					       0, 0,
-					       0, 0,
-					       w, h);
+			sna_image_composite(PictOpSrc, src, NULL, dst,
+					    box.x1, box.y1,
+					    0, 0,
+					    0, 0,
+					    w, h);
 			sigtrap_put();
 		}
 		pixman_image_unref(dst);
diff --git a/src/sna/sna_trapezoids_boxes.c b/src/sna/sna_trapezoids_boxes.c
index ba31803..1cfad29 100644
--- a/src/sna/sna_trapezoids_boxes.c
+++ b/src/sna/sna_trapezoids_boxes.c
@@ -681,8 +681,8 @@ pixsolid_opacity(struct pixman_inplace *pi,
 		*pi->bits = pi->color;
 	else
 		*pi->bits = mul_4x8_8(pi->color, opacity);
-	pixman_image_composite(pi->op, pi->source, NULL, pi->image,
-			       0, 0, 0, 0, pi->dx + x, pi->dy + y, w, h);
+	sna_image_composite(pi->op, pi->source, NULL, pi->image,
+			0, 0, 0, 0, pi->dx + x, pi->dy + y, w, h);
 }
 
 static void
@@ -936,18 +936,18 @@ pixmask_opacity(struct pixman_inplace *pi,
 		uint8_t opacity)
 {
 	if (opacity == 0xff) {
-		pixman_image_composite(pi->op, pi->source, NULL, pi->image,
-				       pi->sx + x, pi->sy + y,
-				       0, 0,
-				       pi->dx + x, pi->dy + y,
-				       w, h);
+		sna_image_composite(pi->op, pi->source, NULL, pi->image,
+				    pi->sx + x, pi->sy + y,
+				    0, 0,
+				    pi->dx + x, pi->dy + y,
+				    w, h);
 	} else {
 		*pi->bits = opacity;
-		pixman_image_composite(pi->op, pi->source, pi->mask, pi->image,
-				       pi->sx + x, pi->sy + y,
-				       0, 0,
-				       pi->dx + x, pi->dy + y,
-				       w, h);
+		sna_image_composite(pi->op, pi->source, pi->mask, pi->image,
+				    pi->sx + x, pi->sy + y,
+				    0, 0,
+				    pi->dx + x, pi->dy + y,
+				    w, h);
 	}
 }
 
commit 2bf36d54ebdfa2a59bf7ef71134b953628ae5d50
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jul 2 11:31:54 2014 +0100

    sna/gen6+: Tweak consideration of compositing on BLT
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index ece8cdb..ab6e296 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -1943,18 +1943,21 @@ try_blt(struct sna *sna,
 	}
 
 	bo = __sna_drawable_peek_bo(dst->pDrawable);
-	if (bo && bo->rq)
+	if (bo == NULL)
+		return true;
+	if (bo->rq)
 		return RQ_IS_BLT(bo->rq);
 
-	if (sna_picture_is_solid(src, NULL) && can_switch_to_blt(sna, NULL, 0))
+	if (sna_picture_is_solid(src, NULL) && can_switch_to_blt(sna, bo, 0))
 		return true;
 
 	if (src->pDrawable) {
 		bo = __sna_drawable_peek_bo(src->pDrawable);
 		if (bo == NULL)
 			return true;
-		else if (bo->rq)
-			return RQ_IS_BLT(bo->rq);
+
+		if (prefer_blt_bo(sna, bo))
+			return true;
 	}
 
 	if (sna->kgem.ring == KGEM_BLT) {
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index 0a35d95..b1faac4 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -2195,18 +2195,21 @@ try_blt(struct sna *sna,
 	}
 
 	bo = __sna_drawable_peek_bo(dst->pDrawable);
-	if (bo && bo->rq)
+	if (bo == NULL)
+		return true;
+	if (bo->rq)
 		return RQ_IS_BLT(bo->rq);
 
-	if (sna_picture_is_solid(src, NULL) && can_switch_to_blt(sna, NULL, 0))
+	if (sna_picture_is_solid(src, NULL) && can_switch_to_blt(sna, bo, 0))
 		return true;
 
 	if (src->pDrawable) {
 		bo = __sna_drawable_peek_bo(src->pDrawable);
 		if (bo == NULL)
 			return true;
-		else if (bo->rq)
-			return RQ_IS_BLT(bo->rq);
+
+		if (prefer_blt_bo(sna, bo))
+			return true;
 	}
 
 	if (sna->kgem.ring == KGEM_BLT) {
diff --git a/src/sna/gen8_render.c b/src/sna/gen8_render.c
index 392a107..3cdbfd5 100644
--- a/src/sna/gen8_render.c
+++ b/src/sna/gen8_render.c
@@ -2012,17 +2012,20 @@ try_blt(struct sna *sna,
 	}
 
 	bo = __sna_drawable_peek_bo(dst->pDrawable);
-	if (bo && bo->rq)
+	if (bo == NULL)
+		return true;
+	if (bo->rq)
 		return RQ_IS_BLT(bo->rq);
 
-	if (sna_picture_is_solid(src, NULL) && can_switch_to_blt(sna, NULL, 0))
+	if (sna_picture_is_solid(src, NULL) && can_switch_to_blt(sna, bo, 0))
 		return true;
 
 	if (src->pDrawable) {
 		bo = __sna_drawable_peek_bo(src->pDrawable);
 		if (bo == NULL)
 			return true;
-		else if (bo->rq)
+
+		if (prefer_blt_bo(sna, bo))
 			return RQ_IS_BLT(bo->rq);
 	}
 


More information about the xorg-commit mailing list