anv_batch_bo_start(struct anv_batch_bo *bbo, struct anv_batch *batch,
size_t batch_padding)
{
- batch->start_addr = (struct anv_address) { .bo = bbo->bo, };
- batch->next = batch->start = bbo->bo->map;
- batch->end = bbo->bo->map + bbo->bo->size - batch_padding;
+ anv_batch_set_storage(batch, (struct anv_address) { .bo = bbo->bo, },
+ bbo->bo->map, bbo->bo->size - batch_padding);
batch->relocs = &bbo->relocs;
anv_reloc_list_clear(&bbo->relocs);
}
return result;
pipeline->base.batch.alloc = alloc;
- pipeline->base.batch.next = pipeline->base.batch.start = pipeline->batch_data;
- pipeline->base.batch.end = pipeline->base.batch.start + sizeof(pipeline->batch_data);
pipeline->base.batch.relocs = &pipeline->base.batch_relocs;
pipeline->base.batch.status = VK_SUCCESS;
+ anv_batch_set_storage(&pipeline->base.batch, ANV_NULL_ADDRESS,
+ pipeline->batch_data, sizeof(pipeline->batch_data));
pipeline->base.mem_ctx = ralloc_context(NULL);
pipeline->base.flags = pCreateInfo->flags;
void *location, struct anv_bo *bo, uint32_t offset);
struct anv_address anv_batch_address(struct anv_batch *batch, void *batch_location);
+static inline void
+anv_batch_set_storage(struct anv_batch *batch, struct anv_address addr,
+ void *map, size_t size)
+{
+ batch->start_addr = addr;
+ batch->next = batch->start = map;
+ batch->end = map + size;
+}
+
static inline VkResult
anv_batch_set_error(struct anv_batch *batch, VkResult error)
{
return result;
}
pipeline->base.batch.alloc = alloc;
- pipeline->base.batch.next = pipeline->base.batch.start = pipeline->batch_data;
- pipeline->base.batch.end = pipeline->base.batch.start + sizeof(pipeline->batch_data);
pipeline->base.batch.relocs = &pipeline->base.batch_relocs;
pipeline->base.batch.status = VK_SUCCESS;
+ anv_batch_set_storage(&pipeline->base.batch, ANV_NULL_ADDRESS,
+ pipeline->batch_data, sizeof(pipeline->batch_data));
pipeline->base.mem_ctx = ralloc_context(NULL);
pipeline->base.flags = pCreateInfo->flags;