intel/aux_map: introduce ref count of L1 entries

To implement this feature, we need to do CPU side tracking of all
L3/L2/L1 entries. This does add a little bit of CPU allocations, but
the advantage is that the traversal of the page table tree is faster.
No more need for the linear seach of find_buffer().

With this feature, we can have multiple VkImage bind to the same main
memory address, as long as they share exact same mapping parameters.
The AUX mapping will be removed when the last VkImage is destroyed.

As previously, if the L1 mapping entry parameters don't match, the
mapping fails. Anv handles this nicely by just disabling AUX on the
image.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26335>
This commit is contained in:
Lionel Landwerlin
2023-11-23 10:11:05 +02:00
committed by Marge Bot
parent 02ef01fa95
commit 7c6faa1efe
2 changed files with 170 additions and 98 deletions

View File

@@ -110,12 +110,23 @@ intel_aux_map_get_entry(struct intel_aux_map_context *ctx,
uint64_t *aux_entry_address);
/* Fails if a mapping is attempted that would conflict with an existing one.
* This increase the refcount of the mapped region if already mapped, sets it
* to 1 otherwise.
*/
bool
intel_aux_map_add_mapping(struct intel_aux_map_context *ctx, uint64_t main_address,
uint64_t aux_address, uint64_t main_size_B,
uint64_t format_bits);
/* Decrease the refcount of a mapped region. When the refcount reaches 0, the
* region is unmapped.
*/
void
intel_aux_map_del_mapping(struct intel_aux_map_context *ctx, uint64_t main_address,
uint64_t size);
/* Unmaps a region, refcount is reset to 0.
*/
void
intel_aux_map_unmap_range(struct intel_aux_map_context *ctx, uint64_t main_address,
uint64_t size);