Don't import/release command buffer
Change-Id: I868d44dfb8dd5387e8c016b198c3c5daca77f599
diff --git a/src/intel/vulkan/anv_magma.cc b/src/intel/vulkan/anv_magma.cc
index 52a559d..c672d25 100644
--- a/src/intel/vulkan/anv_magma.cc
+++ b/src/intel/vulkan/anv_magma.cc
@@ -123,20 +123,15 @@
uint64_t required_size =
DrmCommandBuffer::RequiredSize(execbuf, wait_semaphore_count, signal_semaphore_count);
- uint64_t allocated_size;
uint64_t cmd_buf_id;
- int32_t error;
-
- error = magma_alloc(magma_connection(device), required_size, &allocated_size, &cmd_buf_id);
+ int32_t error = magma_alloc_command_buffer(magma_connection(device), required_size, &cmd_buf_id);
if (error)
return DRET_MSG(error, "magma_system_alloc failed size 0x%" PRIx64, required_size);
- DASSERT(allocated_size >= required_size);
-
void* cmd_buf_data;
error = magma_map(magma_connection(device), cmd_buf_id, &cmd_buf_data);
if (error) {
- magma_free(magma_connection(device), cmd_buf_id);
+ magma_release_command_buffer(magma_connection(device), cmd_buf_id);
return DRET_MSG(error, "magma_system_map failed");
}
@@ -156,16 +151,14 @@
std::move(signal_semaphore_ids), cmd_buf_data)) {
error = magma_unmap(magma_connection(device), cmd_buf_id);
DASSERT(!error);
- magma_free(magma_connection(device), cmd_buf_id);
+ magma_release_command_buffer(magma_connection(device), cmd_buf_id);
return DRET_MSG(error, "DrmCommandBuffer::Translate failed");
}
- magma_submit_command_buffer(magma_connection(device), cmd_buf_id, device->context_id);
-
error = magma_unmap(magma_connection(device), cmd_buf_id);
DASSERT(!error);
- magma_free(magma_connection(device), cmd_buf_id);
+ magma_submit_command_buffer(magma_connection(device), cmd_buf_id, device->context_id);
return 0;
}