isl: Add a module which manages aux resolves
authorNanley Chery <nanley.g.chery@intel.com>
Thu, 21 Nov 2019 17:00:02 +0000 (09:00 -0800)
committerMarge Bot <eric+marge@anholt.net>
Mon, 24 Feb 2020 18:00:05 +0000 (18:00 +0000)
commit58d4749e5683857d57b8b432559c9d837544ad88
tree5f929fa9569213ba3ea63fffb900c694e98425bb
parentdaa4020948867cc2c9b38d7536a1b73bf79d2745
isl: Add a module which manages aux resolves

Provide a generic interface which manages aux resolves in ISL. The
feature differences between this and what's in iris is:
* Support for media compression. ISL_AUX_USAGE_MC behaves differently
  from many other usages of CCS, so it was useful to implement this
  support upfront, while designing the interfaces.
* Optimizations for full-surface writes. For example, after a
  full-surface write occurs with ISL_AUX_USAGE_CCS_E in the PARTIAL_CLEAR
  state, isl_aux_state_transition_write() returns COMPRESSED_NO_CLEAR
  instead of COMPRESSED_CLEAR.

A performance suggestion for main-surface-invalidating/replacing writes
is given as a comment instead of adding a boolean to
isl_aux_prepare_access(). This avoids extra validation and should be
simple enough for the caller to handle.

v2. Add assertions. (Jason)
v3. Use switches in 2 more functions. (Jason)
    Store aux metadata in a static table. (Jason)
    Change prepare and finish function signatures. (Jason)
    Keep isl_aux_state_transition_* functions separate.
v4. (Jason)
    Assert against resolving in AUX_INVALID.
    Rename aux_info struct to aux_usage_info.
    Drop the justification for each aux_usage_info field.
    Split out the NONE case in write function.
    Restructure tests to more easily confirm coverage.
    Rename access_compressed field to compressed.
    Make write behavior less ambiguous.
v5. (Jason)
    Add more detail above WRITES_RESOLVE_AMBIGUATE.
    Add ISL_AUX_USAGE_MC to WritesResolveAmbiguate.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2957>
src/intel/isl/isl.h
src/intel/isl/isl_aux_info.c [new file with mode: 0644]
src/intel/isl/meson.build
src/intel/isl/tests/isl_aux_info_test.cpp [new file with mode: 0644]