Module: Mesa Branch: main Commit: 235e5806b3654f73b368e4357d4da86514de8e43 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=235e5806b3654f73b368e4357d4da86514de8e43
Author: Tapani Pälli <[email protected]> Date: Fri Feb 10 10:02:29 2023 +0200 iris: handle error in iris_resource_from_handle In similar manner as fdab8fef7aff we might fail creating resource, let application handle the error. Application may have given wrong input pitch when importing dmabuf. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8248 Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: José Roberto de Souza <[email protected]> Reviewed-by: Nanley Chery <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21233> --- src/gallium/drivers/iris/iris_resource.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index 18a5377179b..69a4bdacc15 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -1421,13 +1421,15 @@ iris_resource_from_handle(struct pipe_screen *pscreen, modifier = tiling_to_modifier(tiling); } - UNUSED const bool isl_surf_created_successfully = + const bool isl_surf_created_successfully = iris_resource_configure_main(screen, res, templ, modifier, whandle->stride); - assert(isl_surf_created_successfully); + if (!isl_surf_created_successfully) + goto fail; + + if (!iris_resource_configure_aux(screen, res, true)) + goto fail; - UNUSED const bool ok = iris_resource_configure_aux(screen, res, true); - assert(ok); /* The gallium dri layer will create a separate plane resource for the * aux image. iris_resource_finish_aux_import will merge the separate aux * parameters back into a single iris_resource.
