[Mesa-dev] [PATCH 07/12] anv: Always set blorp GTT address
Chris Wilson
chris at chris-wilson.co.uk
Sun May 14 23:38:51 UTC 2017
A requirement for NORELOC is that the relocation entry exactly matches
the content of the buffer, and so we must set the value in the buffer on
adding the relocation.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
src/intel/blorp/blorp_genX_exec.h | 11 ++++++++---
src/intel/vulkan/genX_blorp_exec.c | 18 ++++++++++++++++--
src/mesa/drivers/dri/i965/genX_blorp_exec.c | 8 ++++----
3 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/src/intel/blorp/blorp_genX_exec.h b/src/intel/blorp/blorp_genX_exec.h
index 9e61f69492..42796a6e83 100644
--- a/src/intel/blorp/blorp_genX_exec.h
+++ b/src/intel/blorp/blorp_genX_exec.h
@@ -69,7 +69,8 @@ static void
blorp_flush_range(struct blorp_batch *batch, void *start, size_t size);
static void
-blorp_surface_reloc(struct blorp_batch *batch, uint32_t ss_offset,
+blorp_surface_reloc(struct blorp_batch *batch,
+ void *location, uint32_t ss_offset,
struct blorp_address address, uint32_t delta);
static void
@@ -1034,7 +1035,9 @@ blorp_emit_surface_state(struct blorp_batch *batch,
.aux_surf = &surface->aux_surf, .aux_usage = aux_usage,
.mocs = mocs, .clear_color = surface->clear_color);
- blorp_surface_reloc(batch, state_offset + isl_dev->ss.addr_offset,
+ blorp_surface_reloc(batch,
+ state + isl_dev->ss.addr_offset,
+ state_offset + isl_dev->ss.addr_offset,
surface->addr, 0);
if (aux_usage != ISL_AUX_USAGE_NONE) {
@@ -1044,7 +1047,9 @@ blorp_emit_surface_state(struct blorp_batch *batch,
*/
assert((surface->aux_addr.offset & 0xfff) == 0);
uint32_t *aux_addr = state + isl_dev->ss.aux_addr_offset;
- blorp_surface_reloc(batch, state_offset + isl_dev->ss.aux_addr_offset,
+ blorp_surface_reloc(batch,
+ aux_addr,
+ state_offset + isl_dev->ss.aux_addr_offset,
surface->aux_addr, *aux_addr);
}
diff --git a/src/intel/vulkan/genX_blorp_exec.c b/src/intel/vulkan/genX_blorp_exec.c
index ff243b1fa2..2d6aba80a3 100644
--- a/src/intel/vulkan/genX_blorp_exec.c
+++ b/src/intel/vulkan/genX_blorp_exec.c
@@ -52,17 +52,31 @@ blorp_emit_reloc(struct blorp_batch *batch,
address.buffer, address.offset + delta);
}
+static void set_gtt_address(void *location, uint64_t address)
+{
+#if GEN_GEN >= 8
+ *(uint64_t *)location = address;
+#else
+ *(uint32_t *)location = address;
+#endif
+}
+
static void
-blorp_surface_reloc(struct blorp_batch *batch, uint32_t ss_offset,
+blorp_surface_reloc(struct blorp_batch *batch,
+ void *location, uint32_t ss_offset,
struct blorp_address address, uint32_t delta)
{
struct anv_cmd_buffer *cmd_buffer = batch->driver_batch;
+ uint64_t gtt;
+
VkResult result =
anv_reloc_list_add(&cmd_buffer->surface_relocs, &cmd_buffer->pool->alloc,
ss_offset, address.buffer, address.offset + delta,
- NULL);
+ >t);
if (result != VK_SUCCESS)
anv_batch_set_error(&cmd_buffer->batch, result);
+
+ set_gtt_address(location, gtt);
}
static void *
diff --git a/src/mesa/drivers/dri/i965/genX_blorp_exec.c b/src/mesa/drivers/dri/i965/genX_blorp_exec.c
index 7157420328..1419f8e253 100644
--- a/src/mesa/drivers/dri/i965/genX_blorp_exec.c
+++ b/src/mesa/drivers/dri/i965/genX_blorp_exec.c
@@ -62,7 +62,8 @@ blorp_emit_reloc(struct blorp_batch *batch,
}
static void
-blorp_surface_reloc(struct blorp_batch *batch, uint32_t ss_offset,
+blorp_surface_reloc(struct blorp_batch *batch,
+ void *location, uint32_t ss_offset,
struct blorp_address address, uint32_t delta)
{
assert(batch->blorp->driver_ctx == batch->driver_batch);
@@ -73,11 +74,10 @@ blorp_surface_reloc(struct blorp_batch *batch, uint32_t ss_offset,
address.read_domains, address.write_domain);
uint64_t reloc_val = bo->offset64 + address.offset + delta;
- void *reloc_ptr = (void *)brw->batch.map + ss_offset;
#if GEN_GEN >= 8
- *(uint64_t *)reloc_ptr = reloc_val;
+ *(uint64_t *)location = reloc_val;
#else
- *(uint32_t *)reloc_ptr = reloc_val;
+ *(uint32_t *)location = reloc_val;
#endif
}
--
2.11.0
More information about the mesa-dev
mailing list