v3dv: properly return OOM error during pipeline creation
authorAlejandro Piñeiro <apinheiro@igalia.com>
Wed, 29 Apr 2020 13:58:10 +0000 (15:58 +0200)
committerMarge Bot <eric+marge@anholt.net>
Tue, 13 Oct 2020 21:21:30 +0000 (21:21 +0000)
commit1b4a9c7d450739350516b91c9ff913932ed6a9e9
treef78f0316ffe5b9e7d8a5b3cd92ada95f1ab3b40b
parent2894d6af9f3e02e5a0ebd81dc5aad09bda1c9c59
v3dv: properly return OOM error during pipeline creation

So far we were just asserting or aborting if any of the internal
method used during the pipeline creation failed.

We needed to change the return value of several methods, in order to
bubble up the proper memory allocation error.

Note that as the pipeline creation is complex and splitted in several
methods, if an error happens in the middle, it returns back, and rely
on the higher level to call PipelineDestroy. This method needs to take
into account that some of the resources could have not been allocated
when freeing it.

Also note that v3dv_get_shader_variant is used during the pipeline
bind, as with the new resources bound, we need to check if we need to
recompile a new variant. At that moment we are not creating a new
vulkan object so we can really return a OOM error. For now we just
assert on that case.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
src/broadcom/vulkan/v3dv_cmd_buffer.c
src/broadcom/vulkan/v3dv_pipeline.c
src/broadcom/vulkan/v3dv_private.h