[Mesa-dev] [PATCH v2 06/24] anv: add anv_batch_set_error() and anv_batch_has_error() helpers
Iago Toral Quiroga
itoral at igalia.com
Fri Mar 10 12:38:19 UTC 2017
The anv_batch_set_error() helper will track the first error that happened
while recording a command buffer. The helper returns the currently tracked
error to help the job of internal functions that may generate errors that
need to be tracked and return a VkResult to the caller.
We will use the anv_batch_has_error() helper to guard parts of the driver
that are not safe to execute if an error has been generated while recording
a particular command buffer.
---
src/intel/vulkan/anv_cmd_buffer.c | 2 +-
src/intel/vulkan/anv_private.h | 15 +++++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c
index 4a41bc0..003a28c 100644
--- a/src/intel/vulkan/anv_cmd_buffer.c
+++ b/src/intel/vulkan/anv_cmd_buffer.c
@@ -221,7 +221,7 @@ static VkResult anv_create_cmd_buffer(
return VK_SUCCESS;
fail:
- cmd_buffer->batch.status = result;
+ anv_batch_set_error(&cmd_buffer->batch, result);
vk_free(&cmd_buffer->pool->alloc, cmd_buffer);
return result;
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index f5d7600..d1bb761 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -722,6 +722,21 @@ uint64_t anv_batch_emit_reloc(struct anv_batch *batch,
VkResult anv_device_submit_simple_batch(struct anv_device *device,
struct anv_batch *batch);
+static inline VkResult
+anv_batch_set_error(struct anv_batch *batch, VkResult error)
+{
+ assert(error != VK_SUCCESS);
+ if (batch->status == VK_SUCCESS)
+ batch->status = error;
+ return batch->status;
+}
+
+static inline bool
+anv_batch_has_error(struct anv_batch *batch)
+{
+ return batch->status != VK_SUCCESS;
+}
+
struct anv_address {
struct anv_bo *bo;
uint32_t offset;
--
2.7.4
More information about the mesa-dev
mailing list