<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, May 31, 2017 at 11:09 AM, Pohjolainen, Topi <span dir="ltr"><<a href="mailto:topi.pohjolainen@gmail.com" target="_blank">topi.pohjolainen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Wed, May 31, 2017 at 09:57:08AM -0700, Jason Ekstrand wrote:<br>
> On Wed, May 31, 2017 at 9:10 AM, Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
> wrote:<br>
><br>
> > On Wed, May 31, 2017 at 2:15 AM, Pohjolainen, Topi <<br>
> > <a href="mailto:topi.pohjolainen@gmail.com">topi.pohjolainen@gmail.com</a>> wrote:<br>
> ><br>
> >> On Fri, May 26, 2017 at 04:30:19PM -0700, Jason Ekstrand wrote:<br>
> >> > This commit adds a new unified interface for doing resolves. The basic<br>
> >> > format is that, prior to any surface access such as texturing or<br>
> >> > rendering, you call intel_miptree_prepare_access. If the surface was<br>
> >> > written, you call intel_miptree_finish_write. These two functions take<br>
> >> > parameters which tell them whether or not auxiliary compression and fast<br>
> >> > clears are supported on the surface. Later commits will add wrappers<br>
> >> > around these two functions for texturing, rendering, etc.<br>
> >> > ---<br>
> >> > src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c | 156<br>
> >> +++++++++++++++++++++++++-<br>
> >> > src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h | 80 +++++++++++++<br>
> >> > 2 files changed, 232 insertions(+), 4 deletions(-)<br>
> >> ><br>
> >> > diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c<br>
> >> b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c<br>
> >> > index 6cd32ce..0659e75 100644<br>
> >> > --- a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c<br>
> >> > +++ b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c<br>
> >> > @@ -2028,8 +2028,7 @@ bool<br>
> >> > intel_miptree_all_slices_<wbr>resolve_hiz(struct brw_context *brw,<br>
> >> > struct intel_mipmap_tree *mt)<br>
> >> > {<br>
> >> > - return intel_miptree_depth_hiz_<wbr>resolve(brw, mt,<br>
> >> > - 0, UINT32_MAX, 0, UINT32_MAX,<br>
> >> > + return intel_miptree_depth_hiz_<wbr>resolve(brw, mt, 0, UINT32_MAX, 0,<br>
> >> UINT32_MAX,<br>
> >> > BLORP_HIZ_OP_HIZ_RESOLVE);<br>
> >> > }<br>
> >> ><br>
> >> > @@ -2037,8 +2036,7 @@ bool<br>
> >> > intel_miptree_all_slices_<wbr>resolve_depth(struct brw_context *brw,<br>
> >> > struct intel_mipmap_tree *mt)<br>
> >> > {<br>
> >> > - return intel_miptree_depth_hiz_<wbr>resolve(brw, mt,<br>
> >> > - 0, UINT32_MAX, 0, UINT32_MAX,<br>
> >> > + return intel_miptree_depth_hiz_<wbr>resolve(brw, mt, 0, UINT32_MAX, 0,<br>
> >> UINT32_MAX,<br>
> >> > BLORP_HIZ_OP_DEPTH_RESOLVE);<br>
> >> > }<br>
> >> ><br>
> >> > @@ -2221,6 +2219,156 @@ intel_miptree_all_slices_<wbr>resolve_color(struct<br>
> >> brw_context *brw,<br>
> >> > intel_miptree_resolve_color(<wbr>brw, mt, 0, UINT32_MAX, 0, UINT32_MAX,<br>
> >> flags);<br>
> >> > }<br>
> >> ><br>
> >> > +void<br>
> >> > +intel_miptree_prepare_access(<wbr>struct brw_context *brw,<br>
> >> > + struct intel_mipmap_tree *mt,<br>
> >> > + uint32_t start_level, uint32_t num_levels,<br>
> >> > + uint32_t start_layer, uint32_t num_layers,<br>
> >> > + bool aux_supported, bool<br>
> >> fast_clear_supported)<br>
> >><br>
> >> Well, I might as well throw in my preference on using enumarated flags<br>
> >> instead<br>
> >> of booleans. In call sites, for exmaple,<br>
> >><br>
> >> intel_miptree_prepare_access(<wbr>brw, mt, start_level, num_levels,<br>
> >> start_layer, num_layers,<br>
> >> INTEL_SUPPORT_AUX |<br>
> >> INTEL_SUPPORT_FAST_CLEAR);<br>
> >><br>
> >> is more informative than<br>
> >><br>
> >> intel_miptree_prepare_access(<wbr>brw, mt, start_level, num_levels,<br>
> >> start_layer, num_layers,<br>
> >> true, true);<br>
> >><br>
> ><br>
> > Yeah, it is. I'll give it a go and see what it looks like.<br>
> ><br>
> ><br>
> >> Former also allows adding more flags without changing the signature.<br>
> >><br>
> ><br>
> > I'm not sure if that's actually a feature... People tend to expand flags<br>
> > fields without thinking about what they're doing. :-) But I agree that<br>
> > labels are nice.<br>
> ><br>
><br>
> I gave this a go. Take a look at the top patch on<br>
><br>
> <a href="https://cgit.freedesktop.org/~jekstrand/mesa/log/?h=wip/" rel="noreferrer" target="_blank">https://cgit.freedesktop.org/~<wbr>jekstrand/mesa/log/?h=wip/</a><br>
> i965-resolve-rework-v3<br>
><br>
> I'm not sure I actually like the result. Here's some thoughts:<br>
><br>
> 1) It is somewhat more explicit what you support from the call.<br>
><br>
> 2) If you don't support aux at all, then it becomes 0 which is less clear<br>
> than false, false.<br>
><br>
> 3) Very few things call prepare_access directly.<br>
><br>
> 4) Things are fairly firmly structured on the two bits right now. If<br>
> someone adds a third flag without thinking carefully about it and plumbing<br>
> it through to everything, they will break things. Having them be separate<br>
> parameters forces you to think about it at every stage.<br>
><br>
> 5) I was renaming parameters in the special-case prepare_access functions<br>
> so, for instance, the HiZ version had hiz_supported and<br>
> fast_clear_supported. We can't do this anymore.<br>
><br>
> 6) It's actually a bit more awkward to construct a set of flags than to<br>
> construct a pair of booleans. Not bad, but mildly annoying.<br>
<br>
</div></div>Agreed. Lets drop that idea. The more I read, the more I saw cases where you<br>
didn't just pass true or false but nicely named helper variables. All those<br>
cases would just get unnecessarily complicated with the flags.<br><div class="HOEnZb"><div class="h5"></div></div></blockquote><div><br></div><div>Done. :)<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
><br>
> 7) It's unclear what to do with finish_write since it only takes one<br>
> boolean.<br>
><br>
> All in all, I'm not incredibly pleased with the change. While I agree in<br>
> general that flags are better than a pile of bools, I think the bools make<br>
> more sense here given how many layers of plumbing there are. I'm willing<br>
> to change it if you really want but it doesn't seem all that compelling.<br>
</div></div></blockquote></div><br></div></div>