VkResult
anv_block_pool_init(struct anv_block_pool *pool,
struct anv_device *device,
+ const char *name,
uint64_t start_address,
uint32_t initial_size)
{
VkResult result;
+ pool->name = name;
pool->device = device;
pool->use_softpin = device->physical->use_softpin;
pool->nbos = 0;
uint32_t new_bo_size = size - pool->size;
struct anv_bo *new_bo;
assert(center_bo_offset == 0);
- VkResult result = anv_device_alloc_bo(pool->device, new_bo_size,
+ VkResult result = anv_device_alloc_bo(pool->device,
+ pool->name,
+ new_bo_size,
bo_alloc_flags |
ANV_BO_ALLOC_FIXED_ADDRESS |
ANV_BO_ALLOC_MAPPED |
VkResult
anv_state_pool_init(struct anv_state_pool *pool,
struct anv_device *device,
+ const char *name,
uint64_t base_address,
int32_t start_offset,
uint32_t block_size)
/* We don't want to ever see signed overflow */
assert(start_offset < INT32_MAX - (int32_t)BLOCK_POOL_MEMFD_SIZE);
- VkResult result = anv_block_pool_init(&pool->block_pool, device,
+ VkResult result = anv_block_pool_init(&pool->block_pool, device, name,
base_address + start_offset,
block_size * 16);
if (result != VK_SUCCESS)
}
void
-anv_bo_pool_init(struct anv_bo_pool *pool, struct anv_device *device)
+anv_bo_pool_init(struct anv_bo_pool *pool, struct anv_device *device,
+ const char *name)
{
+ pool->name = name;
pool->device = device;
for (unsigned i = 0; i < ARRAY_SIZE(pool->free_list); i++) {
util_sparse_array_free_list_init(&pool->free_list[i],
}
VkResult result = anv_device_alloc_bo(pool->device,
+ pool->name,
pow2_size,
ANV_BO_ALLOC_MAPPED |
ANV_BO_ALLOC_SNOOPED |
*
* so nothing will ever touch the top page.
*/
- VkResult result = anv_device_alloc_bo(device, size,
+ VkResult result = anv_device_alloc_bo(device, "scratch", size,
ANV_BO_ALLOC_32BIT_ADDRESS,
0 /* explicit_address */,
&bo);
VkResult
anv_device_alloc_bo(struct anv_device *device,
+ const char *name,
uint64_t size,
enum anv_bo_alloc_flags alloc_flags,
uint64_t explicit_address,
return vk_error(VK_ERROR_OUT_OF_DEVICE_MEMORY);
struct anv_bo new_bo = {
+ .name = name,
.gem_handle = gem_handle,
.refcount = 1,
.offset = -1,
__sync_fetch_and_add(&bo->refcount, 1);
} else {
struct anv_bo new_bo = {
+ .name = "host-ptr",
.gem_handle = gem_handle,
.refcount = 1,
.offset = -1,
}
struct anv_bo new_bo = {
+ .name = "imported",
.gem_handle = gem_handle,
.refcount = 1,
.offset = -1,
submit->cmd_buffer_count &&
submit->perf_query_pool;
+ if (INTEL_DEBUG & DEBUG_SUBMIT) {
+ fprintf(stderr, "Batch on queue 0\n");
+ for (uint32_t i = 0; i < execbuf.bo_count; i++) {
+ const struct anv_bo *bo = execbuf.bos[i];
+
+ fprintf(stderr, " BO: addr=0x%016"PRIx64" size=%010"PRIx64" handle=%05u name=%s\n",
+ bo->offset, bo->size, bo->gem_handle, bo->name);
+ }
+ }
+
if (INTEL_DEBUG & DEBUG_BATCH) {
fprintf(stderr, "Batch on queue %d\n", (int)(queue - device->queues));
if (submit->cmd_buffer_count) {
if (descriptor_bo_size > 0) {
VkResult result = anv_device_alloc_bo(device,
+ "descriptors",
descriptor_bo_size,
ANV_BO_ALLOC_MAPPED |
ANV_BO_ALLOC_SNOOPED,
static VkResult
anv_device_init_trivial_batch(struct anv_device *device)
{
- VkResult result = anv_device_alloc_bo(device, 4096,
+ VkResult result = anv_device_alloc_bo(device, "trivial-batch", 4096,
ANV_BO_ALLOC_MAPPED,
0 /* explicit_address */,
&device->trivial_batch_bo);
static VkResult
anv_device_init_hiz_clear_value_bo(struct anv_device *device)
{
- VkResult result = anv_device_alloc_bo(device, 4096,
+ VkResult result = anv_device_alloc_bo(device, "hiz-clear-value", 4096,
ANV_BO_ALLOC_MAPPED,
0 /* explicit_address */,
&device->hiz_clear_bo);
if (result != VK_SUCCESS)
goto fail_queue_cond;
- anv_bo_pool_init(&device->batch_bo_pool, device);
+ anv_bo_pool_init(&device->batch_bo_pool, device, "batch");
/* Because scratch is also relative to General State Base Address, we leave
* the base address 0 and start the pool memory at an offset. This way we
* get the correct offsets in the anv_states that get allocated from it.
*/
result = anv_state_pool_init(&device->general_state_pool, device,
+ "general pool",
0, GENERAL_STATE_POOL_MIN_ADDRESS, 16384);
if (result != VK_SUCCESS)
goto fail_batch_bo_pool;
result = anv_state_pool_init(&device->dynamic_state_pool, device,
+ "dynamic pool",
DYNAMIC_STATE_POOL_MIN_ADDRESS, 0, 16384);
if (result != VK_SUCCESS)
goto fail_general_state_pool;
}
result = anv_state_pool_init(&device->instruction_state_pool, device,
+ "instruction pool",
INSTRUCTION_STATE_POOL_MIN_ADDRESS, 0, 16384);
if (result != VK_SUCCESS)
goto fail_dynamic_state_pool;
result = anv_state_pool_init(&device->surface_state_pool, device,
+ "surface state pool",
SURFACE_STATE_POOL_MIN_ADDRESS, 0, 4096);
if (result != VK_SUCCESS)
goto fail_instruction_state_pool;
(int64_t)SURFACE_STATE_POOL_MIN_ADDRESS;
assert(INT32_MIN < bt_pool_offset && bt_pool_offset < 0);
result = anv_state_pool_init(&device->binding_table_pool, device,
+ "binding table pool",
SURFACE_STATE_POOL_MIN_ADDRESS,
bt_pool_offset, 4096);
if (result != VK_SUCCESS)
goto fail_binding_table_pool;
}
- result = anv_device_alloc_bo(device, 4096,
+ result = anv_device_alloc_bo(device, "workaround", 4096,
ANV_BO_ALLOC_CAPTURE | ANV_BO_ALLOC_MAPPED /* flags */,
0 /* explicit_address */,
&device->workaround_bo);
/* Regular allocate (not importing memory). */
- result = anv_device_alloc_bo(device, pAllocateInfo->allocationSize,
+ result = anv_device_alloc_bo(device, "user", pAllocateInfo->allocationSize,
alloc_flags, client_address, &mem->bo);
if (result != VK_SUCCESS)
goto fail;
memset(measure, 0, batch_bytes);
VkResult result =
- anv_device_alloc_bo(device,
+ anv_device_alloc_bo(device, "measure data",
config->batch_size * sizeof(uint64_t),
ANV_BO_ALLOC_MAPPED,
0,
anv_device_release_bo(device, measure->bo);
VkResult result =
- anv_device_alloc_bo(device,
+ anv_device_alloc_bo(device, "measure data",
config->batch_size * sizeof(uint64_t),
ANV_BO_ALLOC_MAPPED,
0,
}
struct anv_bo {
+ const char *name;
+
uint32_t gem_handle;
uint32_t refcount;
#define ANV_MAX_BLOCK_POOL_BOS 20
struct anv_block_pool {
+ const char *name;
+
struct anv_device *device;
bool use_softpin;
*/
VkResult anv_block_pool_init(struct anv_block_pool *pool,
struct anv_device *device,
+ const char *name,
uint64_t start_address,
uint32_t initial_size);
void anv_block_pool_finish(struct anv_block_pool *pool);
VkResult anv_state_pool_init(struct anv_state_pool *pool,
struct anv_device *device,
+ const char *name,
uint64_t base_address,
int32_t start_offset,
uint32_t block_size);
* of block_pool except that each block is its own BO.
*/
struct anv_bo_pool {
+ const char *name;
+
struct anv_device *device;
struct util_sparse_array_free_list free_list[16];
};
-void anv_bo_pool_init(struct anv_bo_pool *pool, struct anv_device *device);
+void anv_bo_pool_init(struct anv_bo_pool *pool, struct anv_device *device,
+ const char *name);
void anv_bo_pool_finish(struct anv_bo_pool *pool);
VkResult anv_bo_pool_alloc(struct anv_bo_pool *pool, uint32_t size,
struct anv_bo **bo_out);
ANV_BO_ALLOC_IMPLICIT_CCS = (1 << 9),
};
-VkResult anv_device_alloc_bo(struct anv_device *device, uint64_t size,
+VkResult anv_device_alloc_bo(struct anv_device *device,
+ const char *name, uint64_t size,
enum anv_bo_alloc_flags alloc_flags,
uint64_t explicit_address,
struct anv_bo **bo);
if (!(*point))
result = vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
if (result == VK_SUCCESS) {
- result = anv_device_alloc_bo(device, 4096,
+ result = anv_device_alloc_bo(device, "timeline-semaphore", 4096,
ANV_BO_ALLOC_EXTERNAL |
ANV_BO_ALLOC_IMPLICIT_SYNC,
0 /* explicit_address */,
result = anv_queue_submit_add_syncobj(submit, device, syncobj,
I915_EXEC_FENCE_SIGNAL, 0);
} else {
- result = anv_device_alloc_bo(device, 4096,
+ result = anv_device_alloc_bo(device, "simple-batch-sync", 4096,
ANV_BO_ALLOC_EXTERNAL |
ANV_BO_ALLOC_IMPLICIT_SYNC,
0 /* explicit_address */,
} else {
impl->type = ANV_SEMAPHORE_TYPE_BO;
VkResult result =
- anv_device_alloc_bo(device, 4096,
+ anv_device_alloc_bo(device, "binary-semaphore", 4096,
ANV_BO_ALLOC_EXTERNAL |
ANV_BO_ALLOC_IMPLICIT_SYNC,
0 /* explicit_address */,
bo_flags |= EXEC_OBJECT_ASYNC;
uint64_t size = pool->slots * pool->stride;
- result = anv_device_alloc_bo(device, size,
+ result = anv_device_alloc_bo(device, "query-pool", size,
ANV_BO_ALLOC_MAPPED |
ANV_BO_ALLOC_SNOOPED,
0 /* explicit_address */,
pthread_mutex_init(&device.mutex, NULL);
anv_bo_cache_init(&device.bo_cache);
- anv_block_pool_init(&pool, &device, 4096, initial_size);
+ anv_block_pool_init(&pool, &device, "test", 4096, initial_size);
ASSERT(pool.size == initial_size);
uint32_t padding;
pthread_mutex_init(&device.mutex, NULL);
anv_bo_cache_init(&device.bo_cache);
- anv_block_pool_init(&pool, &device, 4096, 4096);
+ anv_block_pool_init(&pool, &device, "test", 4096, 4096);
for (unsigned i = 0; i < NUM_THREADS; i++) {
jobs[i].pool = &pool;
anv_bo_cache_init(&device.bo_cache);
for (unsigned i = 0; i < NUM_RUNS; i++) {
- anv_state_pool_init(&state_pool, &device, 4096, 0, 256);
+ anv_state_pool_init(&state_pool, &device, "test", 4096, 0, 256);
/* Grab one so a zero offset is impossible */
anv_state_pool_alloc(&state_pool, 16, 16);
pthread_mutex_init(&device.mutex, NULL);
anv_bo_cache_init(&device.bo_cache);
- anv_state_pool_init(&state_pool, &device, 4096, 0, 4096);
+ anv_state_pool_init(&state_pool, &device, "test", 4096, 0, 4096);
/* Grab one so a zero offset is impossible */
anv_state_pool_alloc(&state_pool, 16, 16);
pthread_mutex_init(&device.mutex, NULL);
anv_bo_cache_init(&device.bo_cache);
- anv_state_pool_init(&state_pool, &device, 4096, 0, 64);
+ anv_state_pool_init(&state_pool, &device, "test", 4096, 0, 64);
pthread_barrier_init(&barrier, NULL, NUM_THREADS);
pthread_mutex_init(&device.mutex, NULL);
anv_bo_cache_init(&device.bo_cache);
- anv_state_pool_init(&state_pool, &device, 4096, 0, 4096);
+ anv_state_pool_init(&state_pool, &device, "test", 4096, 0, 4096);
/* Get the size of the underlying block_pool */
struct anv_block_pool *bp = &state_pool.block_pool;