xf86-video-intel: src/sna/sna_accel.c

Chris Wilson ickle at kemper.freedesktop.org
Sat Aug 10 01:25:38 PDT 2013


 src/sna/sna_accel.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

New commits:
commit 4d5483c253a9a29f54f2eed9b40623c8e9de6c22
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Aug 10 08:59:33 2013 +0100

    sna: Tune pixmap_inplace() not to use a pinned busy GPU bo for replacement
    
    Obviously we can only replace the bo if it is not pinned and so just
    incur a stall when we could have instead rerouted the rendering through
    its CPU bo.
    
    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 040c009..04b063c 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1406,6 +1406,7 @@ static inline bool has_coherent_map(struct sna *sna,
 				    struct kgem_bo *bo,
 				    unsigned flags)
 {
+	assert(bo);
 	assert(bo->map);
 
 	if (!IS_CPU_MAP(bo->map))
@@ -1446,10 +1447,13 @@ static inline bool pixmap_inplace(struct sna *sna,
 	if (wedged(sna) && !priv->pinned)
 		return false;
 
-	if (priv->gpu_damage &&
-	    (priv->clear || (flags & MOVE_READ) == 0) &&
-	    kgem_bo_is_busy(priv->gpu_bo))
-		return false;
+	if (priv->gpu_bo && kgem_bo_is_busy(priv->gpu_bo)) {
+		if ((flags & (MOVE_WRITE | MOVE_READ)) == (MOVE_WRITE | MOVE_READ))
+			return false;
+
+		if ((flags & MOVE_READ) == 0)
+			return !priv->pinned;
+	}
 
 	if (priv->mapped)
 		return has_coherent_map(sna, priv->gpu_bo, flags);
@@ -1845,8 +1849,8 @@ _sna_pixmap_move_to_cpu(PixmapPtr pixmap, unsigned int flags)
 		DBG(("%s: no readbck, discarding gpu damage [%d], pending clear[%d]\n",
 		     __FUNCTION__, priv->gpu_damage != NULL, priv->clear));
 
-		if (priv->create & KGEM_CAN_CREATE_GPU &&
-		    pixmap_inplace(sna, pixmap, priv, true) &&
+		if ((priv->gpu_bo || priv->create & KGEM_CAN_CREATE_GPU) &&
+		    pixmap_inplace(sna, pixmap, priv, flags) &&
 		    sna_pixmap_create_mappable_gpu(pixmap, true)) {
 			DBG(("%s: write inplace\n", __FUNCTION__));
 			assert(priv->cow == NULL || (flags & MOVE_WRITE) == 0);


More information about the xorg-commit mailing list