Module: Mesa
Branch: staging/23.3
Commit: 81ab4a3a01536495329d38d060734fc00ade77ea
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=81ab4a3a01536495329d38d060734fc00ade77ea

Author: Roman Stratiienko <r.stratiie...@gmail.com>
Date:   Thu Nov  9 23:27:46 2023 +0200

v3d: Don't implicitly clear the content of the imported buffer

v3d driver will implicitly clear the buffer's content on the first write
operation. This clearing operation is helpful for allocated buffers,
initializing them with zeros instead of having memory garbage.

Also, this avoids reading the buffer from the RAM to the GPU cache
before rendering, making the first write operation slightly faster.

The clearing operation should not happen for imported buffers where
the buffer may already contain valuable data and the user may want
to render into the buffer only partially.

Reviewed-by: Iago Toral Quiroga <ito...@igalia.com>
Signed-off-by: Roman Stratiienko <r.stratiie...@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26136>
(cherry picked from commit 56451ce773c11094a8c08fdc6b500bb8bdcf37e1)

---

 .pick_status.json                      | 2 +-
 src/gallium/drivers/v3d/v3d_resource.c | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 48fb97fdf8a..591188caac8 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -4,7 +4,7 @@
         "description": "v3d: Don't implicitly clear the content of the 
imported buffer",
         "nominated": false,
         "nomination_type": 3,
-        "resolution": 4,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null,
         "notes": null
diff --git a/src/gallium/drivers/v3d/v3d_resource.c 
b/src/gallium/drivers/v3d/v3d_resource.c
index d9a79614dd1..d4cccdb148d 100644
--- a/src/gallium/drivers/v3d/v3d_resource.c
+++ b/src/gallium/drivers/v3d/v3d_resource.c
@@ -1017,6 +1017,9 @@ v3d_resource_from_handle(struct pipe_screen *pscreen,
                 slice->stride = whandle->stride;
         }
 
+        /* Prevent implicit clearing of the imported buffer contents. */
+        rsc->writes = 1;
+
         return prsc;
 
 fail:

Reply via email to