From c84be162a1eb3375ea068facabe4257eb74a4181 Mon Sep 17 00:00:00 2001 From: "Juan A. Suarez Romero" Date: Thu, 5 Sep 2024 20:43:02 +0200 Subject: [PATCH] Revert "v3d: never replace a mapped bo" This reverts commit 0b85476d864b8894396b2b1c74da5889850bdc6e. 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 Signed-off-by: Juan A. Suarez Romero Part-of: --- src/broadcom/ci/traces-broadcom.yml | 1 + src/gallium/drivers/v3d/v3d_resource.c | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/broadcom/ci/traces-broadcom.yml b/src/broadcom/ci/traces-broadcom.yml index 3ed047b5eed..1ea5edc94ce 100644 --- a/src/broadcom/ci/traces-broadcom.yml +++ b/src/broadcom/ci/traces-broadcom.yml @@ -233,6 +233,7 @@ traces: label: [skip, timeout] checksum: 512c305e645e2ec62d94976d86f42f1b broadcom-rpi5: + label: [crash] checksum: 512c305e645e2ec62d94976d86f42f1b valve/portal-2-v2.trace: diff --git a/src/gallium/drivers/v3d/v3d_resource.c b/src/gallium/drivers/v3d/v3d_resource.c index c680962ac16..c14000040fc 100644 --- a/src/gallium/drivers/v3d/v3d_resource.c +++ b/src/gallium/drivers/v3d/v3d_resource.c @@ -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