From e06c332bf77ed7ec0b37a58f644e0f4e0c06fbee Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Fri, 23 Sep 2022 12:15:36 +0200 Subject: [PATCH] tc: don't use CPU storage for glBufferData This fixes a performance regression with yquake2 cause by the enablement of cpu_storage by default for radeonsi in a5a8e197413. Fixes: a5a8e197413 ("radeonsi: enable tc cpu_storage by default") Reviewed-by: Rob Clark Part-of: --- src/gallium/auxiliary/util/u_threaded_context.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c index e60da586810..433b31b07b3 100644 --- a/src/gallium/auxiliary/util/u_threaded_context.c +++ b/src/gallium/auxiliary/util/u_threaded_context.c @@ -2731,6 +2731,12 @@ tc_buffer_subdata(struct pipe_context *_pipe, u_box_1d(offset, size, &box); + /* CPU storage is only useful for partial updates. It can add overhead + * on glBufferData calls so avoid using it. + */ + if (!tres->cpu_storage && offset == 0 && size == resource->width0) + usage |= TC_TRANSFER_MAP_UPLOAD_CPU_STORAGE; + map = tc_buffer_map(_pipe, resource, 0, usage, &box, &transfer); if (map) { memcpy(map, data, size);