sna/present: Skip the unflip if a no-op

If the screen is already scanning out from the desired framebuffer
(because we failed when flipping and already restored the mode), skip
the unflip.

References: https://bugs.freedesktop.org/show_bug.cgi?id=94829
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2016-04-06 08:55:14 +01:00
parent afddc9fe7f
commit 9ce7d47a86
3 changed files with 25 additions and 0 deletions

View File

@ -467,6 +467,7 @@ extern bool sna_cursors_init(ScreenPtr screen, struct sna *sna);
typedef void (*sna_flip_handler_t)(struct drm_event_vblank *e,
void *data);
extern bool sna_needs_page_flip(struct sna *sna, struct kgem_bo *bo);
extern int sna_page_flip(struct sna *sna,
struct kgem_bo *bo,
sna_flip_handler_t handler,

View File

@ -6396,6 +6396,26 @@ static void sna_mode_restore(struct sna *sna)
"Failed to restore display configuration\n");
}
bool sna_needs_page_flip(struct sna *sna, struct kgem_bo *bo)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(sna->scrn);
int i;
for (i = 0; i < sna->mode.num_real_crtc; i++) {
struct sna_crtc *crtc = config->crtc[i]->driver_private;
if (crtc->bo == NULL)
continue;
if (crtc->bo == bo)
continue;
return true;
}
return false;
}
int
sna_page_flip(struct sna *sna,
struct kgem_bo *bo,

View File

@ -830,6 +830,10 @@ reset_mode:
assert(sna_pixmap(screen->GetScreenPixmap(screen))->pinned & PIN_SCANOUT);
/* Are we unflipping after a failure that left our ScreenP in place? */
if (!sna_needs_page_flip(sna, bo))
goto notify;
if (sna->flags & SNA_HAS_ASYNC_FLIP) {
DBG(("%s: trying async flip restore\n", __FUNCTION__));
if (flip__async(sna, NULL, event_id, 0, bo))