[Mesa-dev] [PATCH 2/3] i965/fs: Only emit FS_OPCODE_PLACEHOLDER_HALT if there are discards

Ben Widawsky ben at bwidawsk.net
Fri Apr 10 22:49:51 PDT 2015


On Fri, Apr 10, 2015 at 07:50:19PM -0700, Kenneth Graunke wrote:
> On Friday, April 10, 2015 12:52:03 PM Ben Widawsky wrote:
> > Based originally on a patch from Ken in May 2014 of the same title. Things
> > changed enough that I didn't feel comfortable leaving his authorship. Ken, if
> > you feel you should retain authorship, it's fine with me, just call it
> > reviewed-by me instead.
> > 
> > Cc: Kenneth Graunke <kenneth at whitecape.org>
> > Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
> > ---
> > 
> > Notes:
> >     Ken, if you feel you should retain authorship, it's fine with me, just call it
> >     reviewed-by me instead.
> 
> No, I think you should retain authorship.  I wrote a similar patch ages
> ago and abandoned it, but your new patch is completely rewritten.
> 
> > 
> >  src/mesa/drivers/dri/i965/brw_fs.cpp | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
> > index 214ba40..72000cf 100644
> > --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> > +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> > @@ -1700,6 +1700,9 @@ fs_visitor::emit_math(enum opcode opcode, fs_reg dst, fs_reg src0, fs_reg src1)
> >  void
> >  fs_visitor::emit_discard_jump()
> >  {
> > +   struct gl_fragment_program *fp = (struct gl_fragment_program *) this->prog;
> > +   assert(fp->UsesKill);
> > +
> >     /* For performance, after a discard, jump to the end of the
> >      * shader if all relevant channels have been discarded.
> >      */
> 
> Please drop this hunk - I don't think it provides any real value.
> Or, change it to check wm_prog_data->uses_kill.  Either way's fine.
> 
> > @@ -3956,7 +3959,8 @@ fs_visitor::run_fs()
> >        if (failed)
> >  	 return false;
> >  
> > -      emit(FS_OPCODE_PLACEHOLDER_HALT);
> > +      if (wm_prog_data->uses_kill)
> > +         emit(FS_OPCODE_PLACEHOLDER_HALT);
> >  
> >        if (wm_key->alpha_test_func)
> >           emit_alpha_test();
> > 
> 
> Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

Cool thanks...

While we're on the subject, I wouldn't mind the 5 second explanation of the
distinction between fp->UsesKill and wm_prog_data->uses_kill. I actually only
kept the former since your original patch had it (iirc).

-- 
Ben Widawsky, Intel Open Source Technology Center


More information about the mesa-dev mailing list