Revert "v3d: never replace a mapped bo"

This reverts commit 0b85476d86.

When mapping a BO in v3d, the map keeps forever until freeing the BO. If
later the map is required again, we reuse the map instead of doing the
map from scratch.

This saves calling map/unmap continuously, as well as a mechanism to
keep control of the map usage, like a reference count.

Thus, when reallocating a BO, if it is mapped it just means the map was
used in the past, but not necessarily it is in use right now.

The reverted commit was causing performance regressions in multiple
applications, reducing from 60fps to 5fps.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11783
Backport-to: 24.2
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31049>
This commit is contained in:
Juan A. Suarez Romero 2024-09-05 20:43:02 +02:00 committed by Marge Bot
parent fed73edf16
commit c84be162a1
2 changed files with 1 additions and 4 deletions

View file

@ -233,6 +233,7 @@ traces:
label: [skip, timeout]
checksum: 512c305e645e2ec62d94976d86f42f1b
broadcom-rpi5:
label: [crash]
checksum: 512c305e645e2ec62d94976d86f42f1b
valve/portal-2-v2.trace:

View file

@ -101,10 +101,6 @@ v3d_resource_bo_alloc(struct v3d_resource *rsc)
struct pipe_screen *pscreen = prsc->screen;
struct v3d_bo *bo;
/* never replace a mapped bo */
if (rsc->bo && rsc->bo->map)
return false;
/* Buffers may be read using ldunifa, which prefetches the next
* 4 bytes after a read. If the buffer's size is exactly a multiple
* of a page size and the shader reads the last 4 bytes with ldunifa