From 0b85476d864b8894396b2b1c74da5889850bdc6e Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Wed, 12 Jun 2024 21:59:19 +0200 Subject: [PATCH] v3d: never replace a mapped bo The application might have a pointer into the mapped bo. Reviewed-by: Iago Toral Quiroga Part-of: --- src/gallium/drivers/v3d/v3d_resource.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gallium/drivers/v3d/v3d_resource.c b/src/gallium/drivers/v3d/v3d_resource.c index 1b806dfb089..8a11c5650e7 100644 --- a/src/gallium/drivers/v3d/v3d_resource.c +++ b/src/gallium/drivers/v3d/v3d_resource.c @@ -101,6 +101,10 @@ 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