bool has_relocs;
+ const VkAllocationCallbacks * alloc;
+ VkSystemAllocationScope alloc_scope;
uint32_t fence_count;
uint32_t fence_array_length;
struct drm_i915_gem_exec_fence * fences;
}
static void
-anv_execbuf_finish(struct anv_execbuf *exec,
- const VkAllocationCallbacks *alloc)
+anv_execbuf_finish(struct anv_execbuf *exec)
{
- vk_free(alloc, exec->objects);
- vk_free(alloc, exec->bos);
- vk_free(alloc, exec->fences);
- vk_free(alloc, exec->syncobjs);
+ vk_free(exec->alloc, exec->objects);
+ vk_free(exec->alloc, exec->bos);
+ vk_free(exec->alloc, exec->fences);
+ vk_free(exec->alloc, exec->syncobjs);
}
static VkResult
struct anv_execbuf *exec,
uint32_t dep_words,
BITSET_WORD *deps,
- uint32_t extra_flags,
- const VkAllocationCallbacks *alloc);
+ uint32_t extra_flags);
static VkResult
anv_execbuf_add_bo(struct anv_device *device,
struct anv_execbuf *exec,
struct anv_bo *bo,
struct anv_reloc_list *relocs,
- uint32_t extra_flags,
- const VkAllocationCallbacks *alloc)
+ uint32_t extra_flags)
{
struct drm_i915_gem_exec_object2 *obj = NULL;
uint32_t new_len = exec->objects ? exec->array_length * 2 : 64;
struct drm_i915_gem_exec_object2 *new_objects =
- vk_alloc(alloc, new_len * sizeof(*new_objects),
- 8, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
+ vk_alloc(exec->alloc, new_len * sizeof(*new_objects), 8, exec->alloc_scope);
if (new_objects == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
struct anv_bo **new_bos =
- vk_alloc(alloc, new_len * sizeof(*new_bos),
- 8, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
+ vk_alloc(exec->alloc, new_len * sizeof(*new_bos), 8, exec->alloc_scope);
if (new_bos == NULL) {
- vk_free(alloc, new_objects);
+ vk_free(exec->alloc, new_objects);
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
}
exec->bo_count * sizeof(*new_bos));
}
- vk_free(alloc, exec->objects);
- vk_free(alloc, exec->bos);
+ vk_free(exec->alloc, exec->objects);
+ vk_free(exec->alloc, exec->bos);
exec->objects = new_objects;
exec->bos = new_bos;
/* A quick sanity check on relocations */
assert(relocs->relocs[i].offset < bo->size);
result = anv_execbuf_add_bo(device, exec, relocs->reloc_bos[i],
- NULL, extra_flags, alloc);
-
+ NULL, extra_flags);
if (result != VK_SUCCESS)
return result;
}
}
return anv_execbuf_add_bo_bitset(device, exec, relocs->dep_words,
- relocs->deps, extra_flags, alloc);
+ relocs->deps, extra_flags);
}
return VK_SUCCESS;
struct anv_execbuf *exec,
uint32_t dep_words,
BITSET_WORD *deps,
- uint32_t extra_flags,
- const VkAllocationCallbacks *alloc)
+ uint32_t extra_flags)
{
for (uint32_t w = 0; w < dep_words; w++) {
BITSET_WORD mask = deps[w];
uint32_t gem_handle = w * BITSET_WORDBITS + i;
struct anv_bo *bo = anv_device_lookup_bo(device, gem_handle);
assert(bo->refcount > 0);
- VkResult result = anv_execbuf_add_bo(device, exec,
- bo, NULL, extra_flags, alloc);
+ VkResult result =
+ anv_execbuf_add_bo(device, exec, bo, NULL, extra_flags);
if (result != VK_SUCCESS)
return result;
}
static VkResult
anv_execbuf_add_syncobj(struct anv_execbuf *exec,
- uint32_t handle, uint32_t flags,
- const VkAllocationCallbacks *alloc)
+ uint32_t handle, uint32_t flags)
{
assert(flags != 0);
if (exec->fence_count >= exec->fence_array_length) {
uint32_t new_len = MAX2(exec->fence_array_length * 2, 64);
- exec->fences = vk_realloc(alloc, exec->fences,
+ exec->fences = vk_realloc(exec->alloc, exec->fences,
new_len * sizeof(*exec->fences),
- 8, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
+ 8, exec->alloc_scope);
if (exec->fences == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
if (cmd_buffer->device->instance->physicalDevice.use_softpin) {
anv_block_pool_foreach_bo(bo, &ss_pool->block_pool) {
result = anv_execbuf_add_bo(cmd_buffer->device, execbuf,
- bo, NULL, 0,
- &cmd_buffer->device->alloc);
+ bo, NULL, 0);
if (result != VK_SUCCESS)
return 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, &cmd_buffer->device->alloc);
+ cmd_buffer->surface_relocs.deps, 0);
/* Add the BOs for all memory objects */
list_for_each_entry(struct anv_device_memory, mem,
&cmd_buffer->device->memory_objects, link) {
result = anv_execbuf_add_bo(cmd_buffer->device, execbuf,
- mem->bo, NULL, 0,
- &cmd_buffer->device->alloc);
+ mem->bo, NULL, 0);
if (result != VK_SUCCESS)
return result;
}
pool = &cmd_buffer->device->dynamic_state_pool.block_pool;
anv_block_pool_foreach_bo(bo, pool) {
result = anv_execbuf_add_bo(cmd_buffer->device, execbuf,
- bo, NULL, 0,
- &cmd_buffer->device->alloc);
+ bo, NULL, 0);
if (result != VK_SUCCESS)
return result;
}
pool = &cmd_buffer->device->instruction_state_pool.block_pool;
anv_block_pool_foreach_bo(bo, pool) {
result = anv_execbuf_add_bo(cmd_buffer->device, execbuf,
- bo, NULL, 0,
- &cmd_buffer->device->alloc);
+ bo, NULL, 0);
if (result != VK_SUCCESS)
return result;
}
pool = &cmd_buffer->device->binding_table_pool.block_pool;
anv_block_pool_foreach_bo(bo, pool) {
result = anv_execbuf_add_bo(cmd_buffer->device, execbuf,
- bo, NULL, 0,
- &cmd_buffer->device->alloc);
+ bo, NULL, 0);
if (result != VK_SUCCESS)
return result;
}
*/
result = anv_execbuf_add_bo(cmd_buffer->device, execbuf,
ss_pool->block_pool.bo,
- &cmd_buffer->surface_relocs, 0,
- &cmd_buffer->device->alloc);
+ &cmd_buffer->surface_relocs, 0);
if (result != VK_SUCCESS)
return result;
}
cmd_buffer->last_ss_pool_center);
result = anv_execbuf_add_bo(cmd_buffer->device, execbuf,
- (*bbo)->bo, &(*bbo)->relocs, 0,
- &cmd_buffer->device->alloc);
+ (*bbo)->bo, &(*bbo)->relocs, 0);
if (result != VK_SUCCESS)
return result;
}
{
VkResult result = anv_execbuf_add_bo(device, execbuf,
device->trivial_batch_bo,
- NULL, 0, &device->alloc);
+ NULL, 0);
if (result != VK_SUCCESS)
return result;
struct anv_execbuf execbuf;
anv_execbuf_init(&execbuf);
+ execbuf.alloc = &device->alloc;
+ execbuf.alloc_scope = VK_SYSTEM_ALLOCATION_SCOPE_COMMAND;
int in_fence = -1;
VkResult result = VK_SUCCESS;
switch (impl->type) {
case ANV_SEMAPHORE_TYPE_BO:
assert(!pdevice->has_syncobj);
- result = anv_execbuf_add_bo(device, &execbuf, impl->bo, NULL,
- 0, &device->alloc);
+ result = anv_execbuf_add_bo(device, &execbuf, impl->bo, NULL, 0);
if (result != VK_SUCCESS)
return result;
break;
case ANV_SEMAPHORE_TYPE_DRM_SYNCOBJ:
result = anv_execbuf_add_syncobj(&execbuf, impl->syncobj,
- I915_EXEC_FENCE_WAIT,
- &device->alloc);
+ I915_EXEC_FENCE_WAIT);
if (result != VK_SUCCESS)
return result;
break;
case ANV_SEMAPHORE_TYPE_BO:
assert(!pdevice->has_syncobj);
result = anv_execbuf_add_bo(device, &execbuf, impl->bo, NULL,
- EXEC_OBJECT_WRITE, &device->alloc);
+ EXEC_OBJECT_WRITE);
if (result != VK_SUCCESS)
return result;
break;
case ANV_SEMAPHORE_TYPE_DRM_SYNCOBJ:
result = anv_execbuf_add_syncobj(&execbuf, impl->syncobj,
- I915_EXEC_FENCE_SIGNAL,
- &device->alloc);
+ I915_EXEC_FENCE_SIGNAL);
if (result != VK_SUCCESS)
return result;
break;
case ANV_FENCE_TYPE_BO:
assert(!pdevice->has_syncobj_wait);
result = anv_execbuf_add_bo(device, &execbuf, impl->bo.bo, NULL,
- EXEC_OBJECT_WRITE, &device->alloc);
+ EXEC_OBJECT_WRITE);
if (result != VK_SUCCESS)
return result;
break;
case ANV_FENCE_TYPE_SYNCOBJ:
result = anv_execbuf_add_syncobj(&execbuf, impl->syncobj,
- I915_EXEC_FENCE_SIGNAL,
- &device->alloc);
+ I915_EXEC_FENCE_SIGNAL);
if (result != VK_SUCCESS)
return result;
break;
close(out_fence);
}
- anv_execbuf_finish(&execbuf, &device->alloc);
+ anv_execbuf_finish(&execbuf);
return result;
}