[magma] Switch to magma_execute_command

Change-Id: I1a0cb52067d3d88054c41c811046aeea5ca9135b
Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/mesa/+/641805
Reviewed-by: John Bauman <jbauman@google.com>
diff --git a/src/intel/vulkan/anv_magma_connection.cc b/src/intel/vulkan/anv_magma_connection.cc
index 5bb99b3..ad1e3aa 100644
--- a/src/intel/vulkan/anv_magma_connection.cc
+++ b/src/intel/vulkan/anv_magma_connection.cc
@@ -23,8 +23,8 @@
 
 #include "anv_magma.h"
 #include "common/intel_gem.h"
-#include "util/log.h"
 #include "util/inflight_list.h"
+#include "util/log.h"
 #include <assert.h>
 #include <chrono>
 #include <map>
@@ -39,7 +39,7 @@
 #define LOG_VERBOSE(...)                                                                           \
    do {                                                                                            \
       if (false)                                                                                   \
-         mesa_logd(__VA_ARGS__);                                                                  \
+         mesa_logd(__VA_ARGS__);                                                                   \
    } while (0)
 
 static inline uint64_t page_size() { return sysconf(_SC_PAGESIZE); }
@@ -183,7 +183,8 @@
 }
 
 int AnvMagmaConnectionExec(anv_connection* connection, uint32_t context_id,
-                           struct drm_i915_gem_execbuffer2* execbuf, struct anv_magma_buffer* buffers[])
+                           struct drm_i915_gem_execbuffer2* execbuf,
+                           struct anv_magma_buffer* buffers[])
 {
    if (execbuf->buffer_count == 0)
       return 0;
@@ -226,8 +227,9 @@
       }
 
       if (!has_mapping) {
-         LOG_VERBOSE("mapping to gpu addr 0x%" PRIx64 ": id %" PRIu64 " page_offset %" PRIu64 " page_count %" PRIu64, gpu_addr,
-                     buffer->id, page_offset, page_count);
+         LOG_VERBOSE("mapping to gpu addr 0x%" PRIx64 ": id %" PRIu64 " page_offset %" PRIu64
+                     " page_count %" PRIu64,
+                     gpu_addr, buffer->id, page_offset, page_count);
          constexpr uint64_t kMapFlags =
              MAGMA_GPU_MAP_FLAG_READ | MAGMA_GPU_MAP_FLAG_WRITE | MAGMA_GPU_MAP_FLAG_EXECUTE;
          magma_map_buffer_gpu(Connection::cast(connection)->magma_connection(), buffer->get(),
@@ -258,14 +260,19 @@
       }
    }
 
-   magma_command_buffer command_buffer = {
-       .resource_count = execbuf->buffer_count,
-       .batch_buffer_resource_index = execbuf->buffer_count - 1, // by drm convention
-       .batch_start_offset = execbuf->batch_start_offset,
-       .wait_semaphore_count = wait_semaphore_count,
-       .signal_semaphore_count =
-           static_cast<uint32_t>(semaphore_ids.size()) - wait_semaphore_count,
-       .flags = 0};
+   magma_exec_command_buffer command_buffer = {.resource_index =
+                                                   execbuf->buffer_count - 1, // by drm convention
+                                               .start_offset = execbuf->batch_start_offset};
+
+   magma_command_descriptor descriptor = {.resource_count = execbuf->buffer_count,
+                                          .command_buffer_count = 1,
+                                          .wait_semaphore_count = wait_semaphore_count,
+                                          .signal_semaphore_count =
+                                              syncobj_count - wait_semaphore_count,
+                                          .resources = resources.data(),
+                                          .command_buffers = &command_buffer,
+                                          .semaphore_ids = semaphore_ids.data(),
+                                          .flags = 0};
 
    // Add to inflight list first to avoid race with any other thread reading completions from the
    // notification channel, in case this thread is preempted just after sending the command buffer
@@ -274,9 +281,7 @@
                              Connection::cast(connection)->magma_connection(), resources.data(),
                              execbuf->buffer_count);
 
-   magma_execute_command_buffer_with_resources2(Connection::cast(connection)->magma_connection(),
-                                                context_id, &command_buffer, resources.data(),
-                                                semaphore_ids.data());
+   magma_execute_command(Connection::cast(connection)->magma_connection(), context_id, &descriptor);
 
    return 0;
 }