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

Chris Wilson ickle at kemper.freedesktop.org
Tue May 17 06:58:46 UTC 2016


 src/sna/sna_display.c |   30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

New commits:
commit a508b11bde9f3119b49b3e0f652587efb9e037af
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue May 17 07:55:03 2016 +0100

    sna: Don't skip migration-to-GPU for TearFree
    
    In 46caee86db0f ("sna: Fix reporting of errno after setcrtc failure"),
    the intention was to avoid reporting a fail to migrate whilst wedged for
    a simple copy from the frontbuffer to TearFree's shadow buffer. However,
    by skipping the migration, we never flushed any dirt from the CPU buffer
    prior to doing the TearFree flip.
    
    References: https://bugs.freedesktop.org/show_bug.cgi?id=95401#c7
    References: https://bugs.freedesktop.org/show_bug.cgi?id=95414#c4
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 7976171..16d0321 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -8519,11 +8519,9 @@ static bool move_crtc_to_gpu(struct sna *sna)
 	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(sna->scrn);
 	int i;
 
-	if (sna->flags & SNA_TEAR_FREE)
-		return true;
-
 	for (i = 0; i < sna->mode.num_real_crtc; i++) {
 		struct sna_crtc *crtc = to_sna_crtc(config->crtc[i]);
+		unsigned hint;
 
 		assert(crtc);
 
@@ -8539,10 +8537,13 @@ static bool move_crtc_to_gpu(struct sna *sna)
 		if (crtc->shadow_bo)
 			continue;
 
+		hint = MOVE_READ | MOVE_ASYNC_HINT | __MOVE_SCANOUT;
+		if (sna->flags & SNA_TEAR_FREE)
+			hint |= __MOVE_FORCE;
+
 		DBG(("%s: CRTC %d [pipe=%d] requires frontbuffer\n",
 		     __FUNCTION__, __sna_crtc_id(crtc), __sna_crtc_pipe(crtc)));
-		return sna_pixmap_move_to_gpu(sna->front,
-					      MOVE_READ | MOVE_ASYNC_HINT | __MOVE_SCANOUT);
+		return sna_pixmap_move_to_gpu(sna->front, hint);
 	}
 
 	return true;
commit 48569eb18d125e20aa817549506fc4c1609829c9
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue May 17 07:45:46 2016 +0100

    sna: Track the minimum damage when doing CRTC-local TearFree
    
    We avoid having to redraw the entire CRTC's buffer on every flip as we
    know the contents from the previous flip are still available and only
    need to invalidate the dirty region.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index d01e6a4..7976171 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -210,6 +210,7 @@ struct sna_crtc {
 
 	struct pict_f_transform cursor_to_fb, fb_to_cursor;
 
+	RegionRec crtc_damage;
 	uint16_t shadow_bo_width, shadow_bo_height;
 
 	uint32_t rotation;
@@ -2749,6 +2750,7 @@ sna_crtc_damage(xf86CrtcPtr crtc)
 	assert(sna->mode.shadow_damage && sna->mode.shadow_active);
 	damage = DamageRegion(sna->mode.shadow_damage);
 	RegionUnion(damage, damage, &region);
+	to_sna_crtc(crtc)->crtc_damage = region;
 
 	DBG(("%s: damage now %dx[(%d, %d), (%d, %d)]\n",
 	     __FUNCTION__,
@@ -8693,23 +8695,28 @@ void sna_mode_redisplay(struct sna *sna)
 		sigio = sigio_block();
 		if (!box_empty(&damage.extents)) {
 			if (sna->flags & SNA_TEAR_FREE) {
+				RegionRec new_damage;
 				struct drm_mode_crtc_page_flip arg;
 				struct kgem_bo *bo;
 
-				RegionUninit(&damage);
-				damage.extents = crtc->bounds;
-				damage.data = NULL;
+				RegionNull(&new_damage);
+				RegionCopy(&new_damage, &damage);
 
 				bo = sna_crtc->cache_bo;
-				if (bo == NULL)
+				if (bo == NULL) {
+					damage.extents = crtc->bounds;
+					damage.data = NULL;
 					bo = kgem_create_2d(&sna->kgem,
 							    crtc->mode.HDisplay,
 							    crtc->mode.VDisplay,
 							    crtc->scrn->bitsPerPixel,
 							    sna_crtc->bo->tiling,
 							    CREATE_SCANOUT);
-				if (bo == NULL)
-					continue;
+					if (bo == NULL)
+						continue;
+				} else
+					RegionUnion(&damage, &damage, &sna_crtc->crtc_damage);
+				sna_crtc->crtc_damage = new_damage;
 
 				sna_crtc_redisplay(crtc, &damage, bo);
 				kgem_bo_submit(&sna->kgem, bo);


More information about the xorg-commit mailing list