<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 11, 2016 at 8:39 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">On Wed, May 11, 2016 at 07:46:33AM -0700, Jason Ekstrand wrote:<br>
> On May 11, 2016 7:45 AM, "Jason Ekstrand" <[1]<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
<span class="">> wrote:<br>
> ><br>
> ><br>
> > On May 10, 2016 11:53 PM, "Pohjolainen, Topi"<br>
</span><div><div class="h5">> <[2]<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a>> wrote:<br>
> > ><br>
> > > On Tue, May 10, 2016 at 04:16:35PM -0700, Jason Ekstrand wrote:<br>
> > > > This array allows the push constants to be re-arranged on<br>
> upload. The<br>
> > > > actual arrangement will, eventually, come from the back-end<br>
> compiler.<br>
> > > > ---<br>
> > > > src/mesa/drivers/dri/i965/brw_blorp.c | 4 ++++<br>
> > > > src/mesa/drivers/dri/i965/brw_blorp.h | 6 ++++++<br>
> > > > src/mesa/drivers/dri/i965/gen6_blorp.c | 12 +++++++-----<br>
> > > > 3 files changed, 17 insertions(+), 5 deletions(-)<br>
> > > ><br>
> > > > diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c<br>
> b/src/mesa/drivers/dri/i965/brw_blorp.c<br>
> > > > index 4bbe45f..1379804 100644<br>
> > > > --- a/src/mesa/drivers/dri/i965/brw_blorp.c<br>
> > > > +++ b/src/mesa/drivers/dri/i965/brw_blorp.c<br>
> > > > @@ -139,6 +139,10 @@ brw_blorp_prog_data_init(struct<br>
> brw_blorp_prog_data *prog_data)<br>
> > > > {<br>
> > > > prog_data->first_curbe_grf = 0;<br>
> > > > prog_data->persample_msaa_dispatch = false;<br>
> > > > +<br>
> > > > + prog_data->nr_params = BRW_BLORP_NUM_PUSH_CONSTANT_DWORDS;<br>
> > > > + for (unsigned i = 0; i < BRW_BLORP_NUM_PUSH_CONSTANT_DWORDS;<br>
> i++)<br>
> > > > + prog_data->param[i] = i;<br>
> > > > }<br>
> > > ><br>
> > > ><br>
> > > > diff --git a/src/mesa/drivers/dri/i965/brw_blorp.h<br>
> b/src/mesa/drivers/dri/i965/brw_blorp.h<br>
> > > > index 4a0e46e..c2f33a1 100644<br>
> > > > --- a/src/mesa/drivers/dri/i965/brw_blorp.h<br>
> > > > +++ b/src/mesa/drivers/dri/i965/brw_blorp.h<br>
> > > > @@ -199,6 +199,9 @@ struct brw_blorp_wm_push_constants<br>
> > > > uint32_t pad[5];<br>
> > > > };<br>
> > > ><br>
> > > > +#define BRW_BLORP_NUM_PUSH_CONSTANT_DWORDS \<br>
> > > > + (sizeof(struct brw_blorp_wm_push_constants) / 4)<br>
> > > > +<br>
> > > > /* Every 32 bytes of push constant data constitutes one GEN<br>
> register. */<br>
> > > > static const unsigned int BRW_BLORP_NUM_PUSH_CONST_REGS =<br>
> > > > sizeof(struct brw_blorp_wm_push_constants) / 32;<br>
> > > > @@ -212,6 +215,9 @@ struct brw_blorp_prog_data<br>
> > > > * than one sample per pixel.<br>
> > > > */<br>
> > > > bool persample_msaa_dispatch;<br>
> > > > +<br>
> > > > + uint8_t nr_params;<br>
> > > > + uint8_t param[BRW_BLORP_NUM_PUSH_CONSTANT_DWORDS];<br>
> > ><br>
> > > Do I read this correctly: this corresponds to push_contant_loc in<br>
> the scalar<br>
> > > backend?<br>
> ><br>
> > Sort-of. The mapping actually goes in the other direction: From<br>
> location to uniform number.<br>
><br>
> Really, it's just a simplified version of peog_data->param.<br>
<br>
</div></div>Right. Could we add some description, "param" doesn't tell much, does it?<br>
For example,<br>
<br>
/* Compiler will re-arrange push constants and store the upload order<br>
* here. Given an index 'i' in the final upload buffer, param[i] gives<br>
* the index in the uniform store. In other words, the value to be<br>
* uploaded can be found in brw_blorp_params::wm_push_consts[param[i]].<br></blockquote><div><br></div><div>I added basically that exact comment. Thanks!<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
*/<br>
uint8_t param[BRW_BLORP_NUM_PUSH_CONSTANT_DWORDS];<br>
<div><div class="h5"><br>
><br>
> > > > };<br>
> > > ><br>
> > > > void brw_blorp_prog_data_init(struct brw_blorp_prog_data<br>
> *prog_data);<br>
> > > > diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.c<br>
> b/src/mesa/drivers/dri/i965/gen6_blorp.c<br>
> > > > index 1955811..950e2b9 100644<br>
> > > > --- a/src/mesa/drivers/dri/i965/gen6_blorp.c<br>
> > > > +++ b/src/mesa/drivers/dri/i965/gen6_blorp.c<br>
> > > > @@ -308,11 +308,13 @@ gen6_blorp_emit_wm_constants(struct<br>
> brw_context *brw,<br>
> > > > {<br>
> > > > uint32_t wm_push_const_offset;<br>
> > > ><br>
> > > > - void *constants = brw_state_batch(brw,<br>
> AUB_TRACE_WM_CONSTANTS,<br>
> > > > -<br>
> sizeof(params->wm_push_consts),<br>
> > > > - 32, &wm_push_const_offset);<br>
> > > > - memcpy(constants, ¶ms->wm_push_consts,<br>
> > > > - sizeof(params->wm_push_consts));<br>
> > > > + uint32_t *constants = brw_state_batch(brw,<br>
> AUB_TRACE_WM_CONSTANTS,<br>
> > > > +<br>
> sizeof(params->wm_push_consts),<br>
> > > > + 32,<br>
> &wm_push_const_offset);<br>
> > > > +<br>
> > > > + uint32_t *push_consts = (uint32_t *)¶ms->wm_push_consts;<br></div></div></blockquote><div><br></div><div>I also made the const change you suggested here.<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">
> > > > + for (unsigned i = 0; i < params->wm_prog_data->nr_params;<br>
> i++)<br>
> > > > + constants[i] =<br>
> push_consts[params->wm_prog_data->param[i]];<br>
> > > ><br>
> > > > return wm_push_const_offset;<br>
> > > > }<br>
> > > > --<br>
> > > > 2.5.0.400.gff86faf<br>
> > > ><br>
> > > > _______________________________________________<br>
> > > > mesa-dev mailing list<br>
</div></div>> > > > [3]<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> > > > [4]<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
><br>
> References<br>
><br>
> 1. mailto:<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a><br>
> 2. mailto:<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a><br>
> 3. mailto:<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> 4. <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>