Mesa (master): anv: Add an anv_batch_set_storage helper
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jun 16 17:16:04 UTC 2020
Module: Mesa
Branch: master
Commit: 1b693341ac9c0e07b794307180a105d357d09e61
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1b693341ac9c0e07b794307180a105d357d09e61
Author: Jason Ekstrand <jason at jlekstrand.net>
Date: Tue Jun 16 10:50:19 2020 -0500
anv: Add an anv_batch_set_storage helper
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5457>
---
src/intel/vulkan/anv_batch_chain.c | 5 ++---
src/intel/vulkan/anv_pipeline.c | 4 ++--
src/intel/vulkan/anv_private.h | 9 +++++++++
src/intel/vulkan/genX_pipeline.c | 4 ++--
4 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c
index 67202307b54..d4cd56dc177 100644
--- a/src/intel/vulkan/anv_batch_chain.c
+++ b/src/intel/vulkan/anv_batch_chain.c
@@ -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);
}
diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 62a0c5a0b16..b3469518884 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -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;
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 8f5dcd37fbc..be0cc9bc59e 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -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)
{
diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c
index 49ccc5ea9e3..d83716bfedf 100644
--- a/src/intel/vulkan/genX_pipeline.c
+++ b/src/intel/vulkan/genX_pipeline.c
@@ -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;
More information about the mesa-commit
mailing list