anv: Add an anv_batch_set_storage helper

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5457>
This commit is contained in:
Jason Ekstrand
2020-06-16 10:50:19 -05:00
committed by Marge Bot
parent fcdefa7e47
commit 1b693341ac
4 changed files with 15 additions and 7 deletions

View File

@@ -409,9 +409,8 @@ static void
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);
}

View File

@@ -2001,10 +2001,10 @@ anv_pipeline_init(struct anv_graphics_pipeline *pipeline,
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;

View File

@@ -1648,6 +1648,15 @@ uint64_t anv_batch_emit_reloc(struct anv_batch *batch,
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)
{

View File

@@ -2299,10 +2299,10 @@ compute_pipeline_create(
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;