summaryrefslogtreecommitdiff
path: root/src/intel/vulkan/tests/block_pool_grow_first.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/intel/vulkan/tests/block_pool_grow_first.c')
-rw-r--r--src/intel/vulkan/tests/block_pool_grow_first.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/intel/vulkan/tests/block_pool_grow_first.c b/src/intel/vulkan/tests/block_pool_grow_first.c
index e50f65c8d68..1c745360ea8 100644
--- a/src/intel/vulkan/tests/block_pool_grow_first.c
+++ b/src/intel/vulkan/tests/block_pool_grow_first.c
@@ -24,14 +24,12 @@
#include "anv_private.h"
#include "test_common.h"
-int main(void)
+void block_pool_grow_first_test(void);
+
+void block_pool_grow_first_test(void)
{
- struct anv_physical_device physical_device = {
- .use_softpin = true,
- };
- struct anv_device device = {
- .physical = &physical_device,
- };
+ struct anv_physical_device physical_device = {};
+ struct anv_device device = {};
struct anv_block_pool pool;
/* Create a pool with initial size smaller than the block allocated, so
@@ -39,14 +37,20 @@ int main(void)
*/
const uint32_t block_size = 16 * 1024;
const uint32_t initial_size = block_size / 2;
+ const uint32_t _1Gb = 1024 * 1024 * 1024;
+ test_device_info_init(&physical_device.info);
+ anv_device_set_physical(&device, &physical_device);
+ device.kmd_backend = anv_kmd_backend_get(INTEL_KMD_TYPE_STUB);
pthread_mutex_init(&device.mutex, NULL);
- anv_bo_cache_init(&device.bo_cache);
- anv_block_pool_init(&pool, &device, "test", 4096, initial_size);
+ anv_bo_cache_init(&device.bo_cache, &device);
+ anv_block_pool_init(&pool, &device, "test", 4096, initial_size, _1Gb);
ASSERT(pool.size == initial_size);
uint32_t padding;
- int32_t offset = anv_block_pool_alloc(&pool, block_size, &padding);
+ int64_t offset;
+ VkResult result = anv_block_pool_alloc(&pool, block_size, &offset, &padding);
+ ASSERT(result == VK_SUCCESS);
/* Pool will have grown at least space to fit the new allocation. */
ASSERT(pool.size > initial_size);
@@ -63,4 +67,6 @@ int main(void)
memset(map, 22, block_size);
anv_block_pool_finish(&pool);
+ anv_bo_cache_finish(&device.bo_cache);
+ pthread_mutex_destroy(&device.mutex);
}