summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_device.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-03-06 14:16:51 -0800
committerJason Ekstrand <[email protected]>2016-03-06 14:26:52 -0800
commit23de78768b69d5600233df022431b8f26a0907fc (patch)
treec98e2e2a1087fcc66a1d9cd0818e6d9221f48cba /src/intel/vulkan/anv_device.c
parent21ee5fd3263e034a54d7a37d9e5b6e6f9ef49f54 (diff)
anv: Create fences from the batch BO pool
Applications may create a *lot* of fences, perhaps as much as one per vkQueueSubmit. Really, they're supposed to use ResetFence, but it's easy enough for us to make them crazy-cheap so we might as well.
Diffstat (limited to 'src/intel/vulkan/anv_device.c')
-rw-r--r--src/intel/vulkan/anv_device.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index c68280fe8d7..8aa1e61acad 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -1387,8 +1387,6 @@ VkResult anv_CreateFence(
struct anv_batch batch;
VkResult result;
- const uint32_t fence_size = 128;
-
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_FENCE_CREATE_INFO);
fence = anv_alloc2(&device->alloc, pAllocator, sizeof(*fence), 8,
@@ -1396,12 +1394,10 @@ VkResult anv_CreateFence(
if (fence == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
- result = anv_bo_init_new(&fence->bo, device, fence_size);
+ result = anv_bo_pool_alloc(&device->batch_bo_pool, &fence->bo);
if (result != VK_SUCCESS)
goto fail;
- fence->bo.map =
- anv_gem_mmap(device, fence->bo.gem_handle, 0, fence->bo.size, 0);
batch.next = batch.start = fence->bo.map;
batch.end = fence->bo.map + fence->bo.size;
anv_batch_emit(&batch, GEN7_MI_BATCH_BUFFER_END);
@@ -1457,9 +1453,7 @@ void anv_DestroyFence(
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_fence, fence, _fence);
- anv_gem_munmap(fence->bo.map, fence->bo.size);
- anv_gem_close(device, fence->bo.gem_handle);
- anv_free2(&device->alloc, pAllocator, fence);
+ anv_bo_pool_free(&device->batch_bo_pool, &fence->bo);
}
VkResult anv_ResetFences(