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

Chris Wilson ickle at kemper.freedesktop.org
Tue Jan 10 12:09:03 PST 2012


 src/sna/kgem.c      |   12 +++++++-----
 src/sna/sna_accel.c |   14 ++++++++++----
 2 files changed, 17 insertions(+), 9 deletions(-)

New commits:
commit 3c26055639f789b211f7db982e65ec0b86b23d4a
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jan 10 20:06:51 2012 +0000

    sna: Shrink the partial upload buffers before compacting the batch
    
    So that the relocation entries point into the contiguous surface/batch
    and can be trivially fixed up.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 4ecb507..c30c79b 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1159,19 +1159,20 @@ static void kgem_finish_partials(struct kgem *kgem)
 
 		assert(bo->base.rq == kgem->next_request);
 		if (bo->need_io && bo->used < bo->base.size / 2) {
-			int size = PAGE_ALIGN(bo->used);
 			struct kgem_bo *shrink;
 
-			shrink = search_linear_cache(kgem, size,
+			shrink = search_linear_cache(kgem,
+						     PAGE_ALIGN(bo->used),
 						     CREATE_INACTIVE);
 			if (shrink) {
 				int n;
 
-				DBG(("%s: shrnking %d to %d, handle %d to %d\n",
+				DBG(("%s: used=%d, shrinking %d to %d, handle %d to %d\n",
 				     __FUNCTION__,
-				     bo->base.size, shrink->size,
+				     bo->used, bo->base.size, shrink->size,
 				     bo->base.handle, shrink->handle));
 
+				assert(bo->used <= shrink->size);
 				gem_write(kgem->fd, shrink->handle,
 					  0, bo->used, bo->mem);
 
@@ -1388,6 +1389,8 @@ void _kgem_submit(struct kgem *kgem)
 	assert(kgem->nexec < ARRAY_SIZE(kgem->exec));
 	assert(kgem->nfence <= kgem->fence_max);
 
+	kgem_finish_partials(kgem);
+
 	rq = kgem->next_request;
 	if (kgem->surface != kgem->max_batch_size)
 		size = compact_batch_surface(kgem);
@@ -1414,7 +1417,6 @@ void _kgem_submit(struct kgem *kgem)
 		list_add(&rq->bo->request, &rq->buffers);
 
 		kgem_fixup_self_relocs(kgem, rq->bo);
-		kgem_finish_partials(kgem);
 
 #if DEBUG_BATCH
 		__kgem_batch_debug(kgem, batch_end);
commit 7b077a4d3d549cde79d5b876289203788294493c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jan 10 18:40:53 2012 +0000

    sna: Make the check for a single fill-rectangle clearer before modifying damage
    
    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 fc13dfd..2c61b09 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -114,6 +114,11 @@ static inline void region_maybe_clip(RegionRec *r, RegionRec *clip)
 		RegionIntersect(r, r, clip);
 }
 
+static inline bool region_is_singular(const RegionRec *r)
+{
+	return r->data == NULL;
+}
+
 typedef struct box32 {
 	int32_t x1, y1, x2, y2;
 } Box32Rec;
@@ -1723,7 +1728,7 @@ static inline bool clip_box(BoxPtr box, GCPtr gc)
 
 	clip = &gc->pCompositeClip->extents;
 
-	clipped = gc->pCompositeClip->data != NULL;
+	clipped = !region_is_singular(gc->pCompositeClip);
 	if (box->x1 < clip->x1)
 		box->x1 = clip->x1, clipped = true;
 	if (box->x2 > clip->x2)
@@ -1754,7 +1759,7 @@ static inline bool trim_and_translate_box(BoxPtr box, DrawablePtr d, GCPtr gc)
 
 static inline bool box32_clip(Box32Rec *box, GCPtr gc)
 {
-	bool clipped = gc->pCompositeClip->data != NULL;
+	bool clipped = !region_is_singular(gc->pCompositeClip);
 	const BoxRec *clip = &gc->pCompositeClip->extents;
 
 	if (box->x1 < clip->x1)
@@ -6566,7 +6571,7 @@ sna_poly_fill_rect_blt(DrawablePtr drawable,
 	     drawable->x, drawable->y,
 	     clipped));
 
-	if (n == 1 && gc->pCompositeClip->data == NULL) {
+	if (n == 1 && region_is_singular(gc->pCompositeClip)) {
 		BoxRec r;
 		bool success = true;
 
@@ -7988,7 +7993,8 @@ sna_poly_fill_rect(DrawablePtr draw, GCPtr gc, int n, xRectangle *rect)
 	if (!PM_IS_SOLID(draw, gc->planemask))
 		goto fallback;
 
-	if (n == 1 && (flags & 2) == 0 &&
+	if (n == 1 &&
+	    region_is_singular(gc->pCompositeClip) &&
 	    gc->fillStyle != FillStippled && alu_overwrites(gc->alu)) {
 		region.data = NULL;
 		sna_damage_subtract(&priv->cpu_damage, &region);


More information about the xorg-commit mailing list