summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_device.c
diff options
context:
space:
mode:
authorScott D Phillips <[email protected]>2018-05-30 20:16:04 -0700
committerJason Ekstrand <[email protected]>2018-06-01 14:27:12 -0700
commitf3dbe0419de8ad195f0f0ce8f4f45b03b16936a3 (patch)
treecae01e5e7998d7c4b0f7c6690cda66317ecacbe7 /src/intel/vulkan/anv_device.c
parenta0b133286a39fb9ac3a99d90edc0992339735765 (diff)
anv: Soft-pin batch buffers
Co-authored-by: Jason Ekstrand <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Scott D Phillips <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_device.c')
-rw-r--r--src/intel/vulkan/anv_device.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 8b44b1bb1ec..1a2bde2df4d 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -1326,6 +1326,11 @@ anv_device_init_trivial_batch(struct anv_device *device)
if (device->instance->physicalDevice.has_exec_async)
device->trivial_batch_bo.flags |= EXEC_OBJECT_ASYNC;
+ if (device->instance->physicalDevice.use_softpin)
+ device->trivial_batch_bo.flags |= EXEC_OBJECT_PINNED;
+
+ anv_vma_alloc(device, &device->trivial_batch_bo);
+
void *map = anv_gem_mmap(device, device->trivial_batch_bo.gem_handle,
0, 4096, 0);
@@ -1607,7 +1612,8 @@ VkResult anv_CreateDevice(
uint64_t bo_flags =
(physical_device->supports_48bit_addresses ? EXEC_OBJECT_SUPPORTS_48B_ADDRESS : 0) |
(physical_device->has_exec_async ? EXEC_OBJECT_ASYNC : 0) |
- (physical_device->has_exec_capture ? EXEC_OBJECT_CAPTURE : 0);
+ (physical_device->has_exec_capture ? EXEC_OBJECT_CAPTURE : 0) |
+ (physical_device->use_softpin ? EXEC_OBJECT_PINNED : 0);
anv_bo_pool_init(&device->batch_bo_pool, device, bo_flags);
@@ -1615,9 +1621,7 @@ VkResult anv_CreateDevice(
if (result != VK_SUCCESS)
goto fail_batch_bo_pool;
- if (physical_device->use_softpin)
- bo_flags |= EXEC_OBJECT_PINNED;
- else
+ if (!physical_device->use_softpin)
bo_flags &= ~EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
result = anv_state_pool_init(&device->dynamic_state_pool, device,
@@ -1754,6 +1758,7 @@ void anv_DestroyDevice(
anv_gem_munmap(device->workaround_bo.map, device->workaround_bo.size);
anv_gem_close(device, device->workaround_bo.gem_handle);
+ anv_vma_free(device, &device->trivial_batch_bo);
anv_gem_close(device, device->trivial_batch_bo.gem_handle);
if (device->info.gen >= 10)
anv_gem_close(device, device->hiz_clear_bo.gem_handle);