zink: only uncommit sparse pages that have been committed

avoid spamming drivers unnecessary with submits since this is expensive

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15716>
This commit is contained in:
Mike Blumenkrantz 2022-04-01 08:01:32 -04:00 committed by Marge Bot
parent 3dcb80da9d
commit b76ad3efa0

View file

@ -785,13 +785,8 @@ buffer_bo_commit(struct zink_screen *screen, struct zink_resource *res, uint32_t
}
}
} else {
if (!buffer_commit_single(screen, res, NULL,
(uint64_t)va_page * ZINK_SPARSE_BUFFER_PAGE_SIZE,
(uint64_t)(end_va_page - va_page) * ZINK_SPARSE_BUFFER_PAGE_SIZE, false)) {
ok = false;
goto out;
}
bool done = false;
uint32_t base_page = va_page;
while (va_page < end_va_page) {
struct zink_sparse_backing *backing;
uint32_t backing_start;
@ -803,6 +798,14 @@ buffer_bo_commit(struct zink_screen *screen, struct zink_resource *res, uint32_t
continue;
}
if (!done && !buffer_commit_single(screen, res, NULL,
(uint64_t)base_page * ZINK_SPARSE_BUFFER_PAGE_SIZE,
(uint64_t)(end_va_page - base_page) * ZINK_SPARSE_BUFFER_PAGE_SIZE, false)) {
ok = false;
goto out;
}
done = true;
/* Group contiguous spans of pages. */
backing = comm[va_page].backing;
backing_start = comm[va_page].page;