<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Jul 11, 2017 at 4:31 PM, Nanley Chery <span dir="ltr"><<a href="mailto:nanleychery@gmail.com" target="_blank">nanleychery@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 Mon, Jul 10, 2017 at 02:36:16PM -0700, Jason Ekstrand wrote:<br>
> On Wed, Jun 28, 2017 at 2:14 PM, Nanley Chery <<a href="mailto:nanleychery@gmail.com">nanleychery@gmail.com</a>> wrote:<br>
><br>
> > For readability, bring the assignment of CCS closer to the assignment of<br>
> > NONE and MCS.<br>
> ><br>
> > Signed-off-by: Nanley Chery <<a href="mailto:nanley.g.chery@intel.com">nanley.g.chery@intel.com</a>><br>
> > ---<br>
> > src/intel/vulkan/genX_cmd_<wbr>buffer.c | 62 ++++++++++++++++++------------<br>
> > --------<br>
> > 1 file changed, 30 insertions(+), 32 deletions(-)<br>
> ><br>
> > diff --git a/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> > b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> > index 49ad41edbd..1aa79c8e7b 100644<br>
> > --- a/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> > +++ b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> > @@ -253,6 +253,36 @@ color_attachment_compute_aux_<wbr>usage(struct anv_device<br>
> > * device,<br>
> > att_state->input_aux_usage = ISL_AUX_USAGE_MCS;<br>
> > att_state->fast_clear = false;<br>
> > return;<br>
> > + } else if (iview->image->aux_usage == ISL_AUX_USAGE_CCS_E) {<br>
> > + att_state->aux_usage = ISL_AUX_USAGE_CCS_E;<br>
> > + att_state->input_aux_usage = ISL_AUX_USAGE_CCS_E;<br>
> ><br>
><br>
> I'm not sure if this actually improves readability as-is. The no aux case<br>
> and MCS cases are early returns. Maybe what we want is something like this:<br>
><br>
> if (aux_surface.isl.size == 0) {<br>
> /* set to none */<br>
> return;<br>
> }<br>
><br>
> switch (aux_usage) {<br>
> case MCS:<br>
> case CCS_E:<br>
> aux_state->aux_usage = iview->image->aux_usage;<br>
> aux_state->input_aux_usage = iview->image->aux_usage;<br>
> break;<br>
><br>
> case NONE:<br>
> assert(samples == 1);<br>
> /* stuff below */<br>
> break;<br>
><br>
> default:<br>
> unreachable();<br>
> }<br>
><br>
> /* Now we determine whether or not we want to fast-clear */<br>
><br>
> if (samples > 1) {<br>
> perf_debug();<br>
> fast_clear = false;<br>
> return;<br>
> }<br>
><br>
> /* Other fast clear determination. */<br>
><br>
> Incidentally, it may be cleaner in the long run if we split this into two<br>
> functions: compute_ccs_usage and compute_mcs_usage.<br>
><br>
> Just thoughts BTW. I'm not 100% sure how to make this the most readable.<br>
><br>
><br>
<br>
</div></div>I'm personally not finding the alternative block above more readable.</blockquote><div><br></div><div>I'm not entirely convinced either. :-)<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> To<br>
overcome this disagreement, I don't mind doing any of the following:<br>
<br>
1. Omit the rationale in the commit message.<br>
2. Drop the patch from this series.<br></blockquote><div><br></div><div>I don't really care that much. I'd go for either 2. or just leave it as is. Either is fine with me. I think it'll be much more clear what to do once we have MCS fast clears in there. What I wrote above was me trying to imagine what it would look like with MCS fast clears and then delete the extra MCS bits. It'll work better once someone is writing code in a computer rather than my brain. :-)<br><br></div><div>--Jason<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thoughts?<br>
<span class="HOEnZb"><font color="#888888"><br>
-Nanley<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
> > + } else {<br>
> > + att_state->aux_usage = ISL_AUX_USAGE_CCS_D;<br>
> > + /* From the Sky Lake PRM, RENDER_SURFACE_STATE::<br>
> > AuxiliarySurfaceMode:<br>
> > + *<br>
> > + * "If Number of Multisamples is MULTISAMPLECOUNT_1, AUX_CCS_D<br>
> > + * setting is only allowed if Surface Format supported for Fast<br>
> > + * Clear. In addition, if the surface is bound to the sampling<br>
> > + * engine, Surface Format must be supported for Render Target<br>
> > + * Compression for surfaces bound to the sampling engine."<br>
> > + *<br>
> > + * In other words, we can only sample from a fast-cleared image if<br>
> > it<br>
> > + * also supports color compression.<br>
> > + */<br>
> > + if (isl_format_supports_ccs_e(&<wbr>device->info, iview->isl.format)) {<br>
> > + /* TODO: Consider using a heuristic to determine if temporarily<br>
> > enabling<br>
> > + * CCS_E for this image view would be beneficial.<br>
> > + *<br>
> > + * While fast-clear resolves and partial resolves are fairly<br>
> > cheap in the<br>
> > + * case where you render to most of the pixels, full resolves<br>
> > are not<br>
> > + * because they potentially involve reading and writing the<br>
> > entire<br>
> > + * framebuffer. If we can't texture with CCS_E, we should leave<br>
> > it off and<br>
> > + * limit ourselves to fast clears.<br>
> > + */<br>
> > + att_state->input_aux_usage = ISL_AUX_USAGE_CCS_D;<br>
> > + } else {<br>
> > + att_state->input_aux_usage = ISL_AUX_USAGE_NONE;<br>
> > + }<br>
> > }<br>
> ><br>
> > assert(iview->image->aux_<wbr>surface.isl.usage & ISL_SURF_USAGE_CCS_BIT);<br>
> > @@ -315,38 +345,6 @@ color_attachment_compute_aux_<wbr>usage(struct anv_device<br>
> > * device,<br>
> > } else {<br>
> > att_state->fast_clear = false;<br>
> > }<br>
> > -<br>
> > - /**<br>
> > - * TODO: Consider using a heuristic to determine if temporarily<br>
> > enabling<br>
> > - * CCS_E for this image view would be beneficial.<br>
> > - *<br>
> > - * While fast-clear resolves and partial resolves are fairly cheap in<br>
> > the<br>
> > - * case where you render to most of the pixels, full resolves are not<br>
> > - * because they potentially involve reading and writing the entire<br>
> > - * framebuffer. If we can't texture with CCS_E, we should leave it<br>
> > off and<br>
> > - * limit ourselves to fast clears.<br>
> > - */<br>
> > - if (iview->image->aux_usage == ISL_AUX_USAGE_CCS_E) {<br>
> > - att_state->aux_usage = ISL_AUX_USAGE_CCS_E;<br>
> > - att_state->input_aux_usage = ISL_AUX_USAGE_CCS_E;<br>
> > - } else {<br>
> > - att_state->aux_usage = ISL_AUX_USAGE_CCS_D;<br>
> > - /* From the Sky Lake PRM, RENDER_SURFACE_STATE::<br>
> > AuxiliarySurfaceMode:<br>
> > - *<br>
> > - * "If Number of Multisamples is MULTISAMPLECOUNT_1, AUX_CCS_D<br>
> > - * setting is only allowed if Surface Format supported for Fast<br>
> > - * Clear. In addition, if the surface is bound to the sampling<br>
> > - * engine, Surface Format must be supported for Render Target<br>
> > - * Compression for surfaces bound to the sampling engine."<br>
> > - *<br>
> > - * In other words, we can only sample from a fast-cleared image if<br>
> > it<br>
> > - * also supports color compression.<br>
> > - */<br>
> > - if (isl_format_supports_ccs_e(&<wbr>device->info, iview->isl.format))<br>
> > - att_state->input_aux_usage = ISL_AUX_USAGE_CCS_D;<br>
> > - else<br>
> > - att_state->input_aux_usage = ISL_AUX_USAGE_NONE;<br>
> > - }<br>
> > }<br>
> ><br>
> > static bool<br>
> > --<br>
> > 2.13.1<br>
> ><br>
> > ______________________________<wbr>_________________<br>
> > mesa-dev mailing list<br>
> > <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> > <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
> ><br>
</div></div></blockquote></div><br></div></div>