<p dir="ltr"><br>
On Jul 13, 2016 1:34 AM, "Topi Pohjolainen" <<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a>> wrote:<br>
><br>
> Setup for pixel shader push constants is the same as for other<br>
> stages. Note that on gen8+ the if-else branches were identical<br>
> and the generation check for packet size redundant.</p>
<p dir="ltr">It tripped me up a bit that you didn't have a generation check for packet size in the gen7 version that's now getting used on gen7-9.  However, the extra dwords just turn into noops anyway so it's OK.</p>
<p dir="ltr">> Signed-off-by: Topi Pohjolainen <<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a>><br>
> ---<br>
>  src/mesa/drivers/dri/i965/gen7_blorp.c | 27 ++++--------------<br>
>  src/mesa/drivers/dri/i965/gen8_blorp.c | 50 ++++------------------------------<br>
>  2 files changed, 12 insertions(+), 65 deletions(-)<br>
><br>
> diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.c b/src/mesa/drivers/dri/i965/gen7_blorp.c<br>
> index abdc4be..72ab082 100644<br>
> --- a/src/mesa/drivers/dri/i965/gen7_blorp.c<br>
> +++ b/src/mesa/drivers/dri/i965/gen7_blorp.c<br>
> @@ -233,7 +233,7 @@ gen7_blorp_emit_surface_state(struct brw_context *brw,<br>
>   * buffer are valid.<br>
>   */<br>
>  static void<br>
> -gen7_blorp_emit_disable_constant_state(struct brw_context *brw,<br>
> +gen7_blorp_disable_constant_state(struct brw_context *brw,<br>
>                                         unsigned opcode)<br>
>  {<br>
>     BEGIN_BATCH(7);<br>
> @@ -570,20 +570,6 @@ gen7_blorp_emit_sampler_state_pointers_ps(struct brw_context *brw,<br>
>     ADVANCE_BATCH();<br>
>  }<br>
><br>
> -void<br>
> -gen7_blorp_emit_constant_ps_disable(struct brw_context *brw)<br>
> -{<br>
> -   BEGIN_BATCH(7);<br>
> -   OUT_BATCH(_3DSTATE_CONSTANT_PS << 16 | (7 - 2));<br>
> -   OUT_BATCH(0);<br>
> -   OUT_BATCH(0);<br>
> -   OUT_BATCH(0);<br>
> -   OUT_BATCH(0);<br>
> -   OUT_BATCH(0);<br>
> -   OUT_BATCH(0);<br>
> -   ADVANCE_BATCH();<br>
> -}<br>
> -<br>
>  static void<br>
>  gen7_blorp_emit_depth_stencil_config(struct brw_context *brw,<br>
>                                       const struct brw_blorp_params *params)<br>
> @@ -779,10 +765,11 @@ gen7_blorp_exec(struct brw_context *brw,<br>
>        gen7_blorp_emit_cc_state_pointer(brw, cc_state_offset);<br>
>     }<br>
><br>
> -   gen7_blorp_emit_disable_constant_state(brw, _3DSTATE_CONSTANT_VS);<br>
> -   gen7_blorp_emit_disable_constant_state(brw, _3DSTATE_CONSTANT_HS);<br>
> -   gen7_blorp_emit_disable_constant_state(brw, _3DSTATE_CONSTANT_DS);<br>
> -   gen7_blorp_emit_disable_constant_state(brw, _3DSTATE_CONSTANT_GS);<br>
> +   gen7_blorp_disable_constant_state(brw, _3DSTATE_CONSTANT_VS);<br>
> +   gen7_blorp_disable_constant_state(brw, _3DSTATE_CONSTANT_HS);<br>
> +   gen7_blorp_disable_constant_state(brw, _3DSTATE_CONSTANT_DS);<br>
> +   gen7_blorp_disable_constant_state(brw, _3DSTATE_CONSTANT_GS);<br>
> +   gen7_blorp_disable_constant_state(brw, _3DSTATE_CONSTANT_PS);<br>
><br>
>     depthstencil_offset = gen6_blorp_emit_depth_stencil_state(brw, params);<br>
>     gen7_blorp_emit_depth_stencil_state_pointers(brw, depthstencil_offset);<br>
> @@ -821,8 +808,6 @@ gen7_blorp_exec(struct brw_context *brw,<br>
>     if (params->wm_prog_data)<br>
>        gen7_blorp_emit_binding_table_pointers_ps(brw, wm_bind_bo_offset);<br>
><br>
> -   gen7_blorp_emit_constant_ps_disable(brw);<br>
> -<br>
>     if (params-><a href="http://src.mt">src.mt</a>) {<br>
>        const uint32_t sampler_offset =<br>
>           gen6_blorp_emit_sampler_state(brw, BRW_MAPFILTER_LINEAR, 0, true);<br>
> diff --git a/src/mesa/drivers/dri/i965/gen8_blorp.c b/src/mesa/drivers/dri/i965/gen8_blorp.c<br>
> index 21fcd9e..f68aba5 100644<br>
> --- a/src/mesa/drivers/dri/i965/gen8_blorp.c<br>
> +++ b/src/mesa/drivers/dri/i965/gen8_blorp.c<br>
> @@ -161,7 +161,7 @@ gen8_blorp_emit_blend_state(struct brw_context *brw,<br>
>   * buffer are valid.<br>
>   */<br>
>  static void<br>
> -gen8_blorp_emit_disable_constant_state(struct brw_context *brw,<br>
> +gen8_blorp_disable_constant_state(struct brw_context *brw,<br>
>                                         unsigned opcode)<br>
>  {<br>
>     BEGIN_BATCH(11);<br>
> @@ -566,44 +566,6 @@ gen8_blorp_emit_depth_stencil_state(struct brw_context *brw,<br>
>     ADVANCE_BATCH();<br>
>  }<br>
><br>
> -static void<br>
> -gen8_blorp_emit_disable_constant_ps(struct brw_context *brw)<br>
> -{<br>
> -   const int dwords = brw->gen >= 8 ? 11 : 7;<br>
> -   BEGIN_BATCH(dwords);<br>
> -   OUT_BATCH(_3DSTATE_CONSTANT_PS << 16 | (dwords - 2));<br>
> -<br>
> -   if (brw->gen >= 9) {<br>
> -      OUT_BATCH(0);<br>
> -      OUT_BATCH(0);<br>
> -   } else {<br>
> -      OUT_BATCH(0);<br>
> -      OUT_BATCH(0);<br>
> -   }<br>
> -<br>
> -   if (brw->gen >= 9) {<br>
> -      OUT_BATCH(0);<br>
> -      OUT_BATCH(0);<br>
> -      OUT_BATCH(0);<br>
> -      OUT_BATCH(0);<br>
> -      OUT_BATCH(0);<br>
> -      OUT_BATCH(0);<br>
> -      OUT_BATCH(0);<br>
> -      OUT_BATCH(0);<br>
> -   } else {<br>
> -      OUT_BATCH(0);<br>
> -      OUT_BATCH(0);<br>
> -      OUT_BATCH(0);<br>
> -      OUT_BATCH(0);<br>
> -      OUT_BATCH(0);<br>
> -      OUT_BATCH(0);<br>
> -      OUT_BATCH(0);<br>
> -      OUT_BATCH(0);<br>
> -   }<br>
> -<br>
> -   ADVANCE_BATCH();<br>
> -}<br>
> -<br>
>  static uint32_t<br>
>  gen8_blorp_emit_surface_states(struct brw_context *brw,<br>
>                                 const struct brw_blorp_params *params)<br>
> @@ -680,12 +642,12 @@ gen8_blorp_exec(struct brw_context *brw, const struct brw_blorp_params *params)<br>
>     const uint32_t cc_state_offset = gen6_blorp_emit_cc_state(brw);<br>
>     gen7_blorp_emit_cc_state_pointer(brw, cc_state_offset);<br>
><br>
> -   gen8_blorp_emit_disable_constant_state(brw, _3DSTATE_CONSTANT_VS);<br>
> -   gen8_blorp_emit_disable_constant_state(brw, _3DSTATE_CONSTANT_HS);<br>
> -   gen8_blorp_emit_disable_constant_state(brw, _3DSTATE_CONSTANT_DS);<br>
> -   gen8_blorp_emit_disable_constant_state(brw, _3DSTATE_CONSTANT_GS);<br>
> +   gen8_blorp_disable_constant_state(brw, _3DSTATE_CONSTANT_VS);<br>
> +   gen8_blorp_disable_constant_state(brw, _3DSTATE_CONSTANT_HS);<br>
> +   gen8_blorp_disable_constant_state(brw, _3DSTATE_CONSTANT_DS);<br>
> +   gen8_blorp_disable_constant_state(brw, _3DSTATE_CONSTANT_GS);<br>
> +   gen8_blorp_disable_constant_state(brw, _3DSTATE_CONSTANT_PS);<br>
><br>
> -   gen8_blorp_emit_disable_constant_ps(brw);<br>
>     wm_bind_bo_offset = gen8_blorp_emit_surface_states(brw, params);<br>
><br>
>     gen7_blorp_emit_binding_table_pointers_ps(brw, wm_bind_bo_offset);<br>
> --<br>
> 2.5.5<br>
><br>
> _______________________________________________<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">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</p>