From 3a7d6afd85f85b8b10bf0c08b7b5fa5265624850 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 14 May 2016 16:13:33 +0100 Subject: sna: Do not cache the current crtc bo after performing the setcrtc When doing a SETCRTC as a fallack for a failed pageflip, do not use the then current CRTC bo as the next bo for pageflipping - as then we will render into it prior to flipping and so cause tearing. References: https://bugs.freedesktop.org/show_bug.cgi?id=95401 Signed-off-by: Chris Wilson --- src/sna/sna_display.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index 2c6059d2..080efbe2 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -8734,7 +8734,6 @@ void sna_mode_redisplay(struct sna *sna) sna_crtc->bo = kgem_bo_reference(bo); sna_crtc->bo->active_scanout++; - sna_crtc->cache_bo = kgem_bo_reference(bo); } else { BoxRec box; DrawableRec tmp; @@ -8762,10 +8761,10 @@ disable1: __FUNCTION__, __sna_crtc_id(sna_crtc), __sna_crtc_pipe(sna_crtc)); sna_crtc_disable(crtc, false); } - - kgem_bo_destroy(&sna->kgem, bo); - sna_crtc->cache_bo = NULL; } + + kgem_bo_destroy(&sna->kgem, bo); + sna_crtc->cache_bo = NULL; continue; } sna->mode.flip_active++; @@ -8778,6 +8777,8 @@ disable1: sna_crtc->flip_serial = sna_crtc->mode_serial; sna_crtc->flip_pending = true; + assert_scanout(&sna->kgem, sna_crtc->bo, + crtc->mode.HDisplay, crtc->mode.VDisplay); sna_crtc->cache_bo = kgem_bo_reference(sna_crtc->bo); DBG(("%s: recording flip on CRTC:%d handle=%d, active_scanout=%d, serial=%d\n", __FUNCTION__, __sna_crtc_id(sna_crtc), sna_crtc->flip_bo->handle, sna_crtc->flip_bo->active_scanout, sna_crtc->flip_serial)); -- cgit v1.2.3