<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Mar 22, 2017 at 7:38 AM, Samuel Iglesias Gonsálvez <span dir="ltr"><<a href="mailto:siglesias@igalia.com" target="_blank">siglesias@igalia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tue, 2017-03-21 at 16:34 +0100, Samuel Iglesias Gonsálvez wrote:<br>
><br>
> On 21/03/17 16:14, Jason Ekstrand wrote:<br>
> > On Tue, Mar 21, 2017 at 7:23 AM, Samuel Iglesias Gonsálvez<br>
> > <<a href="mailto:siglesias@igalia.com">siglesias@igalia.com</a> <mailto:<a href="mailto:siglesias@igalia.com">siglesias@igalia.com</a>>> wrote:<br>
> ><br>
> > Input attachments are clear-color aware on Sky Lake, so we<br>
> > can frequently sample from them with no resolves at all.<br>
> > However<br>
> > on Broadwell we still need to do a a resolve between the<br>
> > subpass<br>
> > that writes and the subpass that reads.<br>
> ><br>
> ><br>
> > In theory, we shouldn't always need to do a resolve. Broadwell is<br>
> > supposed (maybe it doesn't work?) to support sampling from fast-<br>
> > cleared<br>
> > buffers and I thought it was hooked up correctly. Is this only an<br>
> > issue<br>
> > for certain clear colors? I have a feeling there's something more<br>
> > subtle going on here.<br>
> > <br>
><br>
> OK, I will investigate further.<br>
><br>
<br>
</span>The value of the clear colors is irrelevant except if the image's clear<br>
color is the same than attachment's clear color, probably<br>
because sampling from fast-cleared buffers is not working and it has<br>
already the clear color it expects. Once they are different, the tests<br>
always fail.<br>
<br>
However, I think I have found something:<br>
<br>
According to BDW PRM, vol02d, RenderSurface::Auxiliary Surface Mode,<br>
the only available values are AUX_NONE (0x0), AUX_MCS (0x1),<br>
AUX_APPEND (0x2), AUX_HIZ (0x3), the rest are reserved.<br>
<br>
AUX_MCS is only if the Auxiliary surface is an MCS (Multisample Control<br>
Surface). This is different in gen9+: set the mode to AUX_CCS_D (0x1)<br>
when the Auxiliary surface is a CCS (Color Control Surface) with<br>
compression disabled or an MCS with compression enabled, depending on<br>
Number of Multisamples.<br>
<br>
Inside color_attachment_compute_aux_<wbr>usage() we are setting both aux<br>
surface usage and input aux usage to ISL_AUX_USAGE_CCS_D for BDW, but I<br>
think we need to do it only if it is a MCS (maybe set both to<br>
ISL_AUX_USAGE_MCS would be better?) and, if not, set the latter to<br>
ISL_AUX_USAGE_NONE in order to force the resolve in<br>
ccs_resolve_attachment() (see the first else-if of this patch).<br></blockquote><div><br></div><div>Welcome to the subtlties of surface layout! On Ivy Bridge through Broadwell hardware, MCS is overloaded to mean both multisample compression and fast-clears. On Sky Lake, we have MCS, CCS_D, and CCS_E. In ISL, we've chosen to get rid of the aliasing and use CCS_D to mean single-sample fast-clears on old hardware and keep MCS reserved for multisampling. As far as the Aux Usage field in SURFACE_STATE is concerned, both MCS and CCS_D map to MCS. See also isl_surface_state.c:90.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
What do you think?<br>
<div class="HOEnZb"><div class="h5"><br>
Sam<br>
<br>
><br>
> ><br>
> > Fixes 16 tests on BDW:<br>
> ><br>
> > dEQP-VK.renderpass.<wbr>formats.*.input.clear.store.<wbr>self_dep*<br>
> ><br>
> > Signed-off-by: Samuel Iglesias Gonsálvez <<a href="mailto:siglesias@igalia.com">siglesias@igalia.com</a><br>
> > <mailto:<a href="mailto:siglesias@igalia.com">siglesias@igalia.<wbr>com</a>>><br>
> > ---<br>
> > src/intel/vulkan/anv_<wbr>blorp.c | 9 ++++++---<br>
> > 1 file changed, 6 insertions(+), 3 deletions(-)<br>
> ><br>
> > diff --git a/src/intel/vulkan/anv_blorp.c<br>
> > b/src/intel/vulkan/anv_blorp.c<br>
> > index 1f4fec5f35b..2fa56f49d18 100644<br>
> > --- a/src/intel/vulkan/anv_blorp.c<br>
> > +++ b/src/intel/vulkan/anv_blorp.c<br>
> > @@ -1504,10 +1504,13 @@ ccs_resolve_attachment(struct<br>
> > anv_cmd_buffer<br>
> > *cmd_buffer,<br>
> > */<br>
> > }<br>
> > } else if (usage & ANV_SUBPASS_USAGE_INPUT) {<br>
> > - /* Input attachments are clear-color aware so, at least<br>
> > on<br>
> > Sky Lake, we<br>
> > - * can frequently sample from them with no resolves at<br>
> > all.<br>
> > + /* Input attachments are clear-color aware on Sky Lake,<br>
> > so we<br>
> > + * can frequently sample from them with no resolves at<br>
> > all.<br>
> > However<br>
> > + * on Broadwell we still need to do resolves.<br>
> > */<br>
> > - if (att_state->aux_usage != att_state->input_aux_usage)<br>
> > {<br>
> > + if (cmd_buffer->device->info.gen < 9) {<br>
> > + resolve_op = BLORP_FAST_CLEAR_OP_RESOLVE_<wbr>FULL;<br>
> > + } else if (att_state->aux_usage != att_state-<br>
> > >input_aux_usage) {<br>
> > assert(att_<wbr>state->input_aux_usage ==<br>
> > ISL_AUX_USAGE_NONE);<br>
> > resolve_op = BLORP_FAST_CLEAR_OP_RESOLVE_<wbr>FULL;<br>
> > } else if (!att_state->clear_color_is_<wbr>zero_one) {<br>
> > --<br>
> > 2.11.0<br>
> ><br>
> ><br>
><br>
> </div></div></blockquote></div><br></div></div>