xf86-video-intel: 3 commits - src/sna/sna_dri2.c

Chris Wilson ickle at kemper.freedesktop.org
Sat Jun 13 05:20:24 PDT 2015


 src/sna/sna_dri2.c |   55 ++++++++++++++++++++++++++++++++++++++---------------
 1 file changed, 40 insertions(+), 15 deletions(-)

New commits:
commit ed7bcae0ab0af41bc51dbcb729e4af34e2ba5094
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Jun 13 12:53:19 2015 +0100

    sna/dri2: SWAP_THROTTLE is also used for a delayed SWAP
    
    If there is already a pending operation on the drawable, the swap is
    queued. It is queued with SWAP_THROTTLE which classes with the
    vblank_mode=0 chaining, so the choice is to either review all other uses
    of SWAP_THROTTLE and duplicate the chain swap handling, or to choose when
    use to the alternate copy or back buffer. This patch opts for the
    latter.
    
    Fixes regression from
    commit dcb4d323ca19f86fbe0230378ac9035161a70f9e
    Author: Chris Wilson <chris at chris-wilson.co.uk>
    Date:   Thu Jun 11 13:54:49 2015 +0100
    
        sna/dri2: Mark the pending backbuffer copy as active
    
    Reported-by: Christoph Haag <haagch at frickel.club>
    Reported-by: Andreas Reis <andreas.reis at gmail.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90968
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c
index 6cb346f..1041c52 100644
--- a/src/sna/sna_dri2.c
+++ b/src/sna/sna_dri2.c
@@ -2261,16 +2261,10 @@ static void chain_swap(struct sna_dri2_event *chain)
 		 * exchange back again so that we are consistent with the
 		 * client once more.
 		 */
-		assert(get_private(chain->back)->copy);
-		DBG(("%s: removing active marker [%d] from handle=%d\n",
-		     __FUNCTION__,
-		     get_private(chain->back)->copy->active_scanout,
-		     get_private(chain->back)->copy->handle));
-		assert(get_private(chain->back)->copy->active_scanout);
-		get_private(chain->back)->copy->active_scanout--;
-
-		tmp = get_private(chain->back)->bo;
-		 get_private(chain->back)->bo = get_private(chain->back)->copy;
+		if (get_private(chain->back)->copy) {
+			tmp = get_private(chain->back)->bo;
+			get_private(chain->back)->bo = get_private(chain->back)->copy;
+		}
 
 		if (can_xchg(chain->sna, chain->draw, chain->front, chain->back)) {
 			sna_dri2_xchg(chain->draw, chain->front, chain->back);
@@ -2280,10 +2274,21 @@ static void chain_swap(struct sna_dri2_event *chain)
 			assert(chain->queued);
 			__sna_dri2_copy_event(chain, DRI2_BO);
 		}
-		get_private(chain->back)->bo = tmp;
-		kgem_bo_destroy(&chain->sna->kgem,
-				get_private(chain->back)->copy);
-		get_private(chain->back)->copy = NULL;
+
+		if (get_private(chain->back)->copy) {
+			DBG(("%s: removing active marker [%d] from handle=%d\n",
+			     __FUNCTION__,
+			     get_private(chain->back)->copy->active_scanout,
+			     get_private(chain->back)->copy->handle));
+			assert(get_private(chain->back)->copy->active_scanout);
+			get_private(chain->back)->copy->active_scanout--;
+
+			kgem_bo_destroy(&chain->sna->kgem,
+					get_private(chain->back)->copy);
+			get_private(chain->back)->copy = NULL;
+
+			get_private(chain->back)->bo = tmp;
+		}
 	case SWAP:
 		break;
 	default:
commit 7e965a45d1bb3d39ddb9c62dde536d0d66e92537
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Jun 13 09:30:05 2015 +0100

    sna/dri2: Extend keepalives out to 100ms
    
    Keep the swap cache around for 100ms, so only if the app drops below
    10fps do we start having to recreate buffers on the fly.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c
index 553b111..6cb346f 100644
--- a/src/sna/sna_dri2.c
+++ b/src/sna/sna_dri2.c
@@ -144,7 +144,7 @@ struct sna_dri2_event {
 #endif
 
 #if USE_ASYNC_SWAP
-#define KEEPALIVE 4 /* wait ~50ms before discarding swap caches */
+#define KEEPALIVE 8 /* wait ~100ms before discarding swap caches */
 #define APPLY_DAMAGE 0
 #else
 #define USE_ASYNC_SWAP 0
commit a0af3d1856e51848ce411daa1d4e87bacc274f7f
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Jun 13 09:29:12 2015 +0100

    sna/dri2: Extend keepalives to windowed swaps
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c
index 040aebb..553b111 100644
--- a/src/sna/sna_dri2.c
+++ b/src/sna/sna_dri2.c
@@ -100,6 +100,7 @@ enum event_type {
 	SWAP,
 	SWAP_WAIT,
 	SWAP_THROTTLE,
+	SWAP_ALIVE,
 	FLIP,
 	FLIP_THROTTLE,
 	FLIP_COMPLETE,
@@ -1543,6 +1544,7 @@ sna_dri2_add_event(struct sna *sna,
 	info->draw = draw;
 	info->crtc = crtc;
 	info->pipe = sna_crtc_pipe(crtc);
+	info->keepalive = 1;
 
 	if (!add_event_to_client(info, sna, client)) {
 		free(info);
@@ -2426,6 +2428,8 @@ void sna_dri2_vblank_handler(struct drm_event_vblank *event)
 			frame_swap_complete(info, DRI2_BLIT_COMPLETE);
 		}
 		break;
+	case SWAP_ALIVE:
+		break;
 
 	case WAITMSC:
 		assert(info->client);
@@ -2445,6 +2449,21 @@ void sna_dri2_vblank_handler(struct drm_event_vblank *event)
 		sna_dri2_remove_event((WindowPtr)draw, info);
 		chain_swap(info->chain);
 		info->draw = NULL;
+	} else if (--info->keepalive) {
+		assert(info->type = SWAP_ALIVE || SWAP_THROTTLE);
+		info->type = SWAP_ALIVE;
+		info->queued = true;
+
+		DBG(("%s: requeing keepalive=%d\n",
+		     __FUNCTION__, info->keepalive));
+
+		VG_CLEAR(vbl);
+		vbl.request.type =
+			DRM_VBLANK_RELATIVE |
+			DRM_VBLANK_EVENT;
+		vbl.request.sequence = 1;
+		vbl.request.signal = (uintptr_t)info;
+		return;
 	}
 
 done:
@@ -2468,6 +2487,7 @@ sna_dri2_immediate_blit(struct sna *sna,
 
 	info->type = SWAP_THROTTLE;
 	info->sync = sync;
+	info->keepalive = KEEPALIVE;
 	if (chain == info) {
 		union drm_wait_vblank vbl;
 


More information about the xorg-commit mailing list