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

Chris Wilson ickle at kemper.freedesktop.org
Thu Jun 16 03:25:25 PDT 2011


 src/sna/kgem.c      |    8 +++++++-
 src/sna/sna_accel.c |    6 ++++++
 src/sna/sna_dri.c   |   10 ++++++++++
 3 files changed, 23 insertions(+), 1 deletion(-)

New commits:
commit 2ff36af7e1841a82fd43a9317d07b3229a309df5
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Jun 16 11:23:16 2011 +0100

    sna/accel: Prevent initialising a region with an invalid box
    
    pixman complains if you attempt to use a region created with an invalid
    box, so don't do that.
    
    Reported-by: Reinhard Karcher <reinhard.karcher at gmx.net>
    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 9e03caf..0a0cd8f 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -969,6 +969,8 @@ sna_put_image(DrawablePtr drawable, GCPtr gc, int depth,
 		box.x2 = pixmap->drawable.width;
 	if (box.y2 > pixmap->drawable.height)
 		box.y2 = pixmap->drawable.height;
+	if (BOX_EMPTY(&box))
+		return;
 
 	RegionInit(&region, &box, 1);
 
@@ -2756,6 +2758,8 @@ sna_image_glyph(DrawablePtr drawable, GCPtr gc,
 	box.y1 = y - FONTASCENT(gc->font);
 	box.y2 = y + FONTDESCENT(gc->font);
 	TRIM_BOX(box, drawable);
+	if (BOX_EMPTY(box))
+		return;
 	TRANSLATE_BOX(box, drawable);
 
 	DBG(("%s: extents(%d, %d), (%d, %d)\n",
@@ -2793,6 +2797,8 @@ sna_poly_glyph(DrawablePtr drawable, GCPtr gc,
 	box.y2 = y + extents.overallDescent;
 
 	TRIM_BOX(box, drawable);
+	if (BOX_EMPTY(box))
+		return;
 	TRANSLATE_BOX(box, drawable);
 
 	DBG(("%s: extents(%d, %d), (%d, %d)\n",
commit 3c02110052ecf69d43577ed8537a8850227da560
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Jun 16 10:30:58 2011 +0100

    sna/dri: Add some comments to explain the choice of flags upon the bo
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index f4ecbec..7516fe9 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -144,12 +144,22 @@ static struct kgem_bo *sna_pixmap_set_dri(struct sna *sna,
 	if (priv->cpu_damage)
 		list_add(&priv->list, &sna->dirty_pixmaps);
 
+	/* The bo is outside of our control, so presume it is written to */
+	priv->gpu_bo->need_flush = 1;
+
+	/* We need to submit any modifications to and reads from this
+	 * buffer before we send any reply to the Client.
+	 *
+	 * As we don't track which Client, we flush for all.
+	 */
 	priv->flush = 1;
 	priv->gpu_bo->flush = 1;
 	if (priv->gpu_bo->exec)
 		sna->kgem.flush = 1;
 
+	/* Don't allow this named buffer to be replaced */
 	priv->pinned = 1;
+
 	return priv->gpu_bo;
 }
 
commit 881f961a1c78e554e566ef624d6edcf28fee8fdf
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jun 15 19:11:05 2011 +0100

    sna: Clear the gpu flag once is not busy and no flush is pending
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 1d5ed06..fd220ab 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -176,8 +176,10 @@ Bool kgem_bo_write(struct kgem *kgem, struct kgem_bo *bo,
 	if (gem_write(kgem->fd, bo->handle, 0, length, data))
 		return FALSE;
 
+	bo->needs_flush = false;
 	if (bo->gpu)
 		kgem_retire(kgem);
+	assert(bo->gpu == false);
 	return TRUE;
 }
 
@@ -569,13 +571,13 @@ void kgem_retire(struct kgem *kgem)
 					      request);
 			list_del(&bo->request);
 			bo->rq = NULL;
+			bo->gpu = bo->needs_flush;
 
 			if (bo->refcnt == 0) {
 				assert(bo->deleted);
 				if (bo->needs_flush) {
 					list_add(&bo->request, &kgem->flushing);
 				} else if (bo->reusable) {
-					bo->gpu = false;
 					list_move(&bo->list,
 						  inactive(kgem, bo->size));
 				} else {
@@ -1607,8 +1609,10 @@ void kgem_bo_sync(struct kgem *kgem, struct kgem_bo *bo, bool for_write)
 	set_domain.write_domain = for_write ? I915_GEM_DOMAIN_CPU : 0;
 
 	drmIoctl(kgem->fd, DRM_IOCTL_I915_GEM_SET_DOMAIN, &set_domain);
+	bo->needs_flush = false;
 	if (bo->gpu)
 		kgem_retire(kgem);
+	assert(bo->gpu == false);
 	bo->cpu_read = true;
 	if (for_write)
 		bo->cpu_write = true;
@@ -1804,8 +1808,10 @@ void kgem_buffer_sync(struct kgem *kgem, struct kgem_bo *_bo)
 				  0, bo->used, bo+1);
 		else
 			gem_read(kgem->fd, bo->base.handle, bo+1, bo->used);
+		bo->base.needs_flush = false;
 		if (bo->base.gpu)
 			kgem_retire(kgem);
+		assert(bo->base.gpu == false);
 		bo->need_io = 0;
 	}
 


More information about the xorg-commit mailing list