<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 18, 2016 at 5:30 PM, Ian Romanick <span dir="ltr"><<a href="mailto:idr@freedesktop.org" target="_blank">idr@freedesktop.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 04/18/2016 05:10 PM, Jason Ekstrand wrote:<br>
> ---<br>
> src/intel/vulkan/genX_cmd_buffer.c | 116 ++++++++++++++++++++-----------------<br>
> 1 file changed, 64 insertions(+), 52 deletions(-)<br>
><br>
> diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c<br>
> index 45b009b..4a75825 100644<br>
> --- a/src/intel/vulkan/genX_cmd_buffer.c<br>
> +++ b/src/intel/vulkan/genX_cmd_buffer.c<br>
> @@ -572,17 +572,19 @@ static void<br>
> emit_lrm(struct anv_batch *batch,<br>
> uint32_t reg, struct anv_bo *bo, uint32_t offset)<br>
> {<br>
> - anv_batch_emit(batch, GENX(MI_LOAD_REGISTER_MEM),<br>
> - .RegisterAddress = reg,<br>
> - .MemoryAddress = { bo, offset });<br>
> + anv_batch_emit_blk(batch, GENX(MI_LOAD_REGISTER_MEM), lrm) {<br>
> + lrm.RegisterAddress = reg;<br>
> + lrm.MemoryAddress = (struct anv_address) { bo, offset };<br>
> + }<br>
> }<br>
><br>
> static void<br>
> emit_lri(struct anv_batch *batch, uint32_t reg, uint32_t imm)<br>
<br>
</span>In patch 8 the Gen8 emit_lri helper is removed, but this one stays. It<br>
seems like either both should go or both should stay. I also thought it<br>
was odd that the Gen8 emit_lri was a #define while this is a function.<br>
Perhaps there's something else happening here that I don't see.<br><div class="HOEnZb"><div class="h5"></div></div></blockquote><div><br></div><div>Right. I wanted to just move it out of genX to some place shared and use it in gen7 and gen8. Unfortunately, I'm not sure exactly where to do that. The reason I kept the genX one is because it's used some 8 times while the gen7 and gen8 versions are used once or twice and they didn't seem worth keeping.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
> {<br>
> - anv_batch_emit(batch, GENX(MI_LOAD_REGISTER_IMM),<br>
> - .RegisterOffset = reg,<br>
> - .DataDWord = imm);<br>
> + anv_batch_emit_blk(batch, GENX(MI_LOAD_REGISTER_IMM), lri) {<br>
> + lri.RegisterOffset = reg;<br>
> + lri.DataDWord = imm;<br>
> + }<br>
> }<br>
><br>
> void genX(CmdDrawIndirect)(<br>
> @@ -695,18 +697,19 @@ void genX(CmdDispatch)(<br>
><br>
> genX(cmd_buffer_flush_compute_state)(cmd_buffer);<br>
><br>
> - anv_batch_emit(&cmd_buffer->batch, GENX(GPGPU_WALKER),<br>
> - .SIMDSize = prog_data->simd_size / 16,<br>
> - .ThreadDepthCounterMaximum = 0,<br>
> - .ThreadHeightCounterMaximum = 0,<br>
> - .ThreadWidthCounterMaximum = pipeline->cs_thread_width_max - 1,<br>
> - .ThreadGroupIDXDimension = x,<br>
> - .ThreadGroupIDYDimension = y,<br>
> - .ThreadGroupIDZDimension = z,<br>
> - .RightExecutionMask = pipeline->cs_right_mask,<br>
> - .BottomExecutionMask = 0xffffffff);<br>
> -<br>
> - anv_batch_emit(&cmd_buffer->batch, GENX(MEDIA_STATE_FLUSH));<br>
> + anv_batch_emit_blk(&cmd_buffer->batch, GENX(GPGPU_WALKER), ggw) {<br>
> + ggw.SIMDSize = prog_data->simd_size / 16;<br>
> + ggw.ThreadDepthCounterMaximum = 0;<br>
> + ggw.ThreadHeightCounterMaximum = 0;<br>
> + ggw.ThreadWidthCounterMaximum = pipeline->cs_thread_width_max - 1;<br>
> + ggw.ThreadGroupIDXDimension = x;<br>
> + ggw.ThreadGroupIDYDimension = y;<br>
> + ggw.ThreadGroupIDZDimension = z;<br>
> + ggw.RightExecutionMask = pipeline->cs_right_mask;<br>
> + ggw.BottomExecutionMask = 0xffffffff;<br>
> + }<br>
> +<br>
> + anv_batch_emit_blk(&cmd_buffer->batch, GENX(MEDIA_STATE_FLUSH), msf);<br>
> }<br>
><br>
> #define GPGPU_DISPATCHDIMX 0x2500<br>
> @@ -758,48 +761,53 @@ void genX(CmdDispatchIndirect)(<br>
> emit_lrm(batch, MI_PREDICATE_SRC0, bo, bo_offset + 0);<br>
><br>
> /* predicate = (compute_dispatch_indirect_x_size == 0); */<br>
> - anv_batch_emit(batch, GENX(MI_PREDICATE),<br>
> - .LoadOperation = LOAD_LOAD,<br>
> - .CombineOperation = COMBINE_SET,<br>
> - .CompareOperation = COMPARE_SRCS_EQUAL);<br>
> + anv_batch_emit_blk(batch, GENX(MI_PREDICATE), mip) {<br>
> + mip.LoadOperation = LOAD_LOAD;<br>
> + mip.CombineOperation = COMBINE_SET;<br>
> + mip.CompareOperation = COMPARE_SRCS_EQUAL;<br>
> + }<br>
><br>
> /* Load compute_dispatch_indirect_y_size into SRC0 */<br>
> emit_lrm(batch, MI_PREDICATE_SRC0, bo, bo_offset + 4);<br>
><br>
> /* predicate |= (compute_dispatch_indirect_y_size == 0); */<br>
> - anv_batch_emit(batch, GENX(MI_PREDICATE),<br>
> - .LoadOperation = LOAD_LOAD,<br>
> - .CombineOperation = COMBINE_OR,<br>
> - .CompareOperation = COMPARE_SRCS_EQUAL);<br>
> + anv_batch_emit_blk(batch, GENX(MI_PREDICATE), mip) {<br>
> + mip.LoadOperation = LOAD_LOAD;<br>
> + mip.CombineOperation = COMBINE_OR;<br>
> + mip.CompareOperation = COMPARE_SRCS_EQUAL;<br>
> + }<br>
><br>
> /* Load compute_dispatch_indirect_z_size into SRC0 */<br>
> emit_lrm(batch, MI_PREDICATE_SRC0, bo, bo_offset + 8);<br>
><br>
> /* predicate |= (compute_dispatch_indirect_z_size == 0); */<br>
> - anv_batch_emit(batch, GENX(MI_PREDICATE),<br>
> - .LoadOperation = LOAD_LOAD,<br>
> - .CombineOperation = COMBINE_OR,<br>
> - .CompareOperation = COMPARE_SRCS_EQUAL);<br>
> + anv_batch_emit_blk(batch, GENX(MI_PREDICATE), mip) {<br>
> + mip.LoadOperation = LOAD_LOAD;<br>
> + mip.CombineOperation = COMBINE_OR;<br>
> + mip.CompareOperation = COMPARE_SRCS_EQUAL;<br>
> + }<br>
><br>
> /* predicate = !predicate; */<br>
> #define COMPARE_FALSE 1<br>
> - anv_batch_emit(batch, GENX(MI_PREDICATE),<br>
> - .LoadOperation = LOAD_LOADINV,<br>
> - .CombineOperation = COMBINE_OR,<br>
> - .CompareOperation = COMPARE_FALSE);<br>
> + anv_batch_emit_blk(batch, GENX(MI_PREDICATE), mip) {<br>
> + mip.LoadOperation = LOAD_LOADINV;<br>
> + mip.CombineOperation = COMBINE_OR;<br>
> + mip.CompareOperation = COMPARE_FALSE;<br>
> + }<br>
> #endif<br>
><br>
> - anv_batch_emit(batch, GENX(GPGPU_WALKER),<br>
> - .IndirectParameterEnable = true,<br>
> - .PredicateEnable = GEN_GEN <= 7,<br>
> - .SIMDSize = prog_data->simd_size / 16,<br>
> - .ThreadDepthCounterMaximum = 0,<br>
> - .ThreadHeightCounterMaximum = 0,<br>
> - .ThreadWidthCounterMaximum = pipeline->cs_thread_width_max - 1,<br>
> - .RightExecutionMask = pipeline->cs_right_mask,<br>
> - .BottomExecutionMask = 0xffffffff);<br>
> -<br>
> - anv_batch_emit(batch, GENX(MEDIA_STATE_FLUSH));<br>
> + anv_batch_emit_blk(batch, GENX(GPGPU_WALKER), ggw) {<br>
> + ggw.IndirectParameterEnable = true;<br>
> + ggw.PredicateEnable = GEN_GEN <= 7;<br>
> + ggw.SIMDSize = prog_data->simd_size / 16;<br>
> + ggw.ThreadDepthCounterMaximum = 0;<br>
> + ggw.ThreadHeightCounterMaximum = 0;<br>
> + ggw.ThreadWidthCounterMaximum = pipeline->cs_thread_width_max - 1;<br>
> + ggw.RightExecutionMask = pipeline->cs_right_mask;<br>
> + ggw.BottomExecutionMask = 0xffffffff;<br>
> + }<br>
> +<br>
> + anv_batch_emit_blk(batch, GENX(MEDIA_STATE_FLUSH), msf);<br>
> }<br>
><br>
> static void<br>
> @@ -817,7 +825,7 @@ flush_pipeline_before_pipeline_select(struct anv_cmd_buffer *cmd_buffer,<br>
> * hardware too.<br>
> */<br>
> if (pipeline == GPGPU)<br>
> - anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_CC_STATE_POINTERS));<br>
> + anv_batch_emit_blk(&cmd_buffer->batch, GENX(3DSTATE_CC_STATE_POINTERS), t);<br>
> #elif GEN_GEN <= 7<br>
> /* From "BXML » GT » MI » vol1a GPU Overview » [Instruction]<br>
> * PIPELINE_SELECT [DevBWR+]":<br>
> @@ -853,11 +861,13 @@ genX(flush_pipeline_select_3d)(struct anv_cmd_buffer *cmd_buffer)<br>
> if (cmd_buffer->state.current_pipeline != _3D) {<br>
> flush_pipeline_before_pipeline_select(cmd_buffer, _3D);<br>
><br>
> - anv_batch_emit(&cmd_buffer->batch, GENX(PIPELINE_SELECT),<br>
> + anv_batch_emit_blk(&cmd_buffer->batch, GENX(PIPELINE_SELECT), ps) {<br>
> #if GEN_GEN >= 9<br>
> - .MaskBits = 3,<br>
> + ps.MaskBits = 3;<br>
> #endif<br>
> - .PipelineSelection = _3D);<br>
> + ps.PipelineSelection = _3D;<br>
> + }<br>
> +<br>
> cmd_buffer->state.current_pipeline = _3D;<br>
> }<br>
> }<br>
> @@ -868,11 +878,13 @@ genX(flush_pipeline_select_gpgpu)(struct anv_cmd_buffer *cmd_buffer)<br>
> if (cmd_buffer->state.current_pipeline != GPGPU) {<br>
> flush_pipeline_before_pipeline_select(cmd_buffer, GPGPU);<br>
><br>
> - anv_batch_emit(&cmd_buffer->batch, GENX(PIPELINE_SELECT),<br>
> + anv_batch_emit_blk(&cmd_buffer->batch, GENX(PIPELINE_SELECT), ps) {<br>
> #if GEN_GEN >= 9<br>
> - .MaskBits = 3,<br>
> + ps.MaskBits = 3;<br>
> #endif<br>
> - .PipelineSelection = GPGPU);<br>
> + ps.PipelineSelection = GPGPU;<br>
> + }<br>
> +<br>
> cmd_buffer->state.current_pipeline = GPGPU;<br>
> }<br>
> }<br>
><br>
<br>
</div></div></blockquote></div><br></div></div>