summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/cso_cache
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2021-01-02 17:52:04 -0500
committerMarge Bot <eric+marge@anholt.net>2021-01-27 23:53:35 +0000
commite6da78e4ccf00ecd97ae83e799c20242f92b4c1b (patch)
tree21828dc7c67a5ce3dc13565ba29ac96bfec4e2b2 /src/gallium/auxiliary/cso_cache
parent104a41bd0743596f7eccadcef3a70a3d40c370d7 (diff)
gallium,u_threaded: add pipe_draw_info::take_index_buffer_ownership
to skip atomics in u_threaded_context. This will decrease CPU overhead. Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com> Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8298>
Diffstat (limited to 'src/gallium/auxiliary/cso_cache')
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index fc54dfc7be7..f10c61680e8 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -1435,9 +1435,14 @@ cso_multi_draw(struct cso_context *cso,
struct u_vbuf *vbuf = cso->vbuf_current;
if (vbuf) {
+ /* Increase refcount to be able to use take_index_buffer_ownership with
+ * all draws.
+ */
+ if (num_draws > 1 && info->take_index_buffer_ownership)
+ p_atomic_add(&info->index.resource->reference.count, num_draws - 1);
+
for (unsigned i = 0; i < num_draws; i++) {
- if (draws[i].count)
- u_vbuf_draw_vbo(vbuf, info, NULL, draws[i]);
+ u_vbuf_draw_vbo(vbuf, info, NULL, draws[i]);
if (info->increment_draw_id)
info->drawid++;