[Mesa-dev] [PATCH 2/3] anv: Use a designated initializer for filling out relocs
Jason Ekstrand
jason at jlekstrand.net
Wed May 10 23:08:54 UTC 2017
---
src/intel/vulkan/anv_batch_chain.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c
index 13303b1..cc4f92e 100644
--- a/src/intel/vulkan/anv_batch_chain.c
+++ b/src/intel/vulkan/anv_batch_chain.c
@@ -146,9 +146,6 @@ anv_reloc_list_add(struct anv_reloc_list *list,
uint32_t offset, struct anv_bo *target_bo, uint32_t delta,
uint64_t *bo_offset_out)
{
- struct drm_i915_gem_relocation_entry *entry;
- int index;
-
const uint32_t domain =
(target_bo->flags & EXEC_OBJECT_WRITE) ? I915_GEM_DOMAIN_RENDER : 0;
@@ -165,16 +162,18 @@ anv_reloc_list_add(struct anv_reloc_list *list,
uint64_t presumed_offset = target_bo->offset;
/* XXX: Can we use I915_EXEC_HANDLE_LUT? */
- index = list->num_relocs++;
+ int index = list->num_relocs++;
list->reloc_bos[index] = target_bo;
- entry = &list->relocs[index];
- entry->target_handle = target_bo->gem_handle;
- entry->delta = delta;
- entry->offset = offset;
- entry->presumed_offset = presumed_offset;
- entry->read_domains = domain;
- entry->write_domain = domain;
- VG(VALGRIND_CHECK_MEM_IS_DEFINED(entry, sizeof(*entry)));
+ list->relocs[index] = (struct drm_i915_gem_relocation_entry) {
+ .target_handle = target_bo->gem_handle,
+ .delta = delta,
+ .offset = offset,
+ .presumed_offset = presumed_offset,
+ .read_domains = domain,
+ .write_domain = domain,
+ };
+ VG(VALGRIND_CHECK_MEM_IS_DEFINED(&list->relocs[index],
+ sizeof(&list->relocs[index])));
*bo_offset_out = presumed_offset;
--
2.5.0.400.gff86faf
More information about the mesa-dev
mailing list