[Mesa-dev] [PATCH v4 13/23] anv/blorp: Write relocated values into surface states

Jason Ekstrand jason at jlekstrand.net
Thu May 31 15:46:34 UTC 2018


From: Scott D Phillips <scott.d.phillips at intel.com>

v2 (Jason Ekstrand):
 - Split the blorp bit into it's own patch and re-order a bit
 - Use anv_address helpers

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
---
 src/intel/vulkan/anv_batch_chain.c | 16 ----------------
 src/intel/vulkan/anv_private.h     | 16 ++++++++++++++++
 src/intel/vulkan/genX_blorp_exec.c |  6 ++++++
 3 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c
index a1fb8bf7..ec8815a 100644
--- a/src/intel/vulkan/anv_batch_chain.c
+++ b/src/intel/vulkan/anv_batch_chain.c
@@ -1106,22 +1106,6 @@ anv_cmd_buffer_process_relocs(struct anv_cmd_buffer *cmd_buffer,
 }
 
 static void
-write_reloc(const struct anv_device *device, void *p, uint64_t v, bool flush)
-{
-   unsigned reloc_size = 0;
-   if (device->info.gen >= 8) {
-      reloc_size = sizeof(uint64_t);
-      *(uint64_t *)p = gen_canonical_address(v);
-   } else {
-      reloc_size = sizeof(uint32_t);
-      *(uint32_t *)p = v;
-   }
-
-   if (flush && !device->info.has_llc)
-      gen_flush_range(p, reloc_size);
-}
-
-static void
 adjust_relocations_from_state_pool(struct anv_state_pool *pool,
                                    struct anv_reloc_list *relocs,
                                    uint32_t last_pool_center_bo_offset)
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 5e07617..67a12c7 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -1144,6 +1144,22 @@ anv_address_add(struct anv_address addr, uint64_t offset)
    return addr;
 }
 
+static inline void
+write_reloc(const struct anv_device *device, void *p, uint64_t v, bool flush)
+{
+   unsigned reloc_size = 0;
+   if (device->info.gen >= 8) {
+      reloc_size = sizeof(uint64_t);
+      *(uint64_t *)p = gen_canonical_address(v);
+   } else {
+      reloc_size = sizeof(uint32_t);
+      *(uint32_t *)p = v;
+   }
+
+   if (flush && !device->info.has_llc)
+      gen_flush_range(p, reloc_size);
+}
+
 static inline uint64_t
 _anv_combine_address(struct anv_batch *batch, void *location,
                      const struct anv_address address, uint32_t delta)
diff --git a/src/intel/vulkan/genX_blorp_exec.c b/src/intel/vulkan/genX_blorp_exec.c
index 9023269..ecca392 100644
--- a/src/intel/vulkan/genX_blorp_exec.c
+++ b/src/intel/vulkan/genX_blorp_exec.c
@@ -62,6 +62,12 @@ blorp_surface_reloc(struct blorp_batch *batch, uint32_t ss_offset,
                          ss_offset, address.buffer, address.offset + delta);
    if (result != VK_SUCCESS)
       anv_batch_set_error(&cmd_buffer->batch, result);
+
+   void *dest = cmd_buffer->device->surface_state_pool.block_pool.map +
+      ss_offset;
+   uint64_t val = ((struct anv_bo*)address.buffer)->offset + address.offset +
+      delta;
+   write_reloc(cmd_buffer->device, dest, val, false);
 }
 
 #if GEN_GEN >= 7 && GEN_GEN < 10
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list