Mesa (master): gallium/u_threaded: skip refcounting only once

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 14 06:34:30 UTC 2021


Module: Mesa
Branch: master
Commit: 15e24850b77c373c97d4f4b654d67d28807a70a7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=15e24850b77c373c97d4f4b654d67d28807a70a7

Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Date:   Mon Apr 12 10:56:27 2021 +0200

gallium/u_threaded: skip refcounting only once

If info->take_index_buffer_ownership is true we can skip
refcounting but only for the first iteration of the loop.
The next iterations have to use tc_set_resource_reference.

Fixes: 363c1ef0c0e ("gallium/u_threaded: split draws that don't fit in a batch")
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10171>

---

 src/gallium/auxiliary/util/u_threaded_context.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c
index 058509f8f37..56cb4f0de2e 100644
--- a/src/gallium/auxiliary/util/u_threaded_context.c
+++ b/src/gallium/auxiliary/util/u_threaded_context.c
@@ -2601,6 +2601,7 @@ tc_draw_vbo(struct pipe_context *_pipe, const struct pipe_draw_info *info,
       }
    } else {
       int total_offset = 0;
+      bool take_index_buffer_ownership = info->take_index_buffer_ownership;
       while (num_draws) {
          struct tc_batch *next = &tc->batch_slots[tc->next];
 
@@ -2617,10 +2618,11 @@ tc_draw_vbo(struct pipe_context *_pipe, const struct pipe_draw_info *info,
          struct tc_draw_multi *p =
             tc_add_slot_based_call(tc, TC_CALL_draw_multi, tc_draw_multi,
                                    dr);
-         if (index_size && !info->take_index_buffer_ownership) {
+         if (index_size && !take_index_buffer_ownership) {
             tc_set_resource_reference(&p->info.index.resource,
                                       info->index.resource);
          }
+         take_index_buffer_ownership = false;
          memcpy(&p->info, info, DRAW_INFO_SIZE_WITHOUT_MIN_MAX_INDEX);
          p->num_draws = dr;
          memcpy(p->slot, &draws[total_offset], sizeof(draws[0]) * dr);



More information about the mesa-commit mailing list