xf86-video-intel: 4 commits - src/sna/gen3_render.c src/sna/kgem.c src/sna/sna_accel.c

Chris Wilson ickle at kemper.freedesktop.org
Tue Oct 11 06:03:07 PDT 2011


 src/sna/gen3_render.c |    3 +
 src/sna/kgem.c        |    5 +--
 src/sna/sna_accel.c   |   79 ++++++++++++++++++++++++++++++++++++++++++++------
 3 files changed, 76 insertions(+), 11 deletions(-)

New commits:
commit 823a4272c50247482428a16cb08741bf87a302ea
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Oct 11 13:51:41 2011 +0100

    sna/gen3: Avoid RENDER/BLT context switch for fill boxes
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c
index e7d8bb2..1d4df78 100644
--- a/src/sna/gen3_render.c
+++ b/src/sna/gen3_render.c
@@ -3603,7 +3603,8 @@ gen3_render_fill_boxes(struct sna *sna,
 						      dst, dst_bo,
 						      box, n);
 
-	if (gen3_render_fill_boxes_try_blt(sna, op, format, color,
+	if (sna->kgem.mode != KGEM_RENDER &&
+	    gen3_render_fill_boxes_try_blt(sna, op, format, color,
 					   dst, dst_bo,
 					   box, n))
 		return TRUE;
commit 887361de173e082841453902089427447c5a158a
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Oct 11 13:51:25 2011 +0100

    sna: Enable single fill fast path for PolySegment
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index dab396e..227123d 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2250,16 +2250,76 @@ static Bool
 sna_poly_segment_blt(DrawablePtr drawable,
 		     struct kgem_bo *bo,
 		     struct sna_damage **damage,
-		     GCPtr gc, int n, xSegment *seg)
+		     GCPtr gc, int n, xSegment *seg,
+		     const BoxRec *extents)
 {
 	struct sna *sna = to_sna_from_drawable(drawable);
 	PixmapPtr pixmap = get_drawable_pixmap(drawable);
-	RegionPtr clip = fbGetCompositeClip(gc);
+	RegionRec clip;
 	struct sna_fill_op fill;
 	int16_t dx, dy;
 
 	DBG(("%s: alu=%d, fg=%08lx\n", __FUNCTION__, gc->alu, gc->fgPixel));
 
+	RegionInit(&clip, (BoxPtr)extents, 1);
+	if (gc->pCompositeClip && gc->pCompositeClip->data)
+		RegionIntersect(&clip, &clip, gc->pCompositeClip);
+
+	if (n == 1 && clip.data == NULL) {
+		BoxRec r;
+		int width, height;
+		bool success = true;
+
+		DBG(("%s: trying single fill fast-path\n", __FUNCTION__));
+
+		if (seg->x1 < seg->x2) {
+			r.x1 = seg->x1;
+			width = seg->x2;
+		} else {
+			r.x1 = seg->x2;
+			width = seg->x1;
+		}
+		width -= r.x1 - 1;
+		r.x1 += drawable->x;
+
+		if (seg->y1 < seg->y2) {
+			r.y1 = seg->y1;
+			height = seg->y2;
+		} else {
+			r.y1 = seg->y2;
+			height = seg->y1;
+		}
+		height -= r.y1- 1;
+		r.y1 += drawable->y;
+
+		/* don't paint last pixel */
+		if (gc->capStyle == CapNotLast) {
+			if (width == 1)
+				height--;
+			else
+				width--;
+		}
+		r.x2 = r.x1 + width;
+		r.y2 = r.y1 + height;
+
+		if (box_intersect(&r, &clip.extents)) {
+			get_drawable_deltas(drawable, pixmap, &dx, &dy);
+			r.x1 += dx; r.y1 += dy;
+			r.x2 += dx; r.y2 += dy;
+			if (sna->render.fill_one(sna, pixmap, bo, gc->fgPixel,
+						 r.x1, r.y1, r.x2, r.y2,
+						 gc->alu)) {
+				if (damage) {
+					assert_pixmap_contains_box(pixmap, &r);
+					sna_damage_add_box(damage, &r);
+				}
+			} else
+				success = false;
+		}
+
+		return success;
+	}
+
 	if (!sna_fill_init_blt(&fill, sna, pixmap, bo, gc->alu, gc->fgPixel))
 		return FALSE;
 
@@ -2298,7 +2358,7 @@ sna_poly_segment_blt(DrawablePtr drawable,
 
 		DBG(("%s: [%d] (%d, %d)x(%d, %d) + (%d, %d)\n", __FUNCTION__, n,
 		     x, y, width, height, dx, dy));
-		for (nclip = REGION_NUM_RECTS(clip), box = REGION_RECTS(clip); nclip--; box++) {
+		for (nclip = REGION_NUM_RECTS(&clip), box = REGION_RECTS(&clip); nclip--; box++) {
 			BoxRec r = { x, y, x + width, y + height };
 			if (box_intersect(&r, box)) {
 				r.x1 += dx;
@@ -2422,15 +2482,15 @@ sna_poly_segment(DrawablePtr drawable, GCPtr gc, int n, xSegment *seg)
 		if (sna_drawable_use_gpu_bo(drawable, &extents) &&
 		    sna_poly_segment_blt(drawable,
 					 priv->gpu_bo,
-					 priv->gpu_only ? NULL : &priv->gpu_damage,
-					 gc, n, seg))
+					 priv->gpu_only ? NULL : reduce_damage(drawable, &priv->gpu_damage, &extents),
+					 gc, n, seg, &extents))
 			return;
 
 		if (sna_drawable_use_cpu_bo(drawable, &extents) &&
 		    sna_poly_segment_blt(drawable,
 					 priv->cpu_bo,
-					 &priv->cpu_damage,
-					 gc, n, seg))
+					 reduce_damage(drawable, &priv->cpu_damage, &extents),
+					 gc, n, seg, &extents))
 			return;
 	}
 
commit 721cf30e9eeb0102c77f337332ad8259463b7fef
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Oct 11 13:28:45 2011 +0100

    sna/accel: If the data is already on the GPU, use it for the source
    
    Fixes regression from 1ec6a0e2775 (sna: Move the source to the GPU
    if it is reused).
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 1edd3a3..dab396e 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1143,12 +1143,15 @@ sna_put_image(DrawablePtr drawable, GCPtr gc, int depth,
 	RegionUninit(&region);
 }
 
-static Bool
+static bool
 move_to_gpu(PixmapPtr pixmap, struct sna_pixmap *priv, const BoxRec *box)
 {
 	int w = box->x2 - box->x1;
 	int h = box->y2 - box->y1;
 
+	if (priv->gpu_bo)
+		return TRUE;
+
 	return ++priv->source_count * w*h >= 2 * pixmap->drawable.width * pixmap->drawable.height;
 }
 
commit 15a4410cec111c3b3bd15ec33f29bc1f4cb709c1
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Oct 11 13:28:30 2011 +0100

    sna: use correct insertion point for sorting partials
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index fb24563..ffcfd9f 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1908,7 +1908,8 @@ static bool validate_partials(struct kgem *kgem)
 
 err:
 	list_for_each_entry(bo, &kgem->partial, base.list)
-		ErrorF("bo: used=%d / %d\n", bo->used, bo->alloc);
+		ErrorF("bo: used=%d / %d, rem=%d\n",
+		       bo->used, bo->alloc, bo->alloc - bo->used);
 	return false;
 }
 #endif
@@ -2020,7 +2021,7 @@ done:
 		}
 		if (p != first) {
 			__list_del(bo->base.list.prev, bo->base.list.next);
-			list_add_tail(&bo->base.list, &kgem->partial);
+			list_add_tail(&bo->base.list, &p->base.list);
 		}
 		assert(validate_partials(kgem));
 	}


More information about the xorg-commit mailing list