Module: Mesa Branch: master Commit: 0a1e4361e8edd0d0bb5d22be9527ab40080c66e7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0a1e4361e8edd0d0bb5d22be9527ab40080c66e7
Author: Rob Clark <[email protected]> Date: Fri Sep 27 15:35:19 2013 -0400 freedreno/resource: fail more gracefully Fail more gracefully when buffer allocation/import fails. Signed-off-by: Rob Clark <[email protected]> --- src/gallium/drivers/freedreno/freedreno_resource.c | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-) diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c index 197a5a0..bd8c6cb 100644 --- a/src/gallium/drivers/freedreno/freedreno_resource.c +++ b/src/gallium/drivers/freedreno/freedreno_resource.c @@ -157,7 +157,8 @@ fd_resource_destroy(struct pipe_screen *pscreen, struct pipe_resource *prsc) { struct fd_resource *rsc = fd_resource(prsc); - fd_bo_del(rsc->bo); + if (rsc->bo) + fd_bo_del(rsc->bo); FREE(rsc); } @@ -243,8 +244,13 @@ fd_resource_create(struct pipe_screen *pscreen, size = setup_slices(rsc); realloc_bo(rsc, size); + if (!rsc->bo) + goto fail; return prsc; +fail: + fd_resource_destroy(pscreen, prsc); + return NULL; } /** @@ -277,6 +283,8 @@ fd_resource_from_handle(struct pipe_screen *pscreen, prsc->screen = pscreen; rsc->bo = fd_screen_bo_from_handle(pscreen, handle, &slice->pitch); + if (!rsc->bo) + goto fail; rsc->base.vtbl = &fd_resource_vtbl; rsc->cpp = util_format_get_blocksize(tmpl->format); @@ -285,6 +293,10 @@ fd_resource_from_handle(struct pipe_screen *pscreen, assert(rsc->cpp); return prsc; + +fail: + fd_resource_destroy(pscreen, prsc); + return NULL; } static bool render_blit(struct pipe_context *pctx, struct pipe_blit_info *info); _______________________________________________ mesa-commit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-commit
