diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-09-26 14:54:18 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-09-27 10:47:17 +0100 |
commit | ec9ffc9e41e05bc6aef10e25ff82bb99b5f92267 (patch) | |
tree | f884172c35db34e16af8953a444a9ecc5245c935 /src/sna/sna_render.c | |
parent | bbfbe229542cc3278fea3c1865f28d65d3c154e8 (diff) |
sna: Trigger fallback after intermediate pixmap allocation failure
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_render.c')
-rw-r--r-- | src/sna/sna_render.c | 53 |
1 files changed, 34 insertions, 19 deletions
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c index 738cca40..84275c43 100644 --- a/src/sna/sna_render.c +++ b/src/sna/sna_render.c @@ -763,21 +763,27 @@ static int sna_render_picture_downsample(struct sna *sna, DBG(("%s: creating temporary GPU bo %dx%d\n", __FUNCTION__, width, height)); - if (!sna_pixmap_force_to_gpu(pixmap, MOVE_SOURCE_HINT | MOVE_READ)) - return sna_render_picture_fixup(sna, picture, channel, - x, y, w, h, - dst_x, dst_y); - tmp = screen->CreatePixmap(screen, width, height, pixmap->drawable.depth, SNA_CREATE_SCRATCH); - if (!tmp) - return 0; + if (tmp == NULL) + goto fixup; priv = sna_pixmap(tmp); - if (!priv) - goto cleanup_tmp; + if (priv == NULL) { + screen->DestroyPixmap(tmp); + goto fixup; + } + + if (!sna_pixmap_force_to_gpu(pixmap, MOVE_SOURCE_HINT | MOVE_READ)) { +fixup: + DBG(("%s: unable to create GPU bo for target or temporary pixmaps\n", + __FUNCTION__)); + return sna_render_picture_fixup(sna, picture, channel, + x, y, w, h, + dst_x, dst_y); + } format = PictureMatchFormat(screen, pixmap->drawable.depth, @@ -958,8 +964,11 @@ sna_render_pixmap_partial(struct sna *sna, channel->bo = kgem_create_proxy(&sna->kgem, bo, box.y1 * bo->pitch + offset, h * bo->pitch); - if (channel->bo == NULL) + if (channel->bo == NULL) { + DBG(("%s: failed to create proxy for partial (offset=%d, size=%d)\n", + __FUNCTION__, box.y1 * bo->pitch + offset, h * bo->pitch)); return false; + } channel->bo->pitch = bo->pitch; @@ -1029,8 +1038,10 @@ sna_render_picture_partial(struct sna *sna, bo = priv->gpu_bo; } - if (bo->pitch > sna->render.max_3d_pitch) - return 0; + if (bo->pitch > sna->render.max_3d_pitch) { + DBG(("%s: pitch too great %d > %d\n", __FUNCTION__, bo->pitch, sna->render.max_3d_pitch)); + return -1; + } if (bo->tiling) { int tile_width, tile_height, tile_size; @@ -1330,15 +1341,17 @@ sna_render_picture_convolve(struct sna *sna, } pixmap = screen->CreatePixmap(screen, w, h, depth, SNA_CREATE_SCRATCH); - if (pixmap == NullPixmap) - return 0; + if (pixmap == NullPixmap) { + DBG(("%s: pixmap allocation failed\n", __FUNCTION__)); + return -1; + } tmp = CreatePicture(0, &pixmap->drawable, PictureMatchFormat(screen, depth, channel->pict_format), 0, NULL, serverClient, &error); screen->DestroyPixmap(pixmap); if (tmp == NULL) - return 0; + return -1; ValidatePicture(tmp); @@ -1413,15 +1426,17 @@ sna_render_picture_flatten(struct sna *sna, DBG(("%s: %dx%d\n", __FUNCTION__, w, h)); pixmap = screen->CreatePixmap(screen, w, h, 32, SNA_CREATE_SCRATCH); - if (pixmap == NullPixmap) - return 0; + if (pixmap == NullPixmap) { + DBG(("%s: pixmap allocation failed\n", __FUNCTION__)); + return -1; + } tmp = CreatePicture(0, &pixmap->drawable, PictureMatchFormat(screen, 32, PICT_a8r8g8b8), 0, NULL, serverClient, &error); screen->DestroyPixmap(pixmap); if (tmp == NULL) - return 0; + return -1; ValidatePicture(tmp); @@ -1789,7 +1804,7 @@ sna_render_picture_convert(struct sna *sna, tmp = screen->CreatePixmap(screen, w, h, pixmap->drawable.bitsPerPixel, 0); if (tmp == NULL) - return 0; + return -1; dst = CreatePicture(0, &tmp->drawable, PictureMatchFormat(screen, |