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

Chris Wilson ickle at kemper.freedesktop.org
Fri Jul 19 03:56:57 PDT 2013


 src/sna/sna_dri.c |   30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

New commits:
commit 2c8c4626908987e1bb5b16c49bc16dabac7d89dc
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Jul 19 11:55:09 2013 +0100

    sna/dri: Return early is the DRI2CopyRegion is not attached to the GPU
    
    This can happen if the DRI client passes in a stale DRI2Drawable - that
    is the Drawable now references a new Pixmap which the client has not run
    DRI2GetBuffers against.
    
    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 7b114cb..3cceebe 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -996,6 +996,8 @@ sna_dri_copy_region(DrawablePtr draw,
 		copy = (void *)sna_dri_copy_to_front;
 #ifndef STRICT_BLIT
 		dst = sna_pixmap_get_bo(pixmap);
+		if (dst == NULL)
+			return;
 #endif
 	}
 
@@ -1011,6 +1013,8 @@ sna_dri_copy_region(DrawablePtr draw,
 		copy = sna_dri_copy_from_front;
 #ifndef STRICT_BLIT
 		src = sna_pixmap_get_bo(pixmap);
+		if (src == NULL)
+			return;
 #endif
 	}
 
commit e5036fb15983a1d3547eaab381c18b3edf4310b4
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Jul 19 11:51:40 2013 +0100

    sna/dri: Reject invalid DRI2Drawables if STRICT_BLIT is defined
    
    Simply reject any attempts to copy using stale references (i.e. the
    DRI2Drawable has changed structure but the client hasn't yet noticed).
    
    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 e10605f..7b114cb 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -60,6 +60,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #define COLOR_PREFER_TILING_Y 0
 
+#define STRICT_BLIT 1
+
 enum frame_event_type {
 	DRI2_SWAP,
 	DRI2_SWAP_WAIT,
@@ -252,8 +254,10 @@ sna_dri_create_buffer(DrawablePtr draw,
 	uint32_t size;
 	int bpp;
 
-	DBG(("%s(attachment=%d, format=%d, drawable=%dx%d)\n",
-	     __FUNCTION__, attachment, format, draw->width, draw->height));
+	DBG(("%s pixmap=%ld, (attachment=%d, format=%d, drawable=%dx%d)\n",
+	     __FUNCTION__,
+	     get_drawable_pixmap(draw)->drawable.serialNumber,
+	     attachment, format, draw->width, draw->height));
 
 	pixmap = NULL;
 	size = (uint32_t)draw->height << 16 | draw->width;
@@ -907,7 +911,7 @@ can_blit(struct sna *sna,
 	if (draw->type == DRAWABLE_PIXMAP)
 		return true;
 
-#if 0
+#ifdef STRICT_BLIT
 	if (get_private(dst)->pixmap != get_drawable_pixmap(draw)) {
 		DBG(("%s: reject as dst pixmap=%ld, but expecting pixmap=%ld\n",
 		     __FUNCTION__,
@@ -987,11 +991,13 @@ sna_dri_copy_region(DrawablePtr draw,
 	if (!can_blit(sna, draw, dst_buffer, src_buffer))
 		return;
 
+	dst = get_private(dst_buffer)->bo;
 	if (dst_buffer->attachment == DRI2BufferFrontLeft) {
-		dst = sna_pixmap_get_bo(pixmap);
 		copy = (void *)sna_dri_copy_to_front;
-	} else
-		dst = get_private(dst_buffer)->bo;
+#ifndef STRICT_BLIT
+		dst = sna_pixmap_get_bo(pixmap);
+#endif
+	}
 
 	DBG(("%s: dst -- attachment=%d, name=%d, handle=%d [screen=%d]\n",
 	     __FUNCTION__,
@@ -999,12 +1005,14 @@ sna_dri_copy_region(DrawablePtr draw,
 	     sna_pixmap_get_bo(sna->front)->handle));
 	assert(dst != NULL);
 
+	src = get_private(src_buffer)->bo;
 	if (src_buffer->attachment == DRI2BufferFrontLeft) {
-		src = sna_pixmap_get_bo(pixmap);
 		assert(copy == sna_dri_copy);
 		copy = sna_dri_copy_from_front;
-	} else
-		src = get_private(src_buffer)->bo;
+#ifndef STRICT_BLIT
+		src = sna_pixmap_get_bo(pixmap);
+#endif
+	}
 
 	DBG(("%s: src -- attachment=%d, name=%d, handle=%d\n",
 	     __FUNCTION__,


More information about the xorg-commit mailing list