<p dir="ltr"></p>
<p dir="ltr">On Jul 28, 2016 9:00 AM, "Pohjolainen, Topi" <<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a>> wrote:<br>
><br>
> On Tue, Jul 26, 2016 at 03:11:09PM -0700, Jason Ekstrand wrote:<br>
> > In order for the calculations of things such as fast clear rectangles to<br>
> > work, we need more details of the auxiliary surface to be correct. In<br>
> > particular, we need to be able to trust the width and height fields.<br>
> > (These are not necessarily what you want coming out of the miptree.) The<br>
> > only values state setup really cares about are the row and array pitch and<br>
> > those we can safely stomp from the miptree.<br>
> > ---<br>
> > src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 52 ++++-----------------------<br>
> > 1 file changed, 6 insertions(+), 46 deletions(-)<br>
> ><br>
> > diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c<br>
> > index 330291c..f762106 100644<br>
> > --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c<br>
> > +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c<br>
> > @@ -3189,9 +3189,6 @@ intel_miptree_get_aux_isl_surf(struct brw_context *brw,<br>
> > struct isl_surf *surf,<br>
> > enum isl_aux_usage *usage)<br>
> > {<br>
> > - /* Much is the same as the regular surface */<br>
> > - intel_miptree_get_isl_surf(brw, mt->mcs_mt, surf);<br>
> > -<br>
> > /* Figure out the layout */<br>
> > if (_mesa_get_format_base_format(mt->format) == GL_DEPTH_COMPONENT) {<br>
> > *usage = ISL_AUX_USAGE_HIZ;<br>
> > @@ -3217,9 +3214,7 @@ intel_miptree_get_aux_isl_surf(struct brw_context *brw,<br>
> > unreachable("Invalid MCS miptree");<br>
> ><br>
> > case ISL_AUX_USAGE_HIZ:<br>
> > - surf->format = ISL_FORMAT_HIZ;<br>
> > - surf->tiling = ISL_TILING_HIZ;<br>
> > - surf->usage = ISL_SURF_USAGE_HIZ_BIT;<br>
> > + isl_surf_get_hiz_surf(&brw->isl_dev, surf, surf);<br>
><br>
> Using the same instance both as input and output is dangerous in my opinion.<br>
> Could we introduce a temporary for the input (main surface) instead?</p>
<p dir="ltr">It is safe but I agree adding a temp is a lot cleaner. Eventually we should probably make the function take the main surface as a parameter but it was easier in the interim to just recreate it.</p>
<p dir="ltr">> > break;<br>
> ><br>
> > case ISL_AUX_USAGE_MCS:<br>
> > @@ -3231,16 +3226,7 @@ intel_miptree_get_aux_isl_surf(struct brw_context *brw,<br>
> > if (brw->gen >= 9)<br>
> > assert(mt->halign == 16);<br>
> ><br>
> > - surf->usage = ISL_SURF_USAGE_MCS_BIT;<br>
> > -<br>
> > - switch (mt->num_samples) {<br>
> > - case 2: surf->format = ISL_FORMAT_MCS_2X; break;<br>
> > - case 4: surf->format = ISL_FORMAT_MCS_4X; break;<br>
> > - case 8: surf->format = ISL_FORMAT_MCS_8X; break;<br>
> > - case 16: surf->format = ISL_FORMAT_MCS_16X; break;<br>
> > - default:<br>
> > - unreachable("Invalid number of samples");<br>
> > - }<br>
> > + isl_surf_get_mcs_surf(&brw->isl_dev, surf, surf);<br>
> > break;<br>
> ><br>
> > case ISL_AUX_USAGE_CCS_D:<br>
> > @@ -3259,39 +3245,13 @@ intel_miptree_get_aux_isl_surf(struct brw_context *brw,<br>
> > if (brw->gen >= 8)<br>
> > assert(mt->halign == 16);<br>
> ><br>
> > - surf->tiling = ISL_TILING_CCS;<br>
> > - surf->usage = ISL_SURF_USAGE_CCS_BIT;<br>
> > -<br>
> > - if (brw->gen >= 9) {<br>
> > - assert(mt->tiling == I915_TILING_Y);<br>
> > - switch (_mesa_get_format_bytes(mt->format)) {<br>
> > - case 4: surf->format = ISL_FORMAT_GEN9_CCS_32BPP; break;<br>
> > - case 8: surf->format = ISL_FORMAT_GEN9_CCS_64BPP; break;<br>
> > - case 16: surf->format = ISL_FORMAT_GEN9_CCS_128BPP; break;<br>
> > - default:<br>
> > - unreachable("Invalid format size for color compression");<br>
> > - }<br>
> > - } else if (mt->tiling == I915_TILING_Y) {<br>
> > - switch (_mesa_get_format_bytes(mt->format)) {<br>
> > - case 4: surf->format = ISL_FORMAT_GEN7_CCS_32BPP_Y; break;<br>
> > - case 8: surf->format = ISL_FORMAT_GEN7_CCS_64BPP_Y; break;<br>
> > - case 16: surf->format = ISL_FORMAT_GEN7_CCS_128BPP_Y; break;<br>
> > - default:<br>
> > - unreachable("Invalid format size for color compression");<br>
> > - }<br>
> > - } else {<br>
> > - assert(mt->tiling == I915_TILING_X);<br>
> > - switch (_mesa_get_format_bytes(mt->format)) {<br>
> > - case 4: surf->format = ISL_FORMAT_GEN7_CCS_32BPP_X; break;<br>
> > - case 8: surf->format = ISL_FORMAT_GEN7_CCS_64BPP_X; break;<br>
> > - case 16: surf->format = ISL_FORMAT_GEN7_CCS_128BPP_X; break;<br>
> > - default:<br>
> > - unreachable("Invalid format size for color compression");<br>
> > - }<br>
> > - }<br>
> > + isl_surf_get_ccs_surf(&brw->isl_dev, surf, surf);<br>
> > break;<br>
> > }<br>
> ><br>
> > + /* We want the pitch of the actual aux buffer. */<br>
> > + surf->row_pitch = mt->mcs_mt->pitch;<br>
> > +<br>
> > /* Auxiliary surfaces in ISL have compressed formats and array_pitch_el_rows<br>
> > * is in elements. This doesn't match intel_mipmap_tree::qpitch which is<br>
> > * in elements of the primary color surface so we have to divide by the<br>
> > --<br>
> > 2.5.0.400.gff86faf<br>
> ><br>
> > _______________________________________________<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">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br></p>