xf86-video-intel: 3 commits - src/sna/sna_accel.c src/sna/sna_io.c src/sna/sna_render.c

Chris Wilson ickle at kemper.freedesktop.org
Mon Jun 18 16:39:54 PDT 2012


 src/sna/sna_accel.c  |   13 ++++++++++++-
 src/sna/sna_io.c     |   12 +++++++-----
 src/sna/sna_render.c |    3 ++-
 3 files changed, 21 insertions(+), 7 deletions(-)

New commits:
commit b0b2d3c9663c29e9844aef1608416ae40c194b55
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jun 19 00:41:35 2012 +0100

    sna: Avoid copying unintialised data during source picture upload
    
    If we have never written to a pixmap, then there will be neither a GPU
    or shadow pointer and we would attempt to copy a NULL pointer. In this
    case as the user is expecting to copy unintialised data we are at
    liberty to replace those undefined values with the clear color.
    
    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 4dc7062..199fdd5 100644
--- a/src/sna/sna_render.c
+++ b/src/sna/sna_render.c
@@ -452,7 +452,8 @@ static struct kgem_bo *upload(struct sna *sna,
 			priv->mapped = false;
 		}
 		if (pixmap->devPrivate.ptr == NULL) {
-			assert(priv->ptr);
+			if (priv->ptr == NULL) /* uninitialised */
+				return NULL;
 			assert(priv->stride);
 			pixmap->devPrivate.ptr = priv->ptr;
 			pixmap->devKind = priv->stride;
commit 38472fcc53c5dceb98b96458183e6729b8311a43
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jun 19 00:37:12 2012 +0100

    sna: Double check that the source is busy before performing indirect reads
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_io.c b/src/sna/sna_io.c
index 01b8d2c..8d04548 100644
--- a/src/sna/sna_io.c
+++ b/src/sna/sna_io.c
@@ -122,7 +122,7 @@ static bool download_inplace(struct kgem *kgem, struct kgem_bo *bo)
 	if (FORCE_INPLACE)
 		return FORCE_INPLACE > 0;
 
-	return !kgem_bo_is_busy(bo) || bo->tiling == I915_TILING_NONE;
+	return !__kgem_bo_is_busy(kgem, bo) || bo->tiling == I915_TILING_NONE;
 }
 
 void sna_read_boxes(struct sna *sna,
@@ -1158,21 +1158,23 @@ bool sna_replace(struct sna *sna,
 {
 	struct kgem_bo *bo = *_bo;
 	struct kgem *kgem = &sna->kgem;
+	bool busy;
 	void *dst;
 
-	DBG(("%s(handle=%d, %dx%d, bpp=%d, tiling=%d)\n",
+	busy = __kgem_bo_is_busy(kgem, bo);
+	DBG(("%s(handle=%d, %dx%d, bpp=%d, tiling=%d) busy?=%d\n",
 	     __FUNCTION__, bo->handle,
 	     pixmap->drawable.width,
 	     pixmap->drawable.height,
 	     pixmap->drawable.bitsPerPixel,
-	     bo->tiling));
+	     bo->tiling, busy));
 	assert(!bo->flush);
 
-	if ((!kgem_bo_can_map(kgem, bo) || kgem_bo_is_busy(bo)) &&
+	if ((busy || !kgem_bo_can_map(kgem, bo)) &&
 	    indirect_replace(sna, pixmap, bo, src, stride))
 		return true;
 
-	if (kgem_bo_is_busy(bo)) {
+	if (busy) {
 		struct kgem_bo *new_bo;
 
 		new_bo = kgem_create_2d(kgem,
commit 8cdfb8c24c8b49c88451714d80293c66d63e8c01
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jun 19 00:36:41 2012 +0100

    sna: Fix up the shadow pointer on the source when copying
    
    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 da50942..13f91c2 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -4023,7 +4023,18 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
 			}
 			assert_pixmap_damage(dst_pixmap);
 		} else {
-			assert(!src_priv->gpu_bo);
+			if (src_priv) {
+				/* Fixup the shadow pointer as neccessary */
+				assert(!src_priv->gpu_bo);
+				assert(!src_priv->mapped);
+				if (src_pixmap->devPrivate.ptr == NULL) {
+					if (!src_priv->ptr) /* uninitialised!*/
+						goto out;
+					assert(src_priv->stride);
+					src_pixmap->devPrivate.ptr = src_priv->ptr;
+					src_pixmap->devKind = src_priv->stride;
+				}
+			}
 
 			if (!dst_priv->pinned && replaces) {
 				stride = src_pixmap->devKind;


More information about the xorg-commit mailing list