<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Jun 15, 2018 at 1:12 PM, Rafael Antognolli <span dir="ltr"><<a href="mailto:rafael.antognolli@intel.com" target="_blank">rafael.antognolli@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If we are on gen8+ and have context isolation support, just make that<br>
constant buffer address be absolute, so we can use it for push UBOs too.<br>
---<br>
src/intel/vulkan/anv_device.c | 5 ++++-<br>
src/intel/vulkan/anv_private.h | 1 +<br>
src/intel/vulkan/genX_state.c | 27 +++++++++++++++++++++++++++<br>
3 files changed, 32 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/intel/vulkan/anv_device.<wbr>c b/src/intel/vulkan/anv_device.<wbr>c<br>
index d1637f097e8..002b05f15f8 100644<br>
--- a/src/intel/vulkan/anv_device.<wbr>c<br>
+++ b/src/intel/vulkan/anv_device.<wbr>c<br>
@@ -430,7 +430,8 @@ anv_physical_device_init(<wbr>struct anv_physical_device *device,<br>
device->compiler->shader_<wbr>debug_log = compiler_debug_log;<br>
device->compiler->shader_perf_<wbr>log = compiler_perf_log;<br>
device->compiler->supports_<wbr>pull_constants = false;<br>
- device->compiler->constant_<wbr>buffer_0_is_relative = true;<br>
+ device->compiler->constant_<wbr>buffer_0_is_relative =<br>
+ device->info.gen < 8 || !device->has_context_<wbr>isolation;<br>
<br>
isl_device_init(&device->isl_<wbr>dev, &device->info, swizzled);<br>
<br>
@@ -1519,6 +1520,8 @@ VkResult anv_CreateDevice(<br>
device->chipset_id = physical_device->chipset_id;<br>
device->no_hw = physical_device->no_hw;<br>
device->lost = false;<br>
+ device->constant_buffer_0_is_<wbr>relative =<br>
+ physical_device->compiler-><wbr>constant_buffer_0_is_relative;<br>
<br>
if (pAllocator)<br>
device->alloc = *pAllocator;<br>
diff --git a/src/intel/vulkan/anv_<wbr>private.h b/src/intel/vulkan/anv_<wbr>private.h<br>
index 6af2a0bd3f3..d7297da6f57 100644<br>
--- a/src/intel/vulkan/anv_<wbr>private.h<br>
+++ b/src/intel/vulkan/anv_<wbr>private.h<br>
@@ -983,6 +983,7 @@ struct anv_device {<br>
pthread_mutex_t mutex;<br>
pthread_cond_t queue_submit;<br>
bool lost;<br>
+ bool constant_buffer_0_is_relative;<br></blockquote><div><br></div><div>I don't think we need a device boolean for this. Let's just dig it out of the compiler or the physical device. I think the physical device probably makes a bit more sense. Other than that, the series looks good to me.</div><div><br></div><div>--Jason<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
};<br>
<br>
static inline struct anv_state_pool *<br>
diff --git a/src/intel/vulkan/genX_state.<wbr>c b/src/intel/vulkan/genX_state.<wbr>c<br>
index c6e54046910..46e020c8134 100644<br>
--- a/src/intel/vulkan/genX_state.<wbr>c<br>
+++ b/src/intel/vulkan/genX_state.<wbr>c<br>
@@ -169,6 +169,33 @@ genX(init_device_state)(struct anv_device *device)<br>
gen10_emit_wa_lri_to_cache_<wbr>mode_zero(&batch);<br>
#endif<br>
<br>
+ /* Set the "CONSTANT_BUFFER Address Offset Disable" bit, so<br>
+ * 3DSTATE_CONSTANT_XS buffer 0 is an absolute address.<br>
+ *<br>
+ * This is only safe on kernels with context isolation support.<br>
+ */<br>
+ if (GEN_GEN >= 8 &&<br>
+ !device->constant_buffer_0_is_<wbr>relative) {<br>
+ UNUSED uint32_t tmp_reg;<br>
+#if GEN_GEN >= 9<br>
+ anv_pack_struct(&tmp_reg, GENX(CS_DEBUG_MODE2),<br>
+ .CONSTANT_<wbr>BUFFERAddressOffsetDisable = true,<br>
+ .CONSTANT_<wbr>BUFFERAddressOffsetDisableMask = true);<br>
+ anv_batch_emit(&batch, GENX(MI_LOAD_REGISTER_IMM), lri) {<br>
+ lri.RegisterOffset = GENX(CS_DEBUG_MODE2_num);<br>
+ lri.DataDWord = tmp_reg;<br>
+ }<br>
+#elif GEN_GEN == 8<br>
+ anv_pack_struct(&tmp_reg, GENX(INSTPM),<br>
+ .CONSTANT_<wbr>BUFFERAddressOffsetDisable = true,<br>
+ .CONSTANT_<wbr>BUFFERAddressOffsetDisableMask = true);<br>
+ anv_batch_emit(&batch, GENX(MI_LOAD_REGISTER_IMM), lri) {<br>
+ lri.RegisterOffset = GENX(INSTPM_num);<br>
+ lri.DataDWord = tmp_reg;<br>
+ }<br>
+#endif<br>
+ }<br>
+<br>
anv_batch_emit(&batch, GENX(MI_BATCH_BUFFER_END), bbe);<br>
<br>
assert(batch.next <= batch.end);<br>
<span class="HOEnZb"><font color="#888888">-- <br>
2.14.3<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></div>