anv: Submit fence bo only after all command buffers
authorKristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Fri, 12 Feb 2016 23:08:09 +0000 (15:08 -0800)
committerKristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Fri, 12 Feb 2016 23:08:09 +0000 (15:08 -0800)
We were submitting the fence bo after each command buffer in a multi
command buffer submit, causing us to occasionally complete the fence too
early.

src/vulkan/anv_device.c

index 5e9c42b2fdc7b5d958265115f6a190013951c859..e2efaafa25dbae21a268ac8304dd303dc14ad243 100644 (file)
@@ -1012,20 +1012,20 @@ VkResult anv_QueueSubmit(
                              "execbuf2 failed: %m");
          }
 
-         if (fence) {
-            ret = anv_gem_execbuffer(device, &fence->execbuf);
-            if (ret != 0) {
-               /* We don't know the real error. */
-               return vk_errorf(VK_ERROR_OUT_OF_DEVICE_MEMORY,
-                                "execbuf2 failed: %m");
-            }
-         }
-
          for (uint32_t k = 0; k < cmd_buffer->execbuf2.bo_count; k++)
             cmd_buffer->execbuf2.bos[k]->offset = cmd_buffer->execbuf2.objects[k].offset;
       }
    }
 
+   if (fence) {
+      ret = anv_gem_execbuffer(device, &fence->execbuf);
+      if (ret != 0) {
+         /* We don't know the real error. */
+         return vk_errorf(VK_ERROR_OUT_OF_DEVICE_MEMORY,
+                          "execbuf2 failed: %m");
+      }
+   }
+
    return VK_SUCCESS;
 }