[Mesa-dev] [PATCH 08/11] i965: Add brw_wait to emit wait instruction

Matt Turner mattst88 at gmail.com
Sun Mar 22 19:15:26 PDT 2015


On Sun, Mar 22, 2015 at 6:49 PM, Jordan Justen
<jordan.l.justen at intel.com> wrote:
> This will be used to implement the barrier function.
>
> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> Reviewed-by: Chris Forbes <chrisf at ijw.co.nz>
> ---
>  src/mesa/drivers/dri/i965/brw_eu.h      |  2 ++
>  src/mesa/drivers/dri/i965/brw_eu_emit.c | 23 +++++++++++++++++++++++
>  2 files changed, 25 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h
> index f8fd155..5e86591 100644
> --- a/src/mesa/drivers/dri/i965/brw_eu.h
> +++ b/src/mesa/drivers/dri/i965/brw_eu.h
> @@ -360,6 +360,8 @@ brw_jump_scale(const struct brw_context *brw)
>     return 1;
>  }
>
> +void brw_wait(struct brw_compile *p);

This should be called brw_WAIT. Also, could you move the prototype to
after brw_NOP?

> +
>  /* If/else/endif.  Works by manipulating the execution flags on each
>   * channel.
>   */
> diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c
> index 1fe9e7b..d9572b5 100644
> --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
> +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
> @@ -2950,3 +2950,26 @@ void brw_shader_time_add(struct brw_compile *p,
>                                       0 /* response length */,
>                                       false /* header present */);
>  }
> +
> +
> +/**
> + * Emit the wait instruction for a barrier
> + */
> +void
> +brw_wait(struct brw_compile *p)
> +{
> +   struct brw_context *brw = p->brw;
> +   struct brw_inst *insn;
> +
> +   assert(brw->gen >= 7);

I know we're not going to be implementing barrier on gen < 7, but
there's nothing about the WAIT instruction that's specific to gen7+.
No need to assert, and with that cone

> +
> +   struct brw_reg src = brw_notification_reg();
> +
> +   insn = next_insn(p, BRW_OPCODE_WAIT);
> +   brw_set_dest(p, insn, brw_null_reg());
> +   brw_set_src0(p, insn, src);
> +   brw_set_src1(p, insn, brw_null_reg());

I ripped out an unused brw_WAIT function in commit ebc75245, and it
did brw_set_dest(p, insn, src), and while we can probably take
whatever a never-used function did with a grain of salt, the IVB PRM
does say "src0 and dst must be n0, n1, or n2." so I think dst does
need to be set.

> +
> +   brw_inst_set_exec_size(p->brw, insn, BRW_EXECUTE_1);

s/p->brw/brw/

> +   brw_inst_set_mask_control(brw, insn, BRW_MASK_DISABLE);
> +}
> --
> 2.1.4

With the function renamed, prototype moved, assertion removed,
destination fixed, and s/p->brw/brw/,

Reviewed-by: Matt Turner <mattst88 at gmail.com>


More information about the mesa-dev mailing list