Module: Mesa
Branch: staging/22.3
Commit: 872ebf9c3fe5b7e869f4c4bac18d34ae21f6c7c6
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=872ebf9c3fe5b7e869f4c4bac18d34ae21f6c7c6

Author: Paulo Zanoni <[email protected]>
Date:   Fri Jan 13 16:51:59 2023 -0800

anv: check the return value of anv_execbuf_add_bo_bitset()

Because anv_execbuf_add_bo_bitset() calls anv_execbuf_add_bo(), which
can fail if its memory allocations fail.

I have seen dEQP tests exercising memory allocation failures during
anv_execbuf_add_bo(), but I don't think the path coming from
add_bo_biset() was specifically exercised. Anyway, add the error check
just in case.

v2: Rebase.

Cc: mesa-stable
Reviewed-by: Ivan Briano <[email protected]>
Reviewed-by: Lionel Landwerlin <[email protected]>
Signed-off-by: Paulo Zanoni <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20703>
(cherry picked from commit 3d37950fd9ddc7b43f06b4a5fa710fb7333978ce)

---

 .pick_status.json                  | 2 +-
 src/intel/vulkan/anv_batch_chain.c | 8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 14770e0f51d..7a4878a1da5 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -337,7 +337,7 @@
         "description": "anv: check the return value of 
anv_execbuf_add_bo_bitset()",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/intel/vulkan/anv_batch_chain.c 
b/src/intel/vulkan/anv_batch_chain.c
index 597c40d392d..3fd06fd697f 100644
--- a/src/intel/vulkan/anv_batch_chain.c
+++ b/src/intel/vulkan/anv_batch_chain.c
@@ -1364,9 +1364,11 @@ setup_execbuf_for_cmd_buffer(struct anv_execbuf *execbuf,
 {
    VkResult result;
    /* Add surface dependencies (BOs) to the execbuf */
-   anv_execbuf_add_bo_bitset(cmd_buffer->device, execbuf,
-                             cmd_buffer->surface_relocs.dep_words,
-                             cmd_buffer->surface_relocs.deps, 0);
+   result = anv_execbuf_add_bo_bitset(cmd_buffer->device, execbuf,
+                                      cmd_buffer->surface_relocs.dep_words,
+                                      cmd_buffer->surface_relocs.deps, 0);
+   if (result != VK_SUCCESS)
+      return result;
 
    /* First, we walk over all of the bos we've seen and add them and their
     * relocations to the validate list.

Reply via email to