<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Jul 21, 2017 at 12:51 PM, 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, Jul 19, 2017 at 02:01:46PM -0700, Jason Ekstrand wrote:<br>
> ---<br>
>  src/intel/isl/isl.h                           | 88 ++++++++++++++++-----------<br>
>  src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c | 11 ++++<br>
>  2 files changed, 64 insertions(+), 35 deletions(-)<br>
><br>
> diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h<br>
> index d81df31..68bfcee 100644<br>
> --- a/src/intel/isl/isl.h<br>
> +++ b/src/intel/isl/isl.h<br>
> @@ -618,7 +618,11 @@ enum isl_aux_usage {<br>
>   *       color by simply changing the clear color without modifying either<br>
>   *       surface.<br>
>   *<br>
> - *    2) Compressed w/ Clear:  In this state, neither the auxiliary surface<br>
> + *    2) Partial Clear:  In this state, each block in the auxiliary surface<br>
> + *       contains either the magic clear or pass-through value.  See Clear and<br>
> + *       Pass-through for more details.<br>
> + *<br>
> + *    3) Compressed w/ Clear:  In this state, neither the auxiliary surface<br>
>   *       nor the primary surface has a complete representation of the data.<br>
>   *       Instead, both surfaces must be used together or else rendering<br>
>   *       corruption may occur.  Depending on the auxiliary compression format<br>
> @@ -627,19 +631,19 @@ enum isl_aux_usage {<br>
>   *       values.  Blocks may also be in the clear state (see Clear) and have<br>
>   *       their value taken from outside the surface.<br>
>   *<br>
> - *    3) Compressed w/o Clear:  This state is identical to the state above<br>
> + *    4) Compressed w/o Clear:  This state is identical to the state above<br>
>   *       except that no blocks are in the clear state.  In this state, all of<br>
>   *       the data required to reconstruct the final sample values is contained<br>
>   *       in the auxiliary and primary surface and the clear value is not<br>
>   *       considered.<br>
>   *<br>
> - *    4) Resolved:  In this state, the primary surface contains 100% of the<br>
> + *    5) Resolved:  In this state, the primary surface contains 100% of the<br>
>   *       data.  The auxiliary surface is also valid so the surface can be<br>
>   *       validly used with or without aux enabled.  The auxiliary surface may,<br>
>   *       however, contain non-trivial data and any update to the primary<br>
>   *       surface with aux disabled will cause the two to get out of sync.<br>
>   *<br>
> - *    5) Pass-through:  In this state, the primary surface contains 100% of the<br>
> + *    6) Pass-through:  In this state, the primary surface contains 100% of the<br>
>   *       data and every block in the auxiliary surface contains a magic value<br>
>   *       which indicates that the auxiliary surface should be ignored and the<br>
>   *       only the primary surface should be considered.  Updating the primary<br>
> @@ -648,7 +652,7 @@ enum isl_aux_usage {<br>
>   *       cause the auxiliary buffer to contain non-trivial data and no longer<br>
>   *       be in the pass-through state.<br>
>   *<br>
> - *    5) Aux Invalid:  In this state, the primary surface contains 100% of the<br>
> + *    7) Aux Invalid:  In this state, the primary surface contains 100% of the<br>
>   *       data and the auxiliary surface is completely bogus.  Any attempt to<br>
>   *       use the auxiliary surface is liable to result in rendering<br>
>   *       corruption.  The only thing that one can do to re-enable aux once<br>
> @@ -662,7 +666,8 @@ enum isl_aux_usage {<br>
>   *    1) Fast Clear:  This operation writes the magic "clear" value to the<br>
>   *       auxiliary surface.  This operation will safely transition any slice<br>
>   *       of a surface from any state to the clear state so long as the entire<br>
> - *       slice is fast cleared at once.<br>
> + *       slice is fast cleared at once.  A fast clear that only covers part of<br>
> + *       a slice of a surface is called a partial fast clear.<br>
>   *<br>
>   *    2) Full Resolve:  This operation combines the auxiliary surface data<br>
>   *       with the primary surface data and writes the result to the primary.<br>
> @@ -689,34 +694,46 @@ enum isl_aux_usage {<br>
>   *   Draw w/ Aux<br>
>   *   +----------+<br>
>   *   |          |<br>
> - *   |       +-------------+     Draw w/ Aux      +-------------+<br>
> - *   +------>| Compressed  |<---------------------|    Clear    |<br>
> - *           |  w/ Clear   |                      |             |<br>
> - *           +-------------+                      +-------------+<br>
> - *                  |   |                                |<br>
> - *          Partial |   |                                |<br>
> - *          Resolve |   |        Full Resolve            |<br>
> - *                  |   +----------------------------+   |  Full<br>
> - *                  |                                |   | Resolve<br>
> - *   Draw w/ aux    |                                |   |<br>
> - *   +----------+   |                                |   |<br>
> - *   |          |  \|/                              \|/ \|/<br>
> - *   |       +-------------+     Full Resolve     +-------------+<br>
> - *   +------>| Compressed  |--------------------->|  Resolved   |<br>
> - *           |  w/o Clear  |<---------------------|             |<br>
> - *           +-------------+     Draw w/ Aux      +-------------+<br>
> - *                 /|\                               |   |<br>
> - *                  |  Draw                          |   |  Draw<br>
> - *                  | w/ Aux                         |   | w/o Aux<br>
> - *                  |             Ambiguate          |   |<br>
> - *                  |   +----------------------------+   |<br>
> - *   Draw w/o Aux   |   |                                |   Draw w/o Aux<br>
> - *   +----------+   |   |                                |   +----------+<br>
> - *   |          |   |  \|/                              \|/  |          |<br>
> - *   |       +-------------+      Ambiguate       +-------------+       |<br>
> - *   +------>|    Pass-    |<---------------------|     Aux     |<------+<br>
> - *           |   through   |                      |   Invalid   |<br>
> - *           +-------------+                      +-------------+<br>
> + *   |       +-------------+    Draw w/ Aux     +-------------+<br>
> + *   +------>| Compressed  |<-------------------|    Clear    |<br>
> + *           |  w/ Clear   |----->----+         |             |<br>
> + *           +-------------+          |         +-------------+<br>
> + *                  |  /|\            |            |   |<br>
> + *                  |   |             |            |   |<br>
> + *                  |   |             +------<-----+   |  Draw w/<br>
> + *                  |   |             |                | Clear Only<br>
> + *                  |   |      Full   |                |   +----------+<br>
> + *          Partial |   |     Resolve |               \|/  |          |<br>
> + *          Resolve |   |             |         +-------------+       |<br>
> + *                  |   |             |         |   Partial   |<------+<br>
> + *                  |   |             |         |    Clear    |<----------+<br>
> + *                  |   |             |         +-------------+           |<br>
> + *                  |   |             |                |                  |<br>
> + *                  |   |             +------>---------+  Full            |<br>
> + *                  |   |                              | Resolve          |<br>
> + *   Draw w/ aux    |   |   Partial Fast Clear         |                  |<br>
> + *   +----------+   |   +--------------------------+   |                  |<br>
<br>
</div></div>I would have thought we go from "Resolved" to "Partial Clear" with<br>
"Partial Fast Clear"..<br><div><div class="h5"></div></div></blockquote><div><br></div><div>That gets a bit tricky.  The problem is that you have two orthogonal things: Clear blocks and non-clear blocs.  The way I've defined it, the non-clear blocks are in the pass-through state when you are in the partial clear state.  We could have defined it to be in the resolved state instead but, since this is only used for CCS_E, it made more sense to keep it as pass-through.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
> + *   |          |  \|/                             |  \|/                 |<br>
> + *   |       +-------------+    Full Resolve    +-------------+           |<br>
> + *   +------>| Compressed  |------------------->|  Resolved   |           |<br>
> + *           |  w/o Clear  |<-------------------|             |           |<br>
> + *           +-------------+    Draw w/ Aux     +-------------+           |<br>
> + *                 /|\                             |   |                  |<br>
> + *                  |  Draw                        |   |  Draw            |<br>
> + *                  | w/ Aux                       |   | w/o Aux          |<br>
> + *                  |            Ambiguate         |   |                  |<br>
> + *                  |   +--------------------------+   |                  |<br>
> + *   Draw w/o Aux   |   |                              |   Draw w/o Aux   |<br>
> + *   +----------+   |   |                              |   +----------+   |<br>
> + *   |          |   |  \|/                            \|/  |          |   |<br>
> + *   |       +-------------+     Ambiguate      +-------------+       |   |<br>
> + *   +------>|    Pass-    |<-------------------|     Aux     |<------+   |<br>
> + *   +------>|   through   |                    |   Invalid   |           |<br>
> + *   |       +-------------+                    +-------------+           |<br>
> + *   |          |   |                                                     |<br>
> + *   +----------+   +-----------------------------<wbr>------------------------+<br>
> + *     Draw w/                       Partial Fast Clear<br>
> + *    Clear Only<br>
>   *<br>
>   *<br>
>   * While the above general theory applies to all forms of auxiliary<br>
> @@ -742,7 +759,7 @@ enum isl_aux_usage {<br>
>   * CCS_D:   Single-sample fast-clears (also called CCS_D in ISL) are one of<br>
>   *          the simplest forms of compression since they don't do anything<br>
>   *          beyond clear color tracking.  They really only support three of<br>
> - *          the six states: Clear, Compressed w/ Clear, and Pass-through.  The<br>
> + *          the six states: Clear, Partial Clear, and Pass-through.  The<br>
>   *          only CCS_D operation is "Resolve" which maps to a full resolve<br>
>   *          followed by an ambiguate.<br>
>   *<br>
> @@ -762,6 +779,7 @@ enum isl_aux_usage {<br>
>   */<br>
>  enum isl_aux_state {<br>
>     ISL_AUX_STATE_CLEAR = 0,<br>
> +   ISL_AUX_STATE_PARTIAL_CLEAR,<br>
>     ISL_AUX_STATE_COMPRESSED_<wbr>CLEAR,<br>
>     ISL_AUX_STATE_COMPRESSED_NO_<wbr>CLEAR,<br>
>     ISL_AUX_STATE_RESOLVED,<br>
> diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c<br>
> index b284af9..91fcd0b 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>
> @@ -2181,6 +2181,7 @@ get_ccs_d_resolve_op(enum isl_aux_state aux_state,<br>
>     case ISL_AUX_STATE_PASS_THROUGH:<br>
>        return BLORP_FAST_CLEAR_OP_NONE;<br>
><br>
> +   case ISL_AUX_STATE_PARTIAL_CLEAR:<br>
>     case ISL_AUX_STATE_RESOLVED:<br>
>     case ISL_AUX_STATE_AUX_INVALID:<br>
>     case ISL_AUX_STATE_COMPRESSED_NO_<wbr>CLEAR:<br>
> @@ -2216,6 +2217,7 @@ get_ccs_e_resolve_op(enum isl_aux_state aux_state,<br>
>     case ISL_AUX_STATE_PASS_THROUGH:<br>
>        return BLORP_FAST_CLEAR_OP_NONE;<br>
><br>
> +   case ISL_AUX_STATE_PARTIAL_CLEAR:<br>
>     case ISL_AUX_STATE_RESOLVED:<br>
>     case ISL_AUX_STATE_AUX_INVALID:<br>
>        break;<br>
> @@ -2299,6 +2301,7 @@ intel_miptree_finish_ccs_<wbr>write(struct brw_context *brw,<br>
>           }<br>
>           break;<br>
><br>
> +      case ISL_AUX_STATE_PARTIAL_CLEAR:<br>
>        case ISL_AUX_STATE_RESOLVED:<br>
>        case ISL_AUX_STATE_AUX_INVALID:<br>
>           unreachable("Invalid aux state for CCS_E");<br>
> @@ -2321,6 +2324,7 @@ intel_miptree_finish_ccs_<wbr>write(struct brw_context *brw,<br>
>           /* Nothing to do */<br>
>           break;<br>
><br>
> +      case ISL_AUX_STATE_PARTIAL_CLEAR:<br>
>        case ISL_AUX_STATE_COMPRESSED_NO_<wbr>CLEAR:<br>
>        case ISL_AUX_STATE_RESOLVED:<br>
>        case ISL_AUX_STATE_AUX_INVALID:<br>
> @@ -2354,6 +2358,7 @@ intel_miptree_prepare_mcs_<wbr>access(struct brw_context *brw,<br>
>     case ISL_AUX_STATE_RESOLVED:<br>
>     case ISL_AUX_STATE_PASS_THROUGH:<br>
>     case ISL_AUX_STATE_AUX_INVALID:<br>
> +   case ISL_AUX_STATE_PARTIAL_CLEAR:<br>
>        unreachable("Invalid aux state for MCS");<br>
>     }<br>
>  }<br>
> @@ -2410,6 +2415,9 @@ intel_miptree_prepare_hiz_<wbr>access(struct brw_context *brw,<br>
>        if (hiz_supported)<br>
>           hiz_op = BLORP_HIZ_OP_HIZ_RESOLVE;<br>
>        break;<br>
> +<br>
> +   case ISL_AUX_STATE_PARTIAL_CLEAR:<br>
> +      unreachable("Invalid HiZ state");<br>
>     }<br>
><br>
>     if (hiz_op != BLORP_HIZ_OP_NONE) {<br>
> @@ -2471,6 +2479,9 @@ intel_miptree_finish_hiz_<wbr>write(struct brw_context *brw,<br>
>     case ISL_AUX_STATE_AUX_INVALID:<br>
>        assert(!written_with_hiz);<br>
>        break;<br>
> +<br>
> +   case ISL_AUX_STATE_PARTIAL_CLEAR:<br>
> +      unreachable("Invalid HiZ state");<br>
>     }<br>
>  }<br>
><br>
> --<br>
> 2.5.0.400.gff86faf<br>
><br>
</div></div>> ______________________________<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>
</blockquote></div><br></div></div>