<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 11, 2016 at 12:25 AM, Pohjolainen, Topi <span dir="ltr"><<a href="mailto:topi.pohjolainen@intel.com" target="_blank">topi.pohjolainen@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 Tue, May 10, 2016 at 04:16:36PM -0700, Jason Ekstrand wrote:<br>
> ---<br>
> src/mesa/drivers/dri/i965/brw_blorp.c | 6 +++++-<br>
> src/mesa/drivers/dri/i965/brw_blorp.h | 8 +++++++-<br>
> src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 2 +-<br>
> src/mesa/drivers/dri/i965/brw_blorp_clear.cpp | 4 ++--<br>
> src/mesa/drivers/dri/i965/gen6_blorp.c | 23 ++++++++++++++++-------<br>
> src/mesa/drivers/dri/i965/gen7_blorp.c | 27 +++++++++++++++++++++------<br>
> src/mesa/drivers/dri/i965/gen8_blorp.c | 23 +++++++++++++++--------<br>
> 7 files changed, 67 insertions(+), 26 deletions(-)<br>
><br>
> diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c<br>
> index 1379804..6c3b83a 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_blorp.c<br>
> +++ b/src/mesa/drivers/dri/i965/brw_blorp.c<br>
> @@ -137,7 +137,11 @@ brw_blorp_compute_tile_offsets(const struct brw_blorp_surface_info *info,<br>
> void<br>
> brw_blorp_prog_data_init(struct brw_blorp_prog_data *prog_data)<br>
> {<br>
> - prog_data->first_curbe_grf = 0;<br>
> + prog_data->dispatch_8 = false;<br>
> + prog_data->dispatch_16 = true;<br>
> + prog_data->first_curbe_grf_0 = 0;<br>
> + prog_data->first_curbe_grf_2 = 0;<br>
> + prog_data->ksp_offset_2 = 0;<br>
> prog_data->persample_msaa_dispatch = false;<br>
><br>
> prog_data->nr_params = BRW_BLORP_NUM_PUSH_CONSTANT_DWORDS;<br>
> diff --git a/src/mesa/drivers/dri/i965/brw_blorp.h b/src/mesa/drivers/dri/i965/brw_blorp.h<br>
> index c2f33a1..b38b689 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_blorp.h<br>
> +++ b/src/mesa/drivers/dri/i965/brw_blorp.h<br>
> @@ -208,7 +208,13 @@ static const unsigned int BRW_BLORP_NUM_PUSH_CONST_REGS =<br>
><br>
> struct brw_blorp_prog_data<br>
> {<br>
> - unsigned int first_curbe_grf;<br>
> + bool dispatch_8;<br>
> + bool dispatch_16;<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>
> diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp<br>
> index ed43184..7067c06 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp<br>
> +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp<br>
> @@ -778,7 +778,7 @@ brw_blorp_blit_program::alloc_regs()<br>
> int reg = 0;<br>
> this->R0 = retype(brw_vec8_grf(reg++, 0), BRW_REGISTER_TYPE_UW);<br>
> this->R1 = retype(brw_vec8_grf(reg++, 0), BRW_REGISTER_TYPE_UW);<br>
> - prog_data.first_curbe_grf = reg;<br>
> + prog_data.first_curbe_grf_0 = reg;<br>
> alloc_push_const_regs(reg);<br>
> reg += BRW_BLORP_NUM_PUSH_CONST_REGS;<br>
> for (unsigned i = 0; i < ARRAY_SIZE(texture_data); ++i) {<br>
> diff --git a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp<br>
> index 5ed46e1..c298889 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp<br>
> +++ b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp<br>
> @@ -86,7 +86,7 @@ brw_blorp_const_color_program::brw_blorp_const_color_program(<br>
> clear_rgba(),<br>
> base_mrf(0)<br>
> {<br>
> - prog_data.first_curbe_grf = 0;<br>
> + prog_data.first_curbe_grf_0 = 0;<br>
> prog_data.persample_msaa_dispatch = false;<br>
> brw_init_codegen(brw->intelScreen->devinfo, &func, mem_ctx);<br>
> }<br>
> @@ -145,7 +145,7 @@ brw_blorp_const_color_program::alloc_regs()<br>
> this->R0 = retype(brw_vec8_grf(reg++, 0), BRW_REGISTER_TYPE_UW);<br>
> this->R1 = retype(brw_vec8_grf(reg++, 0), BRW_REGISTER_TYPE_UW);<br>
><br>
> - prog_data.first_curbe_grf = reg;<br>
> + prog_data.first_curbe_grf_0 = reg;<br>
> clear_rgba = retype(brw_vec4_grf(reg++, 0), BRW_REGISTER_TYPE_F);<br>
> reg += BRW_BLORP_NUM_PUSH_CONST_REGS;<br>
><br>
> diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.c b/src/mesa/drivers/dri/i965/gen6_blorp.c<br>
> index 950e2b9..32049eb 100644<br>
> --- a/src/mesa/drivers/dri/i965/gen6_blorp.c<br>
> +++ b/src/mesa/drivers/dri/i965/gen6_blorp.c<br>
> @@ -619,7 +619,7 @@ gen6_blorp_emit_wm_config(struct brw_context *brw,<br>
> const struct brw_blorp_params *params)<br>
> {<br>
> const struct brw_blorp_prog_data *prog_data = params->wm_prog_data;<br>
> - uint32_t dw2, dw4, dw5, dw6;<br>
> + uint32_t dw2, dw4, dw5, dw6, ksp0, ksp2;<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>
> @@ -630,7 +630,7 @@ gen6_blorp_emit_wm_config(struct brw_context *brw,<br>
> * configure the WM state whether or not there is a WM program.<br>
> */<br>
><br>
> - dw2 = dw4 = dw5 = dw6 = 0;<br>
> + dw2 = dw4 = dw5 = dw6 = ksp0 = ksp2 = 0;<br>
> switch (params->hiz_op) {<br>
> case GEN6_HIZ_OP_DEPTH_CLEAR:<br>
> dw4 |= GEN6_WM_DEPTH_CLEAR;<br>
> @@ -652,9 +652,18 @@ gen6_blorp_emit_wm_config(struct brw_context *brw,<br>
> dw6 |= 0 << GEN6_WM_BARYCENTRIC_INTERPOLATION_MODE_SHIFT; /* No interp */<br>
> dw6 |= 0 << GEN6_WM_NUM_SF_OUTPUTS_SHIFT; /* No inputs from SF */<br>
> if (params->wm_prog_data) {<br>
> - dw4 |= prog_data->first_curbe_grf << GEN6_WM_DISPATCH_START_GRF_SHIFT_0;<br>
> - dw5 |= GEN6_WM_16_DISPATCH_ENABLE;<br>
> dw5 |= GEN6_WM_DISPATCH_ENABLE; /* We are rendering */<br>
> +<br>
> + dw4 |= prog_data->first_curbe_grf_0 << GEN6_WM_DISPATCH_START_GRF_SHIFT_0;<br>
> + dw4 |= prog_data->first_curbe_grf_2 << GEN6_WM_DISPATCH_START_GRF_SHIFT_2;<br>
> +<br>
> + ksp0 = params->wm_prog_kernel;<br>
> + ksp2 = params->wm_prog_kernel + params->wm_prog_data->ksp_offset_2;<br>
> +<br>
> + if (params->wm_prog_data->dispatch_8)<br>
> + dw5 |= GEN6_WM_8_DISPATCH_ENABLE;<br>
> + if (params->wm_prog_data->dispatch_16)<br>
> + dw5 |= GEN6_WM_16_DISPATCH_ENABLE;<br>
> }<br>
><br>
> if (params-><a href="http://src.mt" rel="noreferrer" target="_blank">src.mt</a>) {<br>
> @@ -675,14 +684,14 @@ gen6_blorp_emit_wm_config(struct brw_context *brw,<br>
><br>
> BEGIN_BATCH(9);<br>
> OUT_BATCH(_3DSTATE_WM << 16 | (9 - 2));<br>
> - OUT_BATCH(params->wm_prog_kernel);<br>
> + OUT_BATCH(ksp0);<br>
> OUT_BATCH(dw2);<br>
> OUT_BATCH(0); /* No scratch needed */<br>
> OUT_BATCH(dw4);<br>
> OUT_BATCH(dw5);<br>
> OUT_BATCH(dw6);<br>
> - OUT_BATCH(0); /* No other programs */<br>
> - OUT_BATCH(0); /* No other programs */<br>
> + OUT_BATCH(0); /* kernel 1 pointer */<br>
> + OUT_BATCH(ksp2);<br>
> ADVANCE_BATCH();<br>
> }<br>
><br>
> diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.c b/src/mesa/drivers/dri/i965/gen7_blorp.c<br>
> index e2e6072..9a881a2 100644<br>
> --- a/src/mesa/drivers/dri/i965/gen7_blorp.c<br>
> +++ b/src/mesa/drivers/dri/i965/gen7_blorp.c<br>
> @@ -526,11 +526,11 @@ gen7_blorp_emit_ps_config(struct brw_context *brw,<br>
> const struct brw_blorp_params *params)<br>
> {<br>
> const struct brw_blorp_prog_data *prog_data = params->wm_prog_data;<br>
> - uint32_t dw2, dw4, dw5;<br>
> + uint32_t dw2, dw4, dw5, ksp0, ksp2;<br>
> const int max_threads_shift = brw->is_haswell ?<br>
> HSW_PS_MAX_THREADS_SHIFT : IVB_PS_MAX_THREADS_SHIFT;<br>
><br>
> - dw2 = dw4 = dw5 = 0;<br>
> + dw2 = dw4 = dw5 = ksp0 = ksp2 = 0;<br>
> dw4 |= (brw->max_wm_threads - 1) << max_threads_shift;<br>
><br>
> /* If there's a WM program, we need to do 16-pixel dispatch since that's<br>
<br>
</div></div>Original has:<br>
<span class=""><br>
/* If there's a WM program, we need to do 16-pixel dispatch since that's<br>
</span> * what the program is compiled for. If there isn't, then it shouldn't<br>
* matter because no program is actually being run. However, the hardware<br>
* gets angry if we don't enable at least one dispatch mode, so just enable<br>
* 16-pixel dispatch unconditionally.<br>
*/<br>
dw4 |= GEN7_PS_16_DISPATCH_ENABLE;<br>
<br>
We need to remove this also, right?<br><div><div class="h5"></div></div></blockquote><div><br></div><div>Thanks! I meant to but it didn't make it into the patch.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
> @@ -545,7 +545,22 @@ gen7_blorp_emit_ps_config(struct brw_context *brw,<br>
> dw4 |= SET_FIELD(1, HSW_PS_SAMPLE_MASK); /* 1 sample for now */<br>
> if (params->wm_prog_data) {<br>
> dw4 |= GEN7_PS_PUSH_CONSTANT_ENABLE;<br>
> - dw5 |= prog_data->first_curbe_grf << GEN7_PS_DISPATCH_START_GRF_SHIFT_0;<br>
> +<br>
> + dw5 |= prog_data->first_curbe_grf_0 << GEN7_PS_DISPATCH_START_GRF_SHIFT_0;<br>
> + dw5 |= prog_data->first_curbe_grf_2 << GEN7_PS_DISPATCH_START_GRF_SHIFT_2;<br>
> +<br>
> + ksp0 = params->wm_prog_kernel;<br>
> + ksp2 = params->wm_prog_kernel + params->wm_prog_data->ksp_offset_2;<br>
> +<br>
> + if (params->wm_prog_data->dispatch_8)<br>
> + dw4 |= GEN7_PS_8_DISPATCH_ENABLE;<br>
> + if (params->wm_prog_data->dispatch_16)<br>
> + dw4 |= GEN7_PS_16_DISPATCH_ENABLE;<br>
> + } else {<br>
> + /* The 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>
> + */<br>
> + dw4 |= GEN7_PS_16_DISPATCH_ENABLE;<br>
> }<br>
><br>
> if (params-><a href="http://src.mt" rel="noreferrer" target="_blank">src.mt</a>)<br>
> @@ -555,13 +570,13 @@ gen7_blorp_emit_ps_config(struct brw_context *brw,<br>
><br>
> BEGIN_BATCH(8);<br>
> OUT_BATCH(_3DSTATE_PS << 16 | (8 - 2));<br>
> - OUT_BATCH(params->wm_prog_kernel);<br>
> + OUT_BATCH(ksp0);<br>
> OUT_BATCH(dw2);<br>
> OUT_BATCH(0);<br>
> OUT_BATCH(dw4);<br>
> OUT_BATCH(dw5);<br>
> - OUT_BATCH(0);<br>
> - OUT_BATCH(0);<br>
> + OUT_BATCH(0); /* kernel 1 pointer */<br>
> + OUT_BATCH(ksp2);<br>
> ADVANCE_BATCH();<br>
> }<br>
><br>
> diff --git a/src/mesa/drivers/dri/i965/gen8_blorp.c b/src/mesa/drivers/dri/i965/gen8_blorp.c<br>
> index 5cd070f..c2f4b85 100644<br>
> --- a/src/mesa/drivers/dri/i965/gen8_blorp.c<br>
> +++ b/src/mesa/drivers/dri/i965/gen8_blorp.c<br>
> @@ -372,13 +372,11 @@ gen8_blorp_emit_ps_config(struct brw_context *brw,<br>
> const struct brw_blorp_params *params)<br>
> {<br>
> const struct brw_blorp_prog_data *prog_data = params->wm_prog_data;<br>
> - uint32_t dw3, dw5, dw6, dw7;<br>
> + uint32_t dw3, dw5, dw6, dw7, ksp0, ksp2;<br>
><br>
> - dw3 = dw5 = dw6 = dw7 = 0;<br>
> + dw3 = dw5 = dw6 = dw7 = ksp0 = ksp2 = 0;<br>
> dw3 |= GEN7_PS_VECTOR_MASK_ENABLE;<br>
><br>
> - dw6 |= GEN7_PS_16_DISPATCH_ENABLE;<br>
> -<br>
> if (params-><a href="http://src.mt" rel="noreferrer" target="_blank">src.mt</a>) {<br>
> dw3 |= 1 << GEN7_PS_SAMPLER_COUNT_SHIFT; /* Up to 4 samplers */<br>
> dw3 |= 2 << GEN7_PS_BINDING_TABLE_ENTRY_COUNT_SHIFT; /* Two surfaces */<br>
> @@ -387,7 +385,16 @@ gen8_blorp_emit_ps_config(struct brw_context *brw,<br>
> }<br>
><br>
> dw6 |= GEN7_PS_PUSH_CONSTANT_ENABLE;<br>
> - dw7 |= prog_data->first_curbe_grf << GEN7_PS_DISPATCH_START_GRF_SHIFT_0;<br>
> + dw7 |= prog_data->first_curbe_grf_0 << GEN7_PS_DISPATCH_START_GRF_SHIFT_0;<br>
> + dw7 |= prog_data->first_curbe_grf_2 << GEN7_PS_DISPATCH_START_GRF_SHIFT_2;<br>
> +<br>
> + if (params->wm_prog_data->dispatch_8)<br>
> + dw6 |= GEN7_PS_8_DISPATCH_ENABLE;<br>
> + if (params->wm_prog_data->dispatch_16)<br>
> + dw6 |= GEN7_PS_16_DISPATCH_ENABLE;<br>
> +<br>
> + ksp0 = params->wm_prog_kernel;<br>
> + ksp2 = params->wm_prog_kernel + params->wm_prog_data->ksp_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 PSDs).<br>
> @@ -404,16 +411,16 @@ gen8_blorp_emit_ps_config(struct brw_context *brw,<br>
><br>
> BEGIN_BATCH(12);<br>
> OUT_BATCH(_3DSTATE_PS << 16 | (12 - 2));<br>
> - OUT_BATCH(params->wm_prog_kernel);<br>
> + OUT_BATCH(ksp0);<br>
> OUT_BATCH(0);<br>
> OUT_BATCH(dw3);<br>
> OUT_BATCH(0);<br>
> OUT_BATCH(0);<br>
> OUT_BATCH(dw6);<br>
> OUT_BATCH(dw7);<br>
> + OUT_BATCH(0); /* kernel 1 pointer */<br>
> OUT_BATCH(0);<br>
> - OUT_BATCH(0);<br>
> - OUT_BATCH(0);<br>
> + OUT_BATCH(ksp2);<br>
> OUT_BATCH(0);<br>
> ADVANCE_BATCH();<br>
> }<br>
> --<br>
> 2.5.0.400.gff86faf<br>
><br>
</div></div>> _______________________________________________<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/mailman/listinfo/mesa-dev</a><br>
</blockquote></div><br></div></div>