[Mesa-dev] [PATCH] i965: Don't call _mesa_load_state_parameters when nr_params == 0.

Kenneth Graunke kenneth at whitecape.org
Thu Nov 20 02:04:55 PST 2014


On Friday, November 14, 2014 10:49:04 AM Matt Turner wrote:
> On Thu, Nov 13, 2014 at 11:22 PM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> > Saves a tiny bit of CPU overhead.
> >
> > Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> > ---
> >  src/mesa/drivers/dri/i965/brw_vs_surface_state.c | 10 +++++-----
> >  src/mesa/drivers/dri/i965/gen6_vs_state.c        | 12 ++++++------
> >  2 files changed, 11 insertions(+), 11 deletions(-)
> >
> > diff --git a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
> > index 1cc96cf..4e18c7d 100644
> > --- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
> > +++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
> > @@ -59,11 +59,6 @@ brw_upload_pull_constants(struct brw_context *brw,
> >     int i;
> >     uint32_t surf_index = prog_data->binding_table.pull_constants_start;
> >
> > -   /* Updates the ParamaterValues[i] pointers for all parameters of the
> > -    * basic type of PROGRAM_STATE_VAR.
> > -    */
> > -   _mesa_load_state_parameters(&brw->ctx, prog->Parameters);
> > -
> >     if (!prog_data->nr_pull_params) {
> 
> This check is different from the one below and what the commit summary says.
> 
> Assuming that's what you expected
> 
> Reviewed-by: Matt Turner <mattst88 at gmail.com>

Right.  The point is to skip calling _mesa_load_state_parameters if you know
it won't do anything useful.  If there are zero push parameters, the push code
doesn't need this to happen.  Ditto for pull.

The fact that both pieces of code independently call it should make it okay
to check the # of push parameters and # of pull parameters separately - each
section of code is responsible for making it happen before it matters.

It's a bit stupid that we call it from both places.  Eric apparently wrote a
branch to fix that, but never got it working:
http://cgit.freedesktop.org/~anholt/mesa/log/?h=core-loadstateparameters

In the meantime, I've renamed the patch to:

    i965: Skip _mesa_load_state_parameters when there are zero parameters.

which still isn't great, but is better.  I've also pushed it.

Thanks for the review!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20141120/9490e04b/attachment.sig>


More information about the mesa-dev mailing list