radv/winsys: be more robust when a CS failed during recording
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Sun, 12 Jul 2020 17:13:18 +0000 (19:13 +0200)
committerMarge Bot <eric+marge@anholt.net>
Wed, 22 Jul 2020 15:06:20 +0000 (15:06 +0000)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5872>

src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c

index 4f91aa1562a7446b61ae083c2fe446e95d1f9a5b..b024ef971040edac49033ffee4b72af14f21dea2 100644 (file)
@@ -575,7 +575,7 @@ static void radv_amdgpu_cs_add_buffer_internal(struct radv_amdgpu_cs *cs,
        unsigned hash;
        int index = radv_amdgpu_cs_find_buffer(cs, bo);
 
-       if (index != -1 || cs->status != VK_SUCCESS)
+       if (index != -1)
                return;
 
        if (cs->num_buffers == cs->max_num_buffers) {
@@ -660,6 +660,9 @@ static void radv_amdgpu_cs_add_buffer(struct radeon_cmdbuf *_cs,
        struct radv_amdgpu_cs *cs = radv_amdgpu_cs(_cs);
        struct radv_amdgpu_winsys_bo *bo = radv_amdgpu_winsys_bo(_bo);
 
+       if (cs->status != VK_SUCCESS)
+               return;
+
        if (bo->is_virtual)  {
                radv_amdgpu_cs_add_virtual_buffer(_cs, _bo);
                return;
@@ -677,6 +680,9 @@ static void radv_amdgpu_cs_execute_secondary(struct radeon_cmdbuf *_parent,
        struct radv_amdgpu_cs *parent = radv_amdgpu_cs(_parent);
        struct radv_amdgpu_cs *child = radv_amdgpu_cs(_child);
 
+       if (parent->status != VK_SUCCESS || child->status != VK_SUCCESS)
+               return;
+
        for (unsigned i = 0; i < child->num_buffers; ++i) {
                radv_amdgpu_cs_add_buffer_internal(parent,
                                                   child->handles[i].bo_handle,