From 56451ce773c11094a8c08fdc6b500bb8bdcf37e1 Mon Sep 17 00:00:00 2001 From: Roman Stratiienko Date: Thu, 9 Nov 2023 23:27:46 +0200 Subject: [PATCH] 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 Signed-off-by: Roman Stratiienko Part-of: --- 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: