<div dir="ltr">Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 29, 2017 at 12:11 PM, <span dir="ltr"><<a href="mailto:cstout@chromium.org" target="_blank">cstout@chromium.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Craig Stout <<a href="mailto:cstout@google.com">cstout@google.com</a>><br>
<br>
anv_state_pool_alloc requires a matching free, whereas<br>
anv_state_stream_alloc will be cleaned up on finish.<br>
<br>
Applies only to 13.0 branch.<br>
x<br>
<a href="https://bugs.freedesktop.org/show_bug.cgi?id=100365" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/<wbr>show_bug.cgi?id=100365</a><br>
---<br>
src/intel/vulkan/anv_private.h | 12 ++++++++++++<br>
src/intel/vulkan/genX_cmd_<wbr>buffer.c | 32 ++++++++++++++++--------------<wbr>--<br>
2 files changed, 28 insertions(+), 16 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/anv_<wbr>private.h b/src/intel/vulkan/anv_<wbr>private.h<br>
index dd67508..12a6aa1 100644<br>
--- a/src/intel/vulkan/anv_<wbr>private.h<br>
+++ b/src/intel/vulkan/anv_<wbr>private.h<br>
@@ -765,6 +765,18 @@ _anv_combine_address(struct anv_batch *batch, void *location,<br>
__state; \<br>
})<br>
<br>
+#define anv_state_stream_emit(stream, cmd, align, ...) \<br>
+ ({ \<br>
+ const uint32_t __size = __anv_cmd_length(cmd) * 4; \<br>
+ struct anv_state __state = anv_state_stream_alloc((<wbr>stream), __size, align); \<br>
+ struct cmd __template = {__VA_ARGS__}; \<br>
+ __anv_cmd_pack(cmd)(NULL, __state.map, &__template); \<br>
+ VG(VALGRIND_CHECK_MEM_IS_<wbr>DEFINED(__state.map, __anv_cmd_length(cmd) * 4)); \<br>
+ if (!(stream)->block_pool-><wbr>device->info.has_llc) \<br>
+ anv_state_clflush(__state); \<br>
+ __state; \<br>
+ })<br>
+<br>
#define GEN7_MOCS (struct GEN7_MEMORY_OBJECT_CONTROL_<wbr>STATE) { \<br>
.GraphicsDataTypeGFDT = 0, \<br>
.LLCCacheabilityControlLLCCC = 0, \<br>
diff --git a/src/intel/vulkan/genX_cmd_<wbr>buffer.c b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
index 45fefc9..33db7ce 100644<br>
--- a/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
+++ b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
@@ -1367,26 +1367,26 @@ flush_compute_descriptor_set(<wbr>struct anv_cmd_buffer *cmd_buffer)<br>
const uint32_t slm_size = encode_slm_size(GEN_GEN, prog_data->total_shared);<br>
<br>
struct anv_state state =<br>
- anv_state_pool_emit(&device-><wbr>dynamic_state_pool,<br>
- GENX(INTERFACE_DESCRIPTOR_<wbr>DATA), 64,<br>
- .KernelStartPointer = pipeline->cs_simd,<br>
- .BindingTablePointer = surfaces.offset,<br>
- .BindingTableEntryCount = 0,<br>
- .SamplerStatePointer = samplers.offset,<br>
- .SamplerCount = 0,<br>
+ anv_state_stream_emit(&cmd_<wbr>buffer->dynamic_state_stream,<br>
+ GENX(INTERFACE_DESCRIPTOR_<wbr>DATA), 64,<br>
+ .KernelStartPointer = pipeline->cs_simd,<br>
+ .BindingTablePointer = surfaces.offset,<br>
+ .BindingTableEntryCount = 0,<br>
+ .SamplerStatePointer = samplers.offset,<br>
+ .SamplerCount = 0,<br>
#if !GEN_IS_HASWELL<br>
- .ConstantURBEntryReadOffset = 0,<br>
+ .ConstantURBEntryReadOffset = 0,<br>
#endif<br>
- .ConstantURBEntryReadLength =<br>
- cs_prog_data->push.per_thread.<wbr>regs,<br>
+ .ConstantURBEntryReadLength =<br>
+ cs_prog_data->push.per_thread.<wbr>regs,<br>
#if GEN_GEN >= 8 || GEN_IS_HASWELL<br>
- .<wbr>CrossThreadConstantDataReadLen<wbr>gth =<br>
- cs_prog_data->push.cross_<wbr>thread.regs,<br>
+ .<wbr>CrossThreadConstantDataReadLen<wbr>gth =<br>
+ cs_prog_data->push.cross_<wbr>thread.regs,<br>
#endif<br>
- .BarrierEnable = cs_prog_data->uses_barrier,<br>
- .SharedLocalMemorySize = slm_size,<br>
- .<wbr>NumberofThreadsinGPGPUThreadGr<wbr>oup =<br>
- cs_prog_data->threads);<br>
+ .BarrierEnable = cs_prog_data->uses_barrier,<br>
+ .SharedLocalMemorySize = slm_size,<br>
+ .<wbr>NumberofThreadsinGPGPUThreadGr<wbr>oup =<br>
+ cs_prog_data->threads);<br>
<br>
uint32_t size = GENX(INTERFACE_DESCRIPTOR_<wbr>DATA_length) * sizeof(uint32_t);<br>
anv_batch_emit(&cmd_buffer-><wbr>batch,<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.7.4<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div>