tc: add non-definitive tracking for batch completion

this is useful as a hint for opportunistic optimizations

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25624>
This commit is contained in:
Mike Blumenkrantz 2023-10-04 10:46:21 -04:00 committed by Marge Bot
parent 782481c429
commit 6d236917a9
2 changed files with 6 additions and 0 deletions

View file

@ -474,6 +474,7 @@ tc_batch_execute(void *job, UNUSED void *gdata, int thread_index)
batch->last_mergeable_call = NULL;
batch->first_set_fb = false;
batch->max_renderpass_info_idx = 0;
batch->tc->last_completed = batch->batch_idx;
}
static void
@ -4991,11 +4992,13 @@ threaded_context_create(struct pipe_context *pipe,
if (!util_queue_init(&tc->queue, "gdrv", TC_MAX_BATCHES - 2, 1, 0, NULL))
goto fail;
tc->last_completed = -1;
for (unsigned i = 0; i < TC_MAX_BATCHES; i++) {
#if !defined(NDEBUG) && TC_DEBUG >= 1
tc->batch_slots[i].sentinel = TC_SENTINEL;
#endif
tc->batch_slots[i].tc = tc;
tc->batch_slots[i].batch_idx = i;
util_queue_fence_init(&tc->batch_slots[i].fence);
tc->batch_slots[i].renderpass_info_idx = -1;
if (tc->options.parse_renderpass_info) {

View file

@ -504,6 +504,7 @@ struct tc_batch {
struct util_queue_fence fence;
/* whether the first set_framebuffer_state call has been seen by this batch */
bool first_set_fb;
uint8_t batch_idx;
struct tc_unflushed_batch_token *token;
uint64_t slots[TC_SLOTS_PER_BATCH];
struct util_dynarray renderpass_infos;
@ -600,6 +601,8 @@ struct threaded_context {
bool seen_image_buffers[PIPE_SHADER_TYPES];
bool seen_sampler_buffers[PIPE_SHADER_TYPES];
int8_t last_completed;
unsigned max_vertex_buffers;
unsigned max_const_buffers;
unsigned max_shader_buffers;