<div dir="ltr">Turns out these were already in-tree and I forgot I pushed them... Sorry for the noise.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 1, 2017 at 12:01 AM, Pohjolainen, Topi <span dir="ltr"><<a href="mailto:topi.pohjolainen@gmail.com" target="_blank">topi.pohjolainen@gmail.com</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 Tue, Jan 31, 2017 at 11:05:28AM -0800, Jason Ekstrand wrote:<br>
> While we're at it, we rename it to remove the brw_ prefix<br>
<br>
</span>Nice! Both patches:<br>
<br>
Reviewed-by: Topi Pohjolainen <<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a>><br>
<div><div class="h5"><br>
><br>
> Signed-off-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
> ---<br>
> src/intel/blorp/blorp.c | 26 +++++---------<br>
> src/intel/blorp/blorp_blit.c | 2 +-<br>
> src/intel/blorp/blorp_clear.c | 2 +-<br>
> src/intel/blorp/blorp_genX_<wbr>exec.h | 72 +++++++++++++++++++-----------<wbr>---------<br>
> src/intel/blorp/blorp_priv.h | 30 ++++------------<br>
> 5 files changed, 52 insertions(+), 80 deletions(-)<br>
><br>
> diff --git a/src/intel/blorp/blorp.c b/src/intel/blorp/blorp.c<br>
> index 2f27274..8a90c3b 100644<br>
> --- a/src/intel/blorp/blorp.c<br>
> +++ b/src/intel/blorp/blorp.c<br>
> @@ -145,7 +145,7 @@ const unsigned *<br>
> brw_blorp_compile_nir_shader(<wbr>struct blorp_context *blorp, struct nir_shader *nir,<br>
> const struct brw_wm_prog_key *wm_key,<br>
> bool use_repclear,<br>
> - struct brw_blorp_prog_data *prog_data,<br>
> + struct blorp_prog_data *prog_data,<br>
> unsigned *program_size)<br>
> {<br>
> const struct brw_compiler *compiler = blorp->compiler;<br>
> @@ -160,15 +160,14 @@ brw_blorp_compile_nir_shader(<wbr>struct blorp_context *blorp, struct nir_shader *nir<br>
> nir->options =<br>
> compiler->glsl_compiler_<wbr>options[MESA_SHADER_FRAGMENT].<wbr>NirOptions;<br>
><br>
> - struct brw_wm_prog_data wm_prog_data;<br>
> - memset(&wm_prog_data, 0, sizeof(wm_prog_data));<br>
> + memset(prog_data, 0, sizeof(*prog_data));<br>
><br>
> - wm_prog_data.base.nr_params = 0;<br>
> - wm_prog_data.base.param = NULL;<br>
> + prog_data->wm.base.nr_params = 0;<br>
> + prog_data->wm.base.param = NULL;<br>
><br>
> /* BLORP always just uses the first two binding table entries */<br>
> - wm_prog_data.binding_table.<wbr>render_target_start = BLORP_RENDERBUFFER_BT_INDEX;<br>
> - wm_prog_data.base.binding_<wbr>table.texture_start = BLORP_TEXTURE_BT_INDEX;<br>
> + prog_data->wm.binding_table.<wbr>render_target_start = BLORP_RENDERBUFFER_BT_INDEX;<br>
> + prog_data->wm.base.binding_<wbr>table.texture_start = BLORP_TEXTURE_BT_INDEX;<br>
><br>
> nir = brw_preprocess_nir(compiler, nir);<br>
> nir_remove_dead_variables(nir, nir_var_shader_in);<br>
> @@ -176,21 +175,12 @@ brw_blorp_compile_nir_shader(<wbr>struct blorp_context *blorp, struct nir_shader *nir<br>
><br>
> const unsigned *program =<br>
> brw_compile_fs(compiler, blorp->driver_ctx, mem_ctx,<br>
> - wm_key, &wm_prog_data, nir,<br>
> + wm_key, &prog_data->wm, nir,<br>
> NULL, -1, -1, false, use_repclear, program_size, NULL);<br>
><br>
> - /* Copy the relavent bits of wm_prog_data over into the blorp prog data */<br>
> - prog_data->dispatch_8 = wm_prog_data.dispatch_8;<br>
> - prog_data->dispatch_16 = wm_prog_data.dispatch_16;<br>
> - prog_data->first_curbe_grf_0 = wm_prog_data.base.dispatch_<wbr>grf_start_reg;<br>
> - prog_data->first_curbe_grf_2 = wm_prog_data.dispatch_grf_<wbr>start_reg_2;<br>
> - prog_data->ksp_offset_2 = wm_prog_data.prog_offset_2;<br>
> - prog_data->persample_msaa_<wbr>dispatch = wm_prog_data.persample_<wbr>dispatch;<br>
> - prog_data->flat_inputs = wm_prog_data.flat_inputs;<br>
> - prog_data->num_varying_inputs = wm_prog_data.num_varying_<wbr>inputs;<br>
> prog_data->inputs_read = nir->info.inputs_read;<br>
><br>
> - assert(wm_prog_data.base.nr_<wbr>params == 0);<br>
> + assert(prog_data->wm.base.nr_<wbr>params == 0);<br>
><br>
> return program;<br>
> }<br>
> diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c<br>
> index af46389..fc9e737 100644<br>
> --- a/src/intel/blorp/blorp_blit.c<br>
> +++ b/src/intel/blorp/blorp_blit.c<br>
> @@ -1235,7 +1235,7 @@ brw_blorp_get_blit_kernel(<wbr>struct blorp_context *blorp,<br>
><br>
> const unsigned *program;<br>
> unsigned program_size;<br>
> - struct brw_blorp_prog_data prog_data;<br>
> + struct blorp_prog_data prog_data;<br>
><br>
> /* Try and compile with NIR first. If that fails, fall back to the old<br>
> * method of building shaders manually.<br>
> diff --git a/src/intel/blorp/blorp_clear.<wbr>c b/src/intel/blorp/blorp_clear.<wbr>c<br>
> index ce9b292..01889b8 100644<br>
> --- a/src/intel/blorp/blorp_clear.<wbr>c<br>
> +++ b/src/intel/blorp/blorp_clear.<wbr>c<br>
> @@ -73,7 +73,7 @@ blorp_params_get_clear_kernel(<wbr>struct blorp_context *blorp,<br>
> struct brw_wm_prog_key wm_key;<br>
> brw_blorp_init_wm_prog_key(&<wbr>wm_key);<br>
><br>
> - struct brw_blorp_prog_data prog_data;<br>
> + struct blorp_prog_data prog_data;<br>
> unsigned program_size;<br>
> const unsigned *program =<br>
> brw_blorp_compile_nir_shader(<wbr>blorp, b.shader, &wm_key, use_replicated_data,<br>
> diff --git a/src/intel/blorp/blorp_genX_<wbr>exec.h b/src/intel/blorp/blorp_genX_<wbr>exec.h<br>
> index 71beadc..bb665e2 100644<br>
> --- a/src/intel/blorp/blorp_genX_<wbr>exec.h<br>
> +++ b/src/intel/blorp/blorp_genX_<wbr>exec.h<br>
> @@ -156,7 +156,7 @@ emit_urb_config(struct blorp_batch *batch,<br>
> * where 'n' stands for number of varying inputs expressed as vec4s.<br>
> */<br>
> const unsigned num_varyings =<br>
> - params->wm_prog_data ? params->wm_prog_data->num_<wbr>varying_inputs : 0;<br>
> + params->wm_prog_data ? params->wm_prog_data->wm.num_<wbr>varying_inputs : 0;<br>
> const unsigned total_needed = 16 + 16 + num_varyings * 16;<br>
><br>
> /* The URB size is expressed in units of 64 bytes (512 bits) */<br>
> @@ -191,7 +191,7 @@ blorp_emit_input_varying_data(<wbr>struct blorp_batch *batch,<br>
> const unsigned vec4_size_in_bytes = 4 * sizeof(float);<br>
> const unsigned max_num_varyings =<br>
> DIV_ROUND_UP(sizeof(params-><wbr>wm_inputs), vec4_size_in_bytes);<br>
> - const unsigned num_varyings = params->wm_prog_data->num_<wbr>varying_inputs;<br>
> + const unsigned num_varyings = params->wm_prog_data->wm.num_<wbr>varying_inputs;<br>
><br>
> *size = num_varyings * vec4_size_in_bytes;<br>
><br>
> @@ -239,7 +239,7 @@ blorp_emit_vertex_buffers(<wbr>struct blorp_batch *batch,<br>
> vb[0].EndAddress.offset += size - 1;<br>
> #endif<br>
><br>
> - if (params->wm_prog_data && params->wm_prog_data->num_<wbr>varying_inputs) {<br>
> + if (params->wm_prog_data && params->wm_prog_data->wm.num_<wbr>varying_inputs) {<br>
> blorp_emit_input_varying_data(<wbr>batch, params,<br>
> &vb[1].BufferStartingAddress, &size);<br>
> vb[1].VertexBufferIndex = 1;<br>
> @@ -273,7 +273,7 @@ blorp_emit_vertex_elements(<wbr>struct blorp_batch *batch,<br>
> const struct blorp_params *params)<br>
> {<br>
> const unsigned num_varyings =<br>
> - params->wm_prog_data ? params->wm_prog_data->num_<wbr>varying_inputs : 0;<br>
> + params->wm_prog_data ? params->wm_prog_data->wm.num_<wbr>varying_inputs : 0;<br>
> const unsigned num_elements = 2 + num_varyings;<br>
><br>
> struct GENX(VERTEX_ELEMENT_STATE) ve[num_elements];<br>
> @@ -381,7 +381,7 @@ static void<br>
> blorp_emit_sf_config(struct blorp_batch *batch,<br>
> const struct blorp_params *params)<br>
> {<br>
> - const struct brw_blorp_prog_data *prog_data = params->wm_prog_data;<br>
> + const struct blorp_prog_data *prog_data = params->wm_prog_data;<br>
><br>
> /* 3DSTATE_SF<br>
> *<br>
> @@ -412,11 +412,11 @@ blorp_emit_sf_config(struct blorp_batch *batch,<br>
><br>
> blorp_emit(batch, GENX(3DSTATE_SBE), sbe) {<br>
> sbe.VertexURBEntryReadOffset = 1;<br>
> - sbe.NumberofSFOutputAttributes = prog_data->num_varying_inputs;<br>
> - sbe.VertexURBEntryReadLength = brw_blorp_get_urb_length(prog_<wbr>data);<br>
> + sbe.NumberofSFOutputAttributes = prog_data->wm.num_varying_<wbr>inputs;<br>
> + sbe.VertexURBEntryReadLength = blorp_get_urb_length(prog_<wbr>data);<br>
> sbe.<wbr>ForceVertexURBEntryReadLength = true;<br>
> sbe.<wbr>ForceVertexURBEntryReadOffset = true;<br>
> - sbe.<wbr>ConstantInterpolationEnable = prog_data->flat_inputs;<br>
> + sbe.<wbr>ConstantInterpolationEnable = prog_data->wm.flat_inputs;<br>
><br>
> #if GEN_GEN >= 9<br>
> for (unsigned i = 0; i < 32; i++)<br>
> @@ -441,9 +441,9 @@ blorp_emit_sf_config(struct blorp_batch *batch,<br>
> blorp_emit(batch, GENX(3DSTATE_SBE), sbe) {<br>
> sbe.VertexURBEntryReadOffset = 1;<br>
> if (prog_data) {<br>
> - sbe.NumberofSFOutputAttributes = prog_data->num_varying_inputs;<br>
> - sbe.VertexURBEntryReadLength = brw_blorp_get_urb_length(prog_<wbr>data);<br>
> - sbe.<wbr>ConstantInterpolationEnable = prog_data->flat_inputs;<br>
> + sbe.NumberofSFOutputAttributes = prog_data->wm.num_varying_<wbr>inputs;<br>
> + sbe.VertexURBEntryReadLength = blorp_get_urb_length(prog_<wbr>data);<br>
> + sbe.<wbr>ConstantInterpolationEnable = prog_data->wm.flat_inputs;<br>
> } else {<br>
> sbe.NumberofSFOutputAttributes = 0;<br>
> sbe.VertexURBEntryReadLength = 1;<br>
> @@ -461,9 +461,9 @@ blorp_emit_sf_config(struct blorp_batch *batch,<br>
><br>
> sf.VertexURBEntryReadOffset = 1;<br>
> if (prog_data) {<br>
> - sf.NumberofSFOutputAttributes = prog_data->num_varying_inputs;<br>
> - sf.VertexURBEntryReadLength = brw_blorp_get_urb_length(prog_<wbr>data);<br>
> - sf.ConstantInterpolationEnable = prog_data->flat_inputs;<br>
> + sf.NumberofSFOutputAttributes = prog_data->wm.num_varying_<wbr>inputs;<br>
> + sf.VertexURBEntryReadLength = blorp_get_urb_length(prog_<wbr>data);<br>
> + sf.ConstantInterpolationEnable = prog_data->wm.flat_inputs;<br>
> } else {<br>
> sf.NumberofSFOutputAttributes = 0;<br>
> sf.VertexURBEntryReadLength = 1;<br>
> @@ -477,7 +477,7 @@ static void<br>
> blorp_emit_ps_config(struct blorp_batch *batch,<br>
> const struct blorp_params *params)<br>
> {<br>
> - const struct brw_blorp_prog_data *prog_data = params->wm_prog_data;<br>
> + const struct blorp_prog_data *prog_data = params->wm_prog_data;<br>
><br>
> /* Even when thread dispatch is disabled, max threads (dw5.25:31) must be<br>
> * nonzero to prevent the GPU from hanging. While the documentation doesn't<br>
> @@ -501,16 +501,16 @@ blorp_emit_ps_config(struct blorp_batch *batch,<br>
> }<br>
><br>
> ps.<wbr>DispatchGRFStartRegisterForCon<wbr>stantSetupData0 =<br>
> - prog_data->first_curbe_grf_0;<br>
> + prog_data->wm.base.dispatch_<wbr>grf_start_reg;<br>
> ps.<wbr>DispatchGRFStartRegisterForCon<wbr>stantSetupData2 =<br>
> - prog_data->first_curbe_grf_2;<br>
> + prog_data->wm.dispatch_grf_<wbr>start_reg_2;<br>
><br>
> - ps._8PixelDispatchEnable = prog_data->dispatch_8;<br>
> - ps._16PixelDispatchEnable = prog_data->dispatch_16;<br>
> + ps._8PixelDispatchEnable = prog_data->wm.dispatch_8;<br>
> + ps._16PixelDispatchEnable = prog_data->wm.dispatch_16;<br>
><br>
> ps.KernelStartPointer0 = params->wm_prog_kernel;<br>
> ps.KernelStartPointer2 =<br>
> - params->wm_prog_kernel + prog_data->ksp_offset_2;<br>
> + params->wm_prog_kernel + prog_data->wm.prog_offset_2;<br>
><br>
> /* 3DSTATE_PS expects the number of threads per PSD, which is always 64;<br>
> * it implicitly scales for different GT levels (which have some # of<br>
> @@ -552,9 +552,9 @@ blorp_emit_ps_config(struct blorp_batch *batch,<br>
> if (params->src.addr.buffer)<br>
> psx.PixelShaderKillsPixel = true;<br>
><br>
> - psx.AttributeEnable = prog_data->num_varying_inputs > 0;<br>
> + psx.AttributeEnable = prog_data->wm.num_varying_<wbr>inputs > 0;<br>
><br>
> - if (prog_data && prog_data->persample_msaa_<wbr>dispatch)<br>
> + if (prog_data && prog_data->wm.persample_<wbr>dispatch)<br>
> psx.PixelShaderIsPerSample = true;<br>
> }<br>
><br>
> @@ -586,7 +586,7 @@ blorp_emit_ps_config(struct blorp_batch *batch,<br>
> if (params->dst.surf.samples > 1) {<br>
> wm.<wbr>MultisampleRasterizationMode = MSRASTMODE_ON_PATTERN;<br>
> wm.MultisampleDispatchMode =<br>
> - (prog_data && prog_data->persample_msaa_<wbr>dispatch) ?<br>
> + (prog_data && prog_data->wm.persample_<wbr>dispatch) ?<br>
> MSDISPMODE_PERSAMPLE : MSDISPMODE_PERPIXEL;<br>
> } else {<br>
> wm.<wbr>MultisampleRasterizationMode = MSRASTMODE_OFF_PIXEL;<br>
> @@ -604,18 +604,18 @@ blorp_emit_ps_config(struct blorp_batch *batch,<br>
><br>
> if (prog_data) {<br>
> ps.<wbr>DispatchGRFStartRegisterforCon<wbr>stantSetupData0 =<br>
> - prog_data->first_curbe_grf_0;<br>
> + prog_data->wm.base.dispatch_<wbr>grf_start_reg;<br>
> ps.<wbr>DispatchGRFStartRegisterforCon<wbr>stantSetupData2 =<br>
> - prog_data->first_curbe_grf_2;<br>
> + prog_data->wm.dispatch_grf_<wbr>start_reg_2;<br>
><br>
> ps.KernelStartPointer0 = params->wm_prog_kernel;<br>
> ps.KernelStartPointer2 =<br>
> - params->wm_prog_kernel + prog_data->ksp_offset_2;<br>
> + params->wm_prog_kernel + prog_data->wm.prog_offset_2;<br>
><br>
> - ps._8PixelDispatchEnable = prog_data->dispatch_8;<br>
> - ps._16PixelDispatchEnable = prog_data->dispatch_16;<br>
> + ps._8PixelDispatchEnable = prog_data->wm.dispatch_8;<br>
> + ps._16PixelDispatchEnable = prog_data->wm.dispatch_16;<br>
><br>
> - ps.AttributeEnable = prog_data->num_varying_inputs > 0;<br>
> + ps.AttributeEnable = prog_data->wm.num_varying_<wbr>inputs > 0;<br>
> } else {<br>
> /* Gen7 hardware gets angry if we don't enable at least one dispatch<br>
> * mode, so just enable 16-pixel dispatch if we don't have a program.<br>
> @@ -666,18 +666,18 @@ blorp_emit_ps_config(struct blorp_batch *batch,<br>
> wm.ThreadDispatchEnable = true;<br>
><br>
> wm.<wbr>DispatchGRFStartRegisterforCon<wbr>stantSetupData0 =<br>
> - prog_data->first_curbe_grf_0;<br>
> + prog_data->wm.base.dispatch_<wbr>grf_start_reg;<br>
> wm.<wbr>DispatchGRFStartRegisterforCon<wbr>stantSetupData2 =<br>
> - prog_data->first_curbe_grf_2;<br>
> + prog_data->wm.dispatch_grf_<wbr>start_reg_2;<br>
><br>
> wm.KernelStartPointer0 = params->wm_prog_kernel;<br>
> wm.KernelStartPointer2 =<br>
> - params->wm_prog_kernel + prog_data->ksp_offset_2;<br>
> + params->wm_prog_kernel + prog_data->wm.prog_offset_2;<br>
><br>
> - wm._8PixelDispatchEnable = prog_data->dispatch_8;<br>
> - wm._16PixelDispatchEnable = prog_data->dispatch_16;<br>
> + wm._8PixelDispatchEnable = prog_data->wm.dispatch_8;<br>
> + wm._16PixelDispatchEnable = prog_data->wm.dispatch_16;<br>
><br>
> - wm.NumberofSFOutputAttributes = prog_data->num_varying_inputs;<br>
> + wm.NumberofSFOutputAttributes = prog_data->wm.num_varying_<wbr>inputs;<br>
> }<br>
><br>
> if (params->src.addr.buffer) {<br>
> @@ -688,7 +688,7 @@ blorp_emit_ps_config(struct blorp_batch *batch,<br>
> if (params->dst.surf.samples > 1) {<br>
> wm.<wbr>MultisampleRasterizationMode = MSRASTMODE_ON_PATTERN;<br>
> wm.MultisampleDispatchMode =<br>
> - (prog_data && prog_data->persample_msaa_<wbr>dispatch) ?<br>
> + (prog_data && prog_data->wm.persample_<wbr>dispatch) ?<br>
> MSDISPMODE_PERSAMPLE : MSDISPMODE_PERPIXEL;<br>
> } else {<br>
> wm.<wbr>MultisampleRasterizationMode = MSRASTMODE_OFF_PIXEL;<br>
> diff --git a/src/intel/blorp/blorp_priv.h b/src/intel/blorp/blorp_priv.h<br>
> index a88d0f8..70cdfbc 100644<br>
> --- a/src/intel/blorp/blorp_priv.h<br>
> +++ b/src/intel/blorp/blorp_priv.h<br>
> @@ -135,33 +135,15 @@ struct brw_blorp_wm_inputs<br>
> uint32_t pad[1];<br>
> };<br>
><br>
> -struct brw_blorp_prog_data<br>
> +struct blorp_prog_data<br>
> {<br>
> - bool dispatch_8;<br>
> - bool dispatch_16;<br>
> + struct brw_wm_prog_data wm;<br>
><br>
> - uint8_t first_curbe_grf_0;<br>
> - uint8_t first_curbe_grf_2;<br>
> -<br>
> - uint32_t ksp_offset_2;<br>
> -<br>
> - /**<br>
> - * True if the WM program should be run in MSDISPMODE_PERSAMPLE with more<br>
> - * than one sample per pixel.<br>
> - */<br>
> - bool persample_msaa_dispatch;<br>
> -<br>
> - /**<br>
> - * Mask of which FS inputs are marked flat by the shader source. This is<br>
> - * needed for setting up 3DSTATE_SF/SBE.<br>
> - */<br>
> - uint32_t flat_inputs;<br>
> - unsigned num_varying_inputs;<br>
> uint64_t inputs_read;<br>
> };<br>
><br>
> static inline unsigned<br>
> -brw_blorp_get_urb_length(<wbr>const struct brw_blorp_prog_data *prog_data)<br>
> +blorp_get_urb_length(const struct blorp_prog_data *prog_data)<br>
> {<br>
> if (prog_data == NULL)<br>
> return 1;<br>
> @@ -170,7 +152,7 @@ brw_blorp_get_urb_length(const struct brw_blorp_prog_data *prog_data)<br>
> *<br>
> * read_length = ceiling((max_source_attr+1)/2)<br>
> */<br>
> - return MAX2((prog_data->num_varying_<wbr>inputs + 1) / 2, 1);<br>
> + return MAX2((prog_data->wm.num_<wbr>varying_inputs + 1) / 2, 1);<br>
> }<br>
><br>
> struct blorp_params<br>
> @@ -190,7 +172,7 @@ struct blorp_params<br>
> unsigned num_draw_buffers;<br>
> unsigned num_layers;<br>
> uint32_t wm_prog_kernel;<br>
> - struct brw_blorp_prog_data *wm_prog_data;<br>
> + struct blorp_prog_data *wm_prog_data;<br>
> };<br>
><br>
> void blorp_params_init(struct blorp_params *params);<br>
> @@ -306,7 +288,7 @@ const unsigned *<br>
> brw_blorp_compile_nir_shader(<wbr>struct blorp_context *blorp, struct nir_shader *nir,<br>
> const struct brw_wm_prog_key *wm_key,<br>
> bool use_repclear,<br>
> - struct brw_blorp_prog_data *prog_data,<br>
> + struct blorp_prog_data *prog_data,<br>
> unsigned *program_size);<br>
><br>
> /** \} */<br>
> --<br>
> 2.5.0.400.gff86faf<br>
><br>
</div></div>> ______________________________<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>
</blockquote></div><br></div>