summaryrefslogtreecommitdiffstats
path: root/src/intel
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-03-18 11:50:53 -0700
committerJason Ekstrand <[email protected]>2016-03-18 11:50:53 -0700
commitb1c5d45872c4c156b1366071c8532a0057a70745 (patch)
treefd1b2f28a4ceec309a162294d2c3bd5bcea102be /src/intel
parent3fd308a357b9057447d21c67718d13524dbbb40d (diff)
anv/allocator: Add a size field to bo_pool_alloc
Diffstat (limited to 'src/intel')
-rw-r--r--src/intel/vulkan/anv_allocator.c4
-rw-r--r--src/intel/vulkan/anv_batch_chain.c6
-rw-r--r--src/intel/vulkan/anv_device.c4
-rw-r--r--src/intel/vulkan/anv_private.h3
4 files changed, 11 insertions, 6 deletions
diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
index 4fc83386a71..1928b9bb157 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -820,10 +820,12 @@ anv_bo_pool_finish(struct anv_bo_pool *pool)
}
VkResult
-anv_bo_pool_alloc(struct anv_bo_pool *pool, struct anv_bo *bo)
+anv_bo_pool_alloc(struct anv_bo_pool *pool, struct anv_bo *bo, uint32_t size)
{
VkResult result;
+ assert(pool->bo_size <= size);
+
void *next_free_void;
if (anv_ptr_free_list_pop(&pool->free_list, &next_free_void)) {
struct bo_pool_bo_link *next_free = next_free_void;
diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c
index d24dd06d7eb..eab050f066b 100644
--- a/src/intel/vulkan/anv_batch_chain.c
+++ b/src/intel/vulkan/anv_batch_chain.c
@@ -251,7 +251,8 @@ anv_batch_bo_create(struct anv_cmd_buffer *cmd_buffer,
if (bbo == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
- result = anv_bo_pool_alloc(&cmd_buffer->device->batch_bo_pool, &bbo->bo);
+ result = anv_bo_pool_alloc(&cmd_buffer->device->batch_bo_pool, &bbo->bo,
+ ANV_CMD_BUFFER_BATCH_SIZE);
if (result != VK_SUCCESS)
goto fail_alloc;
@@ -283,7 +284,8 @@ anv_batch_bo_clone(struct anv_cmd_buffer *cmd_buffer,
if (bbo == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
- result = anv_bo_pool_alloc(&cmd_buffer->device->batch_bo_pool, &bbo->bo);
+ result = anv_bo_pool_alloc(&cmd_buffer->device->batch_bo_pool, &bbo->bo,
+ other_bbo->bo.size);
if (result != VK_SUCCESS)
goto fail_alloc;
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index bcd7a9e3c0d..77fd72c42e1 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -717,7 +717,7 @@ anv_device_submit_simple_batch(struct anv_device *device,
/* Kernel driver requires 8 byte aligned batch length */
size = align_u32(batch->next - batch->start, 8);
assert(size < device->batch_bo_pool.bo_size);
- result = anv_bo_pool_alloc(&device->batch_bo_pool, &bo);
+ result = anv_bo_pool_alloc(&device->batch_bo_pool, &bo, 4096);
if (result != VK_SUCCESS)
return result;
@@ -1390,7 +1390,7 @@ VkResult anv_CreateFence(
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_FENCE_CREATE_INFO);
- result = anv_bo_pool_alloc(&device->batch_bo_pool, &fence_bo);
+ result = anv_bo_pool_alloc(&device->batch_bo_pool, &fence_bo, 4096);
if (result != VK_SUCCESS)
return result;
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 939cd087377..46e377c0490 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -476,7 +476,8 @@ struct anv_bo_pool {
void anv_bo_pool_init(struct anv_bo_pool *pool,
struct anv_device *device, uint32_t block_size);
void anv_bo_pool_finish(struct anv_bo_pool *pool);
-VkResult anv_bo_pool_alloc(struct anv_bo_pool *pool, struct anv_bo *bo);
+VkResult anv_bo_pool_alloc(struct anv_bo_pool *pool, struct anv_bo *bo,
+ uint32_t size);
void anv_bo_pool_free(struct anv_bo_pool *pool, const struct anv_bo *bo);