From: Kristian Høgsberg Kristensen Date: Fri, 31 Jul 2015 20:45:54 +0000 (-0700) Subject: vk: Call anv_batch_emit_dwords() up front in anv_batch_emit() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4b097d73e6bc360235915d34b798284d09174929;p=mesa.git vk: Call anv_batch_emit_dwords() up front in anv_batch_emit() This avoids putting a memory barrier between the template struct and the pack function, which generates much better code. --- diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h index f14a6ca858f..48edc6c95ed 100644 --- a/src/vulkan/anv_private.h +++ b/src/vulkan/anv_private.h @@ -528,22 +528,22 @@ __gen_combine_address(struct anv_batch *batch, void *location, #include "gen8_pack.h" #define anv_batch_emit(batch, cmd, ...) do { \ + void *__dst = anv_batch_emit_dwords(batch, cmd ## _length); \ struct cmd __template = { \ cmd ## _header, \ __VA_ARGS__ \ }; \ - void *__dst = anv_batch_emit_dwords(batch, cmd ## _length); \ cmd ## _pack(batch, __dst, &__template); \ VG(VALGRIND_CHECK_MEM_IS_DEFINED(__dst, cmd ## _length * 4)); \ } while (0) #define anv_batch_emitn(batch, n, cmd, ...) ({ \ + void *__dst = anv_batch_emit_dwords(batch, n); \ struct cmd __template = { \ cmd ## _header, \ .DwordLength = n - cmd ## _length_bias, \ __VA_ARGS__ \ }; \ - void *__dst = anv_batch_emit_dwords(batch, n); \ cmd ## _pack(batch, __dst, &__template); \ __dst; \ })