Module: Mesa Branch: main Commit: 56451ce773c11094a8c08fdc6b500bb8bdcf37e1 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=56451ce773c11094a8c08fdc6b500bb8bdcf37e1
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> --- src/gallium/drivers/v3d/v3d_resource.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gallium/drivers/v3d/v3d_resource.c b/src/gallium/drivers/v3d/v3d_resource.c index 4003ed722b5..7a4c461a46a 100644 --- a/src/gallium/drivers/v3d/v3d_resource.c +++ b/src/gallium/drivers/v3d/v3d_resource.c @@ -989,6 +989,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: