[Mesa-dev] [PATCH 08/12] anv: Always set surface_state GTT address
Chris Wilson
chris at chris-wilson.co.uk
Sun May 14 23:38:52 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/vulkan/genX_cmd_buffer.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index ef65ffe629..d12e5fe3dd 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -164,19 +164,31 @@ genX(cmd_buffer_emit_state_base_address)(struct anv_cmd_buffer *cmd_buffer)
}
}
+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
add_surface_state_reloc(struct anv_cmd_buffer *cmd_buffer,
struct anv_state state,
struct anv_bo *bo, uint32_t offset)
{
const struct isl_device *isl_dev = &cmd_buffer->device->isl_dev;
+ uint64_t address;
VkResult result =
anv_reloc_list_add(&cmd_buffer->surface_relocs, &cmd_buffer->pool->alloc,
state.offset + isl_dev->ss.addr_offset, bo, offset,
- NULL);
+ &address);
if (result != VK_SUCCESS)
anv_batch_set_error(&cmd_buffer->batch, result);
+
+ set_gtt_address(state.map + isl_dev->ss.addr_offset, address);
}
static void
@@ -200,14 +212,17 @@ add_image_view_relocs(struct anv_cmd_buffer *cmd_buffer,
uint32_t *aux_addr_dw = state.map + isl_dev->ss.aux_addr_offset;
aux_offset += *aux_addr_dw & 0xfff;
+ uint64_t address;
VkResult result =
anv_reloc_list_add(&cmd_buffer->surface_relocs,
&cmd_buffer->pool->alloc,
state.offset + isl_dev->ss.aux_addr_offset,
iview->bo, aux_offset,
- NULL);
+ &address);
if (result != VK_SUCCESS)
anv_batch_set_error(&cmd_buffer->batch, result);
+
+ set_gtt_address(aux_addr_dw, address);
}
}
--
2.11.0
More information about the mesa-dev
mailing list