zink: disable cpu_storage for PIPE_USAGE_STREAM

See 8af8dc97bc ("tc: do a GPU->CPU copy to initialize cpu_storage")

On zink, initializing cpu_storage that requires a GPU->CPU copy is
particularly expensive; in addition to a sync, the buffer_map call to
copy the GPU data submits a batch and has to wait for that batch.

Take the PIPE_USAGE_STREAM hint and disable using cpu_storage on
resources that "will be modified once and used at most a few times"
where the benefit of cpu_storage is outweighed by the heavy init time.

Signed-off-by: Juston Li <justonli@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29294>
This commit is contained in:
Juston Li
2024-05-20 13:32:34 -07:00
committed by Marge Bot
parent 01bac643f6
commit e1b4b399ce
+1
View File
@@ -1584,6 +1584,7 @@ resource_create(struct pipe_screen *pscreen,
res->base.b = *templ;
bool allow_cpu_storage = (templ->target == PIPE_BUFFER) &&
(templ->usage != PIPE_USAGE_STREAM) &&
(templ->width0 < 0x1000);
threaded_resource_init(&res->base.b, allow_cpu_storage);
pipe_reference_init(&res->base.b.reference, 1);