[Mesa-dev] [PATCH 16/16] anv/cmd_buffer: handle out of device memory during binding table emission

Jason Ekstrand jason at jlekstrand.net
Tue Mar 7 21:25:58 UTC 2017


On Mon, Mar 6, 2017 at 11:16 PM, Iago Toral Quiroga <itoral at igalia.com>
wrote:

> ---
>  src/intel/vulkan/genX_cmd_buffer.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/src/intel/vulkan/genX_cmd_buffer.c
> b/src/intel/vulkan/genX_cmd_buffer.c
> index 8b752c4..23d7493 100644
> --- a/src/intel/vulkan/genX_cmd_buffer.c
> +++ b/src/intel/vulkan/genX_cmd_buffer.c
> @@ -1112,7 +1112,7 @@ emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
>     uint32_t *bt_map = bt_state->map;
>
>     if (bt_state->map == NULL)
> -      return VK_ERROR_OUT_OF_DEVICE_MEMORY;
> +      return cmd_buffer->error_status = VK_ERROR_OUT_OF_DEVICE_MEMORY;
>
>     if (stage == MESA_SHADER_COMPUTE &&
>         get_cs_prog_data(cmd_buffer->state.compute_pipeline)->uses_num_work_groups)
> {
> @@ -1295,7 +1295,7 @@ emit_samplers(struct anv_cmd_buffer *cmd_buffer,
>     *state = anv_cmd_buffer_alloc_dynamic_state(cmd_buffer, size, 32);
>
>     if (state->map == NULL)
> -      return VK_ERROR_OUT_OF_DEVICE_MEMORY;
> +      return cmd_buffer->error_status = VK_ERROR_OUT_OF_DEVICE_MEMORY;
>
>     for (uint32_t s = 0; s < map->sampler_count; s++) {
>        struct anv_pipeline_binding *binding =
> &map->sampler_to_descriptor[s];
> @@ -1345,6 +1345,7 @@ flush_descriptor_sets(struct anv_cmd_buffer
> *cmd_buffer)
>     if (result != VK_SUCCESS) {
>        assert(result == VK_ERROR_OUT_OF_DEVICE_MEMORY);
>
> +      cmd_buffer->error_status = VK_SUCCESS;
>

This doesn't seem right.  If we're setting it back to success in anywhere
other than cmd_buffer_reset, we're doing our error handling wrong.


>        result = anv_cmd_buffer_new_binding_table_block(cmd_buffer);
>        assert(result == VK_SUCCESS);
>
> @@ -1817,6 +1818,8 @@ flush_compute_descriptor_set(struct anv_cmd_buffer
> *cmd_buffer)
>     result = emit_binding_table(cmd_buffer, MESA_SHADER_COMPUTE,
> &surfaces);
>     if (result != VK_SUCCESS) {
>        assert(result == VK_ERROR_OUT_OF_DEVICE_MEMORY);
> +
> +      cmd_buffer->error_status = VK_SUCCESS;
>        result = anv_cmd_buffer_new_binding_table_block(cmd_buffer);
>        assert(result == VK_SUCCESS);
>
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170307/d0898d68/attachment-0001.html>


More information about the mesa-dev mailing list