From 0a8a852940d69bfa306da6e5744f616b8f8d8ee5 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 3 Apr 2018 19:03:01 +0100 Subject: [PATCH] sna: Report the move_to_gpu failed if the allocation failed Do not try and workaround the failure by forcing the wait-for-flip as we may be inside a vblank handler already. Just report the move failed and expect the caller to skip the draw, fairly standard practice for allocation failure handling (stale output rather than crash). Signed-off-by: Chris Wilson --- src/sna/sna_display.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index becc6061..07c7ad61 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -1792,23 +1792,18 @@ static bool wait_for_shadow(struct sna *sna, pixmap->drawable.bitsPerPixel, priv->gpu_bo->tiling, CREATE_EXACT | CREATE_SCANOUT); - if (bo != NULL) { - DBG(("%s: replacing still-attached GPU bo handle=%d, flips=%d\n", - __FUNCTION__, priv->gpu_bo->tiling, sna->mode.flip_active)); + if (bo == NULL) + return false; - RegionUninit(&sna->mode.shadow_region); - sna->mode.shadow_region.extents.x1 = 0; - sna->mode.shadow_region.extents.y1 = 0; - sna->mode.shadow_region.extents.x2 = pixmap->drawable.width; - sna->mode.shadow_region.extents.y2 = pixmap->drawable.height; - sna->mode.shadow_region.data = NULL; - } else { - while (sna->mode.flip_active && - sna_mode_wait_for_event(sna)) - sna_mode_wakeup(sna); + DBG(("%s: replacing still-attached GPU bo handle=%d, flips=%d\n", + __FUNCTION__, priv->gpu_bo->tiling, sna->mode.flip_active)); - bo = sna->mode.shadow; - } + RegionUninit(&sna->mode.shadow_region); + sna->mode.shadow_region.extents.x1 = 0; + sna->mode.shadow_region.extents.y1 = 0; + sna->mode.shadow_region.extents.x2 = pixmap->drawable.width; + sna->mode.shadow_region.extents.y2 = pixmap->drawable.height; + sna->mode.shadow_region.data = NULL; } assert(sna->mode.shadow_wait); sna->mode.shadow_wait = false;