[Mesa-dev] [PATCH 00/16] anv: Handle out of memory situations better

Iago Toral Quiroga itoral at igalia.com
Tue Mar 7 07:15:45 UTC 2017


There are a number of work-in-progress CTS tests that check OOM handling
and raised a number of issues that this series addresses.

Particularly noteworthy is the case of command buffer recording: since the
various vkCmd*() functions do not return errors, it is expected
that drivers survive until vkEndCommanBuffer() and report any errors
at that point. This requires that we are particularly careful with out of
memory scenarios, since we need to make sure that vkCmd*() commands do not
attempt to access memory that we have failed to allocate in a previous step.
We achieve this by tracking errors generated during command buffer recording
into the command buffer object and, generally, avoiding to execute new
vkCmd*() functions if the command buffer recording has generated an error
before. In general, I tried to  only guard execution of vkCmd*() commands that
the tests showed needed to be guarded since most of the vkCmd*() commands are
safe to execute in any scenario.

This series fixes all the issues raised with the new tests and a few more that
I found by inspection but I am sure we could do better in more places.
It is a first step though and the tests are still in development.

Iago Toral Quiroga (16):
  blorp: handle out of memory in blorp_emitn()
  blorp: handle out of memory without crashing in various batch
    emissions
  anv: don't crash if we fail to grow the reloc list
  anv: handle out of memory situations in anv_batch_emit_dwords()
  anv: do not try to ref/unref NULL shaders
  anv/blorp: return early if we failed to create the shader binary
  anv/cmd_buffer: return a VkResult in cmd_buffer_setup_attachments
  anv/cmd_buffer: track error scenarios during command buffer recording
  anv: handle out of memory scenarios in anv_batch_emit_batch()
  anv/cmd_buffer: handle out of memory during vkCmdPushConstants
  anv: handle out of memory situations during queue submissions
  anv: ensure that we don't ever try to adjust relocations more than
    once
  anv/cmd_buffer: skip vkCmdDraw*() on broken command buffers
  anv/cmd_buffer: skip vkCmdDispatch() on broken command buffers
  anv/cmd_buffer: skip vkCmdExecuteCommands() on broken command buffers
  anv/cmd_buffer: handle out of device memory during binding table
    emission

 src/intel/blorp/blorp_genX_exec.h  | 25 ++++++++++-----
 src/intel/vulkan/anv_batch_chain.c | 45 +++++++++++++++++++--------
 src/intel/vulkan/anv_blorp.c       |  3 ++
 src/intel/vulkan/anv_cmd_buffer.c  | 21 +++++++++++--
 src/intel/vulkan/anv_private.h     | 19 ++++++++++++
 src/intel/vulkan/genX_cmd_buffer.c | 63 ++++++++++++++++++++++++++++++++------
 6 files changed, 142 insertions(+), 34 deletions(-)

-- 
2.7.4



More information about the mesa-dev mailing list