gallium/u_threaded: late alloc cpu_storage
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Fri, 18 Feb 2022 09:28:58 +0000 (10:28 +0100)
committerPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Mon, 7 Mar 2022 13:51:15 +0000 (14:51 +0100)
commitcd0ef9b3f420bc0ee70a16f720786b174e78bb78
tree89ab870c36278e2ed71a52f756e009ba74da4af5
parent7070178dfd0d36e94a7061fe2eccd0ac0c6ca7ee
gallium/u_threaded: late alloc cpu_storage

Instead of allocating cpu_storage in threaded_resource_init, defer the
allocation to first use (in tc_buffer_map).
This avoids needless memory allocation if tc_buffer_disable_cpu_storage is
called before tc_buffer_map.

map_buffer_alignment is stored and serves as a "can cpu_storage be used" flag.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15074>
src/gallium/auxiliary/driver_noop/noop_pipe.c
src/gallium/auxiliary/util/u_threaded_context.c
src/gallium/auxiliary/util/u_threaded_context.h
src/gallium/drivers/crocus/crocus_resource.c
src/gallium/drivers/d3d12/d3d12_resource.cpp
src/gallium/drivers/freedreno/freedreno_resource.c
src/gallium/drivers/iris/iris_resource.c
src/gallium/drivers/r600/r600_buffer_common.c
src/gallium/drivers/radeonsi/si_buffer.c
src/gallium/drivers/zink/zink_resource.c