[Mesa-dev] [PATCH 20/32] intel/isl: Add an aux state for "partial clear"

Pohjolainen, Topi topi.pohjolainen at gmail.com
Fri Jul 21 19:51:43 UTC 2017


On Wed, Jul 19, 2017 at 02:01:46PM -0700, Jason Ekstrand wrote:
> ---
>  src/intel/isl/isl.h                           | 88 ++++++++++++++++-----------
>  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 11 ++++
>  2 files changed, 64 insertions(+), 35 deletions(-)
> 
> diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h
> index d81df31..68bfcee 100644
> --- a/src/intel/isl/isl.h
> +++ b/src/intel/isl/isl.h
> @@ -618,7 +618,11 @@ enum isl_aux_usage {
>   *       color by simply changing the clear color without modifying either
>   *       surface.
>   *
> - *    2) Compressed w/ Clear:  In this state, neither the auxiliary surface
> + *    2) Partial Clear:  In this state, each block in the auxiliary surface
> + *       contains either the magic clear or pass-through value.  See Clear and
> + *       Pass-through for more details.
> + *
> + *    3) Compressed w/ Clear:  In this state, neither the auxiliary surface
>   *       nor the primary surface has a complete representation of the data.
>   *       Instead, both surfaces must be used together or else rendering
>   *       corruption may occur.  Depending on the auxiliary compression format
> @@ -627,19 +631,19 @@ enum isl_aux_usage {
>   *       values.  Blocks may also be in the clear state (see Clear) and have
>   *       their value taken from outside the surface.
>   *
> - *    3) Compressed w/o Clear:  This state is identical to the state above
> + *    4) Compressed w/o Clear:  This state is identical to the state above
>   *       except that no blocks are in the clear state.  In this state, all of
>   *       the data required to reconstruct the final sample values is contained
>   *       in the auxiliary and primary surface and the clear value is not
>   *       considered.
>   *
> - *    4) Resolved:  In this state, the primary surface contains 100% of the
> + *    5) Resolved:  In this state, the primary surface contains 100% of the
>   *       data.  The auxiliary surface is also valid so the surface can be
>   *       validly used with or without aux enabled.  The auxiliary surface may,
>   *       however, contain non-trivial data and any update to the primary
>   *       surface with aux disabled will cause the two to get out of sync.
>   *
> - *    5) Pass-through:  In this state, the primary surface contains 100% of the
> + *    6) Pass-through:  In this state, the primary surface contains 100% of the
>   *       data and every block in the auxiliary surface contains a magic value
>   *       which indicates that the auxiliary surface should be ignored and the
>   *       only the primary surface should be considered.  Updating the primary
> @@ -648,7 +652,7 @@ enum isl_aux_usage {
>   *       cause the auxiliary buffer to contain non-trivial data and no longer
>   *       be in the pass-through state.
>   *
> - *    5) Aux Invalid:  In this state, the primary surface contains 100% of the
> + *    7) Aux Invalid:  In this state, the primary surface contains 100% of the
>   *       data and the auxiliary surface is completely bogus.  Any attempt to
>   *       use the auxiliary surface is liable to result in rendering
>   *       corruption.  The only thing that one can do to re-enable aux once
> @@ -662,7 +666,8 @@ enum isl_aux_usage {
>   *    1) Fast Clear:  This operation writes the magic "clear" value to the
>   *       auxiliary surface.  This operation will safely transition any slice
>   *       of a surface from any state to the clear state so long as the entire
> - *       slice is fast cleared at once.
> + *       slice is fast cleared at once.  A fast clear that only covers part of
> + *       a slice of a surface is called a partial fast clear.
>   *
>   *    2) Full Resolve:  This operation combines the auxiliary surface data
>   *       with the primary surface data and writes the result to the primary.
> @@ -689,34 +694,46 @@ enum isl_aux_usage {
>   *   Draw w/ Aux
>   *   +----------+
>   *   |          |
> - *   |       +-------------+     Draw w/ Aux      +-------------+
> - *   +------>| Compressed  |<---------------------|    Clear    |
> - *           |  w/ Clear   |                      |             |
> - *           +-------------+                      +-------------+
> - *                  |   |                                |
> - *          Partial |   |                                |
> - *          Resolve |   |        Full Resolve            |
> - *                  |   +----------------------------+   |  Full
> - *                  |                                |   | Resolve
> - *   Draw w/ aux    |                                |   |
> - *   +----------+   |                                |   |
> - *   |          |  \|/                              \|/ \|/
> - *   |       +-------------+     Full Resolve     +-------------+
> - *   +------>| Compressed  |--------------------->|  Resolved   |
> - *           |  w/o Clear  |<---------------------|             |
> - *           +-------------+     Draw w/ Aux      +-------------+
> - *                 /|\                               |   |
> - *                  |  Draw                          |   |  Draw
> - *                  | w/ Aux                         |   | w/o Aux
> - *                  |             Ambiguate          |   |
> - *                  |   +----------------------------+   |
> - *   Draw w/o Aux   |   |                                |   Draw w/o Aux
> - *   +----------+   |   |                                |   +----------+
> - *   |          |   |  \|/                              \|/  |          |
> - *   |       +-------------+      Ambiguate       +-------------+       |
> - *   +------>|    Pass-    |<---------------------|     Aux     |<------+
> - *           |   through   |                      |   Invalid   |
> - *           +-------------+                      +-------------+
> + *   |       +-------------+    Draw w/ Aux     +-------------+
> + *   +------>| Compressed  |<-------------------|    Clear    |
> + *           |  w/ Clear   |----->----+         |             |
> + *           +-------------+          |         +-------------+
> + *                  |  /|\            |            |   |
> + *                  |   |             |            |   |
> + *                  |   |             +------<-----+   |  Draw w/
> + *                  |   |             |                | Clear Only
> + *                  |   |      Full   |                |   +----------+
> + *          Partial |   |     Resolve |               \|/  |          |
> + *          Resolve |   |             |         +-------------+       |
> + *                  |   |             |         |   Partial   |<------+
> + *                  |   |             |         |    Clear    |<----------+
> + *                  |   |             |         +-------------+           |
> + *                  |   |             |                |                  |
> + *                  |   |             +------>---------+  Full            |
> + *                  |   |                              | Resolve          |
> + *   Draw w/ aux    |   |   Partial Fast Clear         |                  |
> + *   +----------+   |   +--------------------------+   |                  |

I would have thought we go from "Resolved" to "Partial Clear" with
"Partial Fast Clear"..

> + *   |          |  \|/                             |  \|/                 |
> + *   |       +-------------+    Full Resolve    +-------------+           |
> + *   +------>| Compressed  |------------------->|  Resolved   |           |
> + *           |  w/o Clear  |<-------------------|             |           |
> + *           +-------------+    Draw w/ Aux     +-------------+           |
> + *                 /|\                             |   |                  |
> + *                  |  Draw                        |   |  Draw            |
> + *                  | w/ Aux                       |   | w/o Aux          |
> + *                  |            Ambiguate         |   |                  |
> + *                  |   +--------------------------+   |                  |
> + *   Draw w/o Aux   |   |                              |   Draw w/o Aux   |
> + *   +----------+   |   |                              |   +----------+   |
> + *   |          |   |  \|/                            \|/  |          |   |
> + *   |       +-------------+     Ambiguate      +-------------+       |   |
> + *   +------>|    Pass-    |<-------------------|     Aux     |<------+   |
> + *   +------>|   through   |                    |   Invalid   |           |
> + *   |       +-------------+                    +-------------+           |
> + *   |          |   |                                                     |
> + *   +----------+   +-----------------------------------------------------+
> + *     Draw w/                       Partial Fast Clear
> + *    Clear Only
>   *
>   *
>   * While the above general theory applies to all forms of auxiliary
> @@ -742,7 +759,7 @@ enum isl_aux_usage {
>   * CCS_D:   Single-sample fast-clears (also called CCS_D in ISL) are one of
>   *          the simplest forms of compression since they don't do anything
>   *          beyond clear color tracking.  They really only support three of
> - *          the six states: Clear, Compressed w/ Clear, and Pass-through.  The
> + *          the six states: Clear, Partial Clear, and Pass-through.  The
>   *          only CCS_D operation is "Resolve" which maps to a full resolve
>   *          followed by an ambiguate.
>   *
> @@ -762,6 +779,7 @@ enum isl_aux_usage {
>   */
>  enum isl_aux_state {
>     ISL_AUX_STATE_CLEAR = 0,
> +   ISL_AUX_STATE_PARTIAL_CLEAR,
>     ISL_AUX_STATE_COMPRESSED_CLEAR,
>     ISL_AUX_STATE_COMPRESSED_NO_CLEAR,
>     ISL_AUX_STATE_RESOLVED,
> diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> index b284af9..91fcd0b 100644
> --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> @@ -2181,6 +2181,7 @@ get_ccs_d_resolve_op(enum isl_aux_state aux_state,
>     case ISL_AUX_STATE_PASS_THROUGH:
>        return BLORP_FAST_CLEAR_OP_NONE;
>  
> +   case ISL_AUX_STATE_PARTIAL_CLEAR:
>     case ISL_AUX_STATE_RESOLVED:
>     case ISL_AUX_STATE_AUX_INVALID:
>     case ISL_AUX_STATE_COMPRESSED_NO_CLEAR:
> @@ -2216,6 +2217,7 @@ get_ccs_e_resolve_op(enum isl_aux_state aux_state,
>     case ISL_AUX_STATE_PASS_THROUGH:
>        return BLORP_FAST_CLEAR_OP_NONE;
>  
> +   case ISL_AUX_STATE_PARTIAL_CLEAR:
>     case ISL_AUX_STATE_RESOLVED:
>     case ISL_AUX_STATE_AUX_INVALID:
>        break;
> @@ -2299,6 +2301,7 @@ intel_miptree_finish_ccs_write(struct brw_context *brw,
>           }
>           break;
>  
> +      case ISL_AUX_STATE_PARTIAL_CLEAR:
>        case ISL_AUX_STATE_RESOLVED:
>        case ISL_AUX_STATE_AUX_INVALID:
>           unreachable("Invalid aux state for CCS_E");
> @@ -2321,6 +2324,7 @@ intel_miptree_finish_ccs_write(struct brw_context *brw,
>           /* Nothing to do */
>           break;
>  
> +      case ISL_AUX_STATE_PARTIAL_CLEAR:
>        case ISL_AUX_STATE_COMPRESSED_NO_CLEAR:
>        case ISL_AUX_STATE_RESOLVED:
>        case ISL_AUX_STATE_AUX_INVALID:
> @@ -2354,6 +2358,7 @@ intel_miptree_prepare_mcs_access(struct brw_context *brw,
>     case ISL_AUX_STATE_RESOLVED:
>     case ISL_AUX_STATE_PASS_THROUGH:
>     case ISL_AUX_STATE_AUX_INVALID:
> +   case ISL_AUX_STATE_PARTIAL_CLEAR:
>        unreachable("Invalid aux state for MCS");
>     }
>  }
> @@ -2410,6 +2415,9 @@ intel_miptree_prepare_hiz_access(struct brw_context *brw,
>        if (hiz_supported)
>           hiz_op = BLORP_HIZ_OP_HIZ_RESOLVE;
>        break;
> +
> +   case ISL_AUX_STATE_PARTIAL_CLEAR:
> +      unreachable("Invalid HiZ state");
>     }
>  
>     if (hiz_op != BLORP_HIZ_OP_NONE) {
> @@ -2471,6 +2479,9 @@ intel_miptree_finish_hiz_write(struct brw_context *brw,
>     case ISL_AUX_STATE_AUX_INVALID:
>        assert(!written_with_hiz);
>        break;
> +
> +   case ISL_AUX_STATE_PARTIAL_CLEAR:
> +      unreachable("Invalid HiZ state");
>     }
>  }
>  
> -- 
> 2.5.0.400.gff86faf
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list