<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Feb 21, 2017 at 4:05 AM, Lionel Landwerlin <span dir="ltr"><<a href="mailto:lionel.g.landwerlin@intel.com" target="_blank">lionel.g.landwerlin@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 20/02/17 19:21, Jason Ekstrand wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Found by inspection. However, I expect it fixes real bugs when using<br>
blorp from Vulkan on little-core platforms.<br>
<br>
Cc: "13.0 17.0" <<a href="mailto:mesa-stable@lists.freedesktop.org" target="_blank">mesa-stable@lists.freedesktop<wbr>.org</a>><br>
---<br>
src/intel/blorp/blorp_genX_exe<wbr>c.h | 17 ++++++++++++++++-<br>
src/intel/vulkan/genX_blorp_ex<wbr>ec.c | 8 ++++++++<br>
src/mesa/drivers/dri/i965/genX<wbr>_blorp_exec.c | 8 ++++++++<br>
3 files changed, 32 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/intel/blorp/blorp_genX_e<wbr>xec.h b/src/intel/blorp/blorp_genX_e<wbr>xec.h<br>
index a673ab8..1e6b05c 100644<br>
--- a/src/intel/blorp/blorp_genX_e<wbr>xec.h<br>
+++ b/src/intel/blorp/blorp_genX_e<wbr>xec.h<br>
@@ -66,6 +66,10 @@ blorp_alloc_binding_table(stru<wbr>ct blorp_batch *batch, unsigned num_entries,<br>
unsigned state_size, unsigned state_alignment,<br>
uint32_t *bt_offset, uint32_t *surface_offsets,<br>
void **surface_maps);<br>
+<br>
+static void<br>
+blorp_flush_range(struct blorp_batch *batch, void *start, size_t size);<br>
+<br>
static void<br>
blorp_surface_reloc(struct blorp_batch *batch, uint32_t ss_offset,<br>
struct blorp_address address, uint32_t delta);<br>
@@ -182,6 +186,7 @@ blorp_emit_vertex_data(struct blorp_batch *batch,<br>
void *data = blorp_alloc_vertex_buffer(batc<wbr>h, sizeof(vertices), addr);<br>
memcpy(data, vertices, sizeof(vertices));<br>
*size = sizeof(vertices);<br>
+ blorp_flush_range(batch, data, *size);<br>
}<br>
static void<br>
@@ -199,7 +204,8 @@ blorp_emit_input_varying_data(<wbr>struct blorp_batch *batch,<br>
*size = 16 + num_varyings * vec4_size_in_bytes;<br>
const uint32_t *const inputs_src = (const uint32_t *)¶ms->wm_inputs;<br>
- uint32_t *inputs = blorp_alloc_vertex_buffer(batc<wbr>h, *size, addr);<br>
+ void *data = blorp_alloc_vertex_buffer(batc<wbr>h, *size, addr);<br>
+ uint32_t *inputs = data;<br>
/* Copy in the VS inputs */<br>
assert(sizeof(params->vs_inpu<wbr>ts) == 16);<br>
@@ -223,6 +229,8 @@ blorp_emit_input_varying_data(<wbr>struct blorp_batch *batch,<br>
inputs += 4;<br>
}<br>
}<br>
+<br>
+ blorp_flush_range(batch, data, *size);<br>
}<br>
static void<br>
@@ -906,6 +914,7 @@ blorp_emit_blend_state(struct blorp_batch *batch,<br>
GENX(BLEND_STATE_length) * 4,<br>
64, &offset);<br>
GENX(BLEND_STATE_pack)(NULL, state, &blend);<br>
+ blorp_flush_range(batch, state, GENX(BLEND_STATE_length) * 4);<br>
#if GEN_GEN >= 7<br>
blorp_emit(batch, GENX(3DSTATE_BLEND_STATE_POINT<wbr>ERS), sp) {<br>
@@ -940,6 +949,7 @@ blorp_emit_color_calc_state(st<wbr>ruct blorp_batch *batch,<br>
GENX(COLOR_CALC_STATE_length) * 4,<br>
64, &offset);<br>
GENX(COLOR_CALC_STATE_pack)(N<wbr>ULL, state, &cc);<br>
+ blorp_flush_range(batch, state, GENX(COLOR_CALC_STATE_length) * 4);<br>
#if GEN_GEN >= 7<br>
blorp_emit(batch, GENX(3DSTATE_CC_STATE_POINTERS<wbr>), sp) {<br>
@@ -1016,6 +1026,7 @@ blorp_emit_depth_stencil_state<wbr>(struct blorp_batch *batch,<br>
GENX(DEPTH_STENCIL_STATE_leng<wbr>th) * 4,<br>
64, &offset);<br>
GENX(DEPTH_STENCIL_STATE_<wbr>pack)(NULL, state, &ds);<br>
+ blorp_flush_range(batch, state, GENX(DEPTH_STENCIL_STATE_lengt<wbr>h) * 4);<br>
#endif<br>
#if GEN_GEN == 7<br>
@@ -1068,6 +1079,8 @@ blorp_emit_surface_state(struc<wbr>t blorp_batch *batch,<br>
blorp_surface_reloc(batch, state_offset + isl_dev->ss.aux_addr_offset,<br>
surface->aux_addr, *aux_addr);<br>
}<br>
+<br>
+ blorp_flush_range(batch, state, GENX(RENDER_SURFACE_STATE_leng<wbr>th) * 4);<br>
}<br>
</blockquote>
<br></div></div>
Do we need a flush in blorp_emit_null_surface_state(<wbr>) too?</blockquote><div><br></div><div>Yes we do. I just realized we may have another missing flush as well. :/ I'll send a v3<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<div class="HOEnZb"><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
static void<br>
@@ -1181,6 +1194,7 @@ blorp_emit_sampler_state(struc<wbr>t blorp_batch *batch,<br>
GENX(SAMPLER_STATE_length) * 4,<br>
32, &offset);<br>
GENX(SAMPLER_STATE_pack)(<wbr>NULL, state, &sampler);<br>
+ blorp_flush_range(batch, state, GENX(SAMPLER_STATE_length) * 4);<br>
#if GEN_GEN >= 7<br>
blorp_emit(batch, GENX(3DSTATE_SAMPLER_STATE_POI<wbr>NTERS_PS), ssp) {<br>
@@ -1333,6 +1347,7 @@ blorp_emit_viewport_state(stru<wbr>ct blorp_batch *batch,<br>
.MinimumDepth = 0.0,<br>
.MaximumDepth = 1.0,<br>
});<br>
+ blorp_flush_range(batch, state, GENX(CC_VIEWPORT_length) * 4);<br>
#if GEN_GEN >= 7<br>
blorp_emit(batch, GENX(3DSTATE_VIEWPORT_STATE_PO<wbr>INTERS_CC), vsp) {<br>
diff --git a/src/intel/vulkan/genX_blorp_<wbr>exec.c b/src/intel/vulkan/genX_blorp_<wbr>exec.c<br>
index 6f0b063..f7969e5 100644<br>
--- a/src/intel/vulkan/genX_blorp_<wbr>exec.c<br>
+++ b/src/intel/vulkan/genX_blorp_<wbr>exec.c<br>
@@ -119,6 +119,14 @@ blorp_alloc_vertex_buffer(stru<wbr>ct blorp_batch *batch, uint32_t size,<br>
}<br>
static void<br>
+blorp_flush_range(struct blorp_batch *batch, void *start, size_t size)<br>
+{<br>
+ struct anv_device *device = batch->blorp->driver_ctx;<br>
+ if (device->info.has_llc)<br>
+ anv_clflush_range(start, size);<br>
+}<br>
+<br>
+static void<br>
blorp_emit_urb_config(struct blorp_batch *batch, unsigned vs_entry_size)<br>
{<br>
struct anv_device *device = batch->blorp->driver_ctx;<br>
diff --git a/src/mesa/drivers/dri/i965/ge<wbr>nX_blorp_exec.c b/src/mesa/drivers/dri/i965/ge<wbr>nX_blorp_exec.c<br>
index 37b29cd..8e011e9 100644<br>
--- a/src/mesa/drivers/dri/i965/ge<wbr>nX_blorp_exec.c<br>
+++ b/src/mesa/drivers/dri/i965/ge<wbr>nX_blorp_exec.c<br>
@@ -145,6 +145,14 @@ blorp_alloc_vertex_buffer(stru<wbr>ct blorp_batch *batch, uint32_t size,<br>
}<br>
static void<br>
+blorp_flush_range(struct blorp_batch *batch, void *start, size_t size)<br>
+{<br>
+ /* All allocated states come from the batch which we will flush before we<br>
+ * submit it. There's nothing for us to do here.<br>
+ */<br>
+}<br>
+<br>
+static void<br>
blorp_emit_urb_config(struct blorp_batch *batch, unsigned vs_entry_size)<br>
{<br>
assert(batch->blorp->driver_c<wbr>tx == batch->driver_batch);<br>
</blockquote>
<br>
<br>
</div></div></blockquote></div><br></div></div>