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

Chris Wilson ickle at kemper.freedesktop.org
Tue Jun 9 00:42:26 PDT 2015


 src/sna/kgem.c      |    3 +++
 src/sna/sna_accel.c |   20 ++++++++++++--------
 2 files changed, 15 insertions(+), 8 deletions(-)

New commits:
commit 5f626e124142bd8968a031451c38967ca5de2f7c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jun 9 08:36:22 2015 +0100

    sna: Pass scanout flag when creating PRIME bo
    
    For PRIME bo, we need to use uncached render targets so that any writes
    are flushed out to main memory where they can be immediately read by a
    PCI device. For simplicity, we just request that PRIME bo be also
    SCANOUTs as that ensures that they will be created with the right
    attributes for coherent main memory.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 2058364..0178df7 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -7910,6 +7910,9 @@ bool kgem_bo_convert_to_gpu(struct kgem *kgem,
 	     __FUNCTION__, bo->handle, flags, __kgem_bo_is_busy(kgem, bo)));
 	assert(bo->tiling == I915_TILING_NONE);
 
+	if (flags & (__MOVE_PRIME | __MOVE_SCANOUT))
+		return false;
+
 	if (kgem->has_llc)
 		return true;
 
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index f41fdfd..049d414 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1132,7 +1132,7 @@ sna_share_pixmap_backing(PixmapPtr pixmap, ScreenPtr slave, void **fd_handle)
 				    pixmap->drawable.height,
 				    pixmap->drawable.bitsPerPixel,
 				    I915_TILING_NONE,
-				    CREATE_GTT_MAP | CREATE_PRIME | CREATE_EXACT);
+				    CREATE_GTT_MAP | CREATE_SCANOUT | CREATE_PRIME | CREATE_EXACT);
 		if (bo == NULL) {
 			DBG(("%s: allocation failed\n", __FUNCTION__));
 			return FALSE;
@@ -1251,7 +1251,7 @@ sna_create_pixmap_shared(struct sna *sna, ScreenPtr screen,
 					      width, height,
 					      pixmap->drawable.bitsPerPixel,
 					      I915_TILING_NONE,
-					      CREATE_GTT_MAP | CREATE_PRIME | CREATE_EXACT);
+					      CREATE_GTT_MAP | CREATE_SCANOUT | CREATE_PRIME | CREATE_EXACT);
 		if (priv->gpu_bo == NULL) {
 			free(priv);
 			FreePixmap(pixmap);
@@ -1958,7 +1958,7 @@ sna_pixmap_undo_cow(struct sna *sna, struct sna_pixmap *priv, unsigned flags)
 			box.y2 = pixmap->drawable.height;
 
 			if (flags & __MOVE_PRIME) {
-				create = CREATE_GTT_MAP | CREATE_PRIME | CREATE_EXACT;
+				create = CREATE_GTT_MAP | CREATE_SCANOUT | CREATE_PRIME | CREATE_EXACT;
 				tiling = I915_TILING_NONE;
 			} else {
 				create = 0;
@@ -4286,7 +4286,7 @@ sna_pixmap_move_to_gpu(PixmapPtr pixmap, unsigned flags)
 				if (flags & MOVE_INPLACE_HINT || (priv->cpu_damage && priv->cpu_bo == NULL))
 					create = CREATE_GTT_MAP | CREATE_INACTIVE;
 				if (flags & __MOVE_PRIME)
-					create |= CREATE_GTT_MAP | CREATE_PRIME | CREATE_EXACT;
+					create |= CREATE_GTT_MAP | CREATE_SCANOUT | CREATE_PRIME | CREATE_EXACT;
 
 				sna_pixmap_alloc_gpu(sna, pixmap, priv, create);
 			}
commit 7fba4aa54d8efb65cb04b88f930e8b5301176770
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jun 9 08:31:29 2015 +0100

    sna: Flush SlavePixmap dirty rects before calling ProcessPending
    
    As the slave may use the ProcessPending damage callback to do its own
    copying, we need to flush before.
    
    Reported-by: Dave Airlie <airlied at redhat.com>
    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 b40b99a..f41fdfd 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -17528,7 +17528,6 @@ static void sna_accel_post_damage(struct sna *sna)
 #if HAS_PIXMAP_SHARING
 	ScreenPtr screen = to_screen_from_sna(sna);
 	PixmapDirtyUpdatePtr dirty;
-	bool flush = false;
 
 	xorg_list_for_each_entry(dirty, &screen->pixmap_dirty_list, ent) {
 		RegionRec region, *damage;
@@ -17638,7 +17637,14 @@ fallback:
 						    box, n, COPY_LAST))
 				goto fallback;
 
-			flush = true;
+			/* Before signalling the slave via ProcessPending,
+			 * ensure not only the batch is submitted as the
+			 * slave may be using the Damage callback to perform
+			 * its copy, but also that the memory must be coherent
+			 * - we need to treat it as uncached for the PCI slave
+			 * will bypass LLC.
+			 */
+			kgem_bo_sync__gtt(&sna->kgem, __sna_pixmap_get_bo(dst));
 		}
 
 		DamageRegionProcessPending(&dirty->slave_dst->drawable);
@@ -17646,8 +17652,6 @@ skip:
 		RegionUninit(&region);
 		DamageEmpty(dirty->damage);
 	}
-	if (flush)
-		kgem_submit(&sna->kgem);
 #endif
 }
 


More information about the xorg-commit mailing list