xf86-video-intel: 2 commits - src/sna/sna_blt.c src/sna/sna_render_inline.h

Chris Wilson ickle at kemper.freedesktop.org
Sun Jun 17 11:31:47 PDT 2012


 src/sna/sna_blt.c           |   45 ++++++++++++++++++++++++++++++++++++++++----
 src/sna/sna_render_inline.h |    6 -----
 2 files changed, 42 insertions(+), 9 deletions(-)

New commits:
commit 8695c4c77666cd07eab51efcbc7c4f11c85250fd
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Jun 17 16:53:53 2012 +0100

    sna: Fix the blt composite op with no-ops
    
    When returning early because the operation is a no-op, we still need to
    fill in the function pointers to prevent a later NULL dereference.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c
index 83bcd69..4a9dbff 100644
--- a/src/sna/sna_blt.c
+++ b/src/sna/sna_blt.c
@@ -889,6 +889,38 @@ static void blt_composite_fill_boxes(struct sna *sna,
 	} while (--n);
 }
 
+fastcall
+static void blt_composite_nop(struct sna *sna,
+			       const struct sna_composite_op *op,
+			       const struct sna_composite_rectangles *r)
+{
+}
+
+fastcall static void blt_composite_nop_box(struct sna *sna,
+					   const struct sna_composite_op *op,
+					   const BoxRec *box)
+{
+}
+
+static void blt_composite_nop_boxes(struct sna *sna,
+				    const struct sna_composite_op *op,
+				    const BoxRec *box, int n)
+{
+}
+
+static Bool
+prepare_blt_nop(struct sna *sna,
+		struct sna_composite_op *op)
+{
+	DBG(("%s\n", __FUNCTION__));
+
+	op->blt   = blt_composite_nop;
+	op->box   = blt_composite_nop_box;
+	op->boxes = blt_composite_nop_boxes;
+	op->done  = nop_done;
+	return TRUE;
+}
+
 static Bool
 prepare_blt_clear(struct sna *sna,
 		  struct sna_composite_op *op)
@@ -1100,14 +1132,18 @@ prepare_blt_copy(struct sna *sna,
 	PixmapPtr src = op->u.blt.src_pixmap;
 	struct sna_pixmap *priv = sna_pixmap(src);
 
-	if (!kgem_bo_can_blt(&sna->kgem, priv->gpu_bo))
+	if (!kgem_bo_can_blt(&sna->kgem, priv->gpu_bo)) {
+		DBG(("%s: fallback -- can't blt from source\n", __FUNCTION__));
 		return FALSE;
+	}
 
 	if (!kgem_check_many_bo_fenced(&sna->kgem, op->dst.bo, priv->gpu_bo, NULL)) {
 		_kgem_submit(&sna->kgem);
 		if (!kgem_check_many_bo_fenced(&sna->kgem,
-					       op->dst.bo, priv->gpu_bo, NULL))
+					       op->dst.bo, priv->gpu_bo, NULL)) {
+			DBG(("%s: fallback -- no room in aperture\n", __FUNCTION__));
 			return FALSE;
+		}
 		_kgem_set_mode(&sna->kgem, KGEM_BLT);
 	}
 
@@ -1586,8 +1622,9 @@ sna_blt_composite(struct sna *sna,
 	if (op == PictOpClear) {
 clear:
 		if (was_clear)
-			return TRUE;
-		return prepare_blt_clear(sna, tmp);
+			return prepare_blt_nop(sna, tmp);
+		else
+			return prepare_blt_clear(sna, tmp);
 	}
 
 	if (is_solid(src)) {
commit 7905ddae1dbc8805d0fadbd6d21c7a5df7e715fc
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Jun 17 17:01:12 2012 +0100

    sna: Further refine choice of placement when uploading source data.
    
    The goal is cheaply spot a simple copy operation that can be performed
    on the CPU without having to load both parties onto the GPU.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_render_inline.h b/src/sna/sna_render_inline.h
index 15512fd..8a5a405 100644
--- a/src/sna/sna_render_inline.h
+++ b/src/sna/sna_render_inline.h
@@ -123,11 +123,7 @@ static inline Bool
 unattached(DrawablePtr drawable)
 {
 	struct sna_pixmap *priv = sna_pixmap_from_drawable(drawable);
-
-	if (priv == NULL || DAMAGE_IS_ALL(priv->cpu_damage))
-		return true;
-
-	return priv->gpu_bo == NULL && priv->cpu_bo == NULL;
+	return priv == NULL || (priv->gpu_damage == NULL && priv->cpu_damage);
 }
 
 static inline Bool


More information about the xorg-commit mailing list