Mesa (staging/22.1): gallium/u_threaded: fix buffer busyness tracking
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jun 15 16:22:55 UTC 2022
Module: Mesa
Branch: staging/22.1
Commit: 44038d6a183ffc4966f732570f80c0247f125f95
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=44038d6a183ffc4966f732570f80c0247f125f95
Author: Marek Olšák <marek.olsak at amd.com>
Date: Sat Jun 11 06:58:56 2022 -0400
gallium/u_threaded: fix buffer busyness tracking
The order of calls was incorrect.
Fixes: e9c41b321488c23b - gallium/u_threaded: add buffer lists - tracking of buffers referenced by tc
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5327
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Reviewed-By: Jonathan Strobl <jonathan.strobl at gmx.de>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16989>
(cherry picked from commit 4c5f7b86eccf9ebfb6e546f2e039effa64370128)
---
.pick_status.json | 2 +-
src/gallium/auxiliary/util/u_threaded_context.c | 35 ++++++++++++++++++-------
2 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 0c7fbf5b561..b2964418561 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1696,7 +1696,7 @@
"description": "gallium/u_threaded: fix buffer busyness tracking",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": "e9c41b321488c23b7d8ec5744f68218bac753505"
},
diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c
index de1ead7eabd..b12140923a1 100644
--- a/src/gallium/auxiliary/util/u_threaded_context.c
+++ b/src/gallium/auxiliary/util/u_threaded_context.c
@@ -3227,9 +3227,6 @@ tc_draw_vbo(struct pipe_context *_pipe, const struct pipe_draw_info *info,
unsigned index_size = info->index_size;
bool has_user_indices = info->has_user_indices;
- if (unlikely(tc->add_all_gfx_bindings_to_buffer_list))
- tc_add_all_gfx_bindings_to_buffer_list(tc);
-
if (unlikely(indirect)) {
assert(!has_user_indices);
assert(num_draws == 1);
@@ -3263,6 +3260,10 @@ tc_draw_vbo(struct pipe_context *_pipe, const struct pipe_draw_info *info,
memcpy(&p->indirect, indirect, sizeof(*indirect));
p->draw.start = draws[0].start;
+
+ /* This must be after tc_add_call, which can flush the batch. */
+ if (unlikely(tc->add_all_gfx_bindings_to_buffer_list))
+ tc_add_all_gfx_bindings_to_buffer_list(tc);
return;
}
@@ -3317,6 +3318,10 @@ tc_draw_vbo(struct pipe_context *_pipe, const struct pipe_draw_info *info,
p->info.max_index = draws[0].count;
p->index_bias = draws[0].index_bias;
}
+
+ /* This must be after tc_add_call, which can flush the batch. */
+ if (unlikely(tc->add_all_gfx_bindings_to_buffer_list))
+ tc_add_all_gfx_bindings_to_buffer_list(tc);
return;
}
@@ -3429,6 +3434,10 @@ tc_draw_vbo(struct pipe_context *_pipe, const struct pipe_draw_info *info,
total_offset += dr;
}
}
+
+ /* This must be after tc_add_*call, which can flush the batch. */
+ if (unlikely(tc->add_all_gfx_bindings_to_buffer_list))
+ tc_add_all_gfx_bindings_to_buffer_list(tc);
}
struct tc_draw_vstate_single {
@@ -3527,9 +3536,6 @@ tc_draw_vertex_state(struct pipe_context *_pipe,
{
struct threaded_context *tc = threaded_context(_pipe);
- if (unlikely(tc->add_all_gfx_bindings_to_buffer_list))
- tc_add_all_gfx_bindings_to_buffer_list(tc);
-
if (num_draws == 1) {
/* Single draw. */
struct tc_draw_vstate_single *p =
@@ -3548,6 +3554,11 @@ tc_draw_vertex_state(struct pipe_context *_pipe,
tc_set_vertex_state_reference(&p->state, state);
else
p->state = state;
+
+
+ /* This must be after tc_add_*call, which can flush the batch. */
+ if (unlikely(tc->add_all_gfx_bindings_to_buffer_list))
+ tc_add_all_gfx_bindings_to_buffer_list(tc);
return;
}
@@ -3589,6 +3600,11 @@ tc_draw_vertex_state(struct pipe_context *_pipe,
total_offset += dr;
}
+
+
+ /* This must be after tc_add_*call, which can flush the batch. */
+ if (unlikely(tc->add_all_gfx_bindings_to_buffer_list))
+ tc_add_all_gfx_bindings_to_buffer_list(tc);
}
struct tc_launch_grid_call {
@@ -3615,14 +3631,15 @@ tc_launch_grid(struct pipe_context *_pipe,
tc_launch_grid_call);
assert(info->input == NULL);
- if (unlikely(tc->add_all_compute_bindings_to_buffer_list))
- tc_add_all_compute_bindings_to_buffer_list(tc);
-
tc_set_resource_reference(&p->info.indirect, info->indirect);
memcpy(&p->info, info, sizeof(*info));
if (info->indirect)
tc_add_to_buffer_list(&tc->buffer_lists[tc->next_buf_list], info->indirect);
+
+ /* This must be after tc_add_*call, which can flush the batch. */
+ if (unlikely(tc->add_all_compute_bindings_to_buffer_list))
+ tc_add_all_compute_bindings_to_buffer_list(tc);
}
static uint16_t
More information about the mesa-commit
mailing list