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 <itoral@igalia.com>
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26136>
This commit is contained in:
Roman Stratiienko 2023-11-09 23:27:46 +02:00 committed by Marge Bot
parent 656afd8ede
commit 56451ce773

View file

@ -989,6 +989,9 @@ v3d_resource_from_handle(struct pipe_screen *pscreen,
slice->stride = whandle->stride; slice->stride = whandle->stride;
} }
/* Prevent implicit clearing of the imported buffer contents. */
rsc->writes = 1;
return prsc; return prsc;
fail: fail: