From 39447cc8944a299e5f45d38c7c6505625a791892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 21 Apr 2021 21:31:49 -0400 Subject: [PATCH] gallium/u_threaded: track whether TCS, TES, or GS have ever been used to optimize buffer busyness tracking later Reviewed-By: Mike Blumenkrantz Reviewed-by: Rob Clark Part-of: --- .../auxiliary/util/u_threaded_context.c | 23 +++++++++++-------- .../auxiliary/util/u_threaded_context.h | 4 ++++ 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c index 9fe65f36470..222959cace7 100644 --- a/src/gallium/auxiliary/util/u_threaded_context.c +++ b/src/gallium/auxiliary/util/u_threaded_context.c @@ -382,7 +382,7 @@ threaded_context_unwrap_sync(struct pipe_context *pipe) * simple functions */ -#define TC_FUNC1(func, qualifier, type, deref, addr) \ +#define TC_FUNC1(func, qualifier, type, deref, addr, ...) \ struct tc_call_##func { \ struct tc_call_base base; \ type state; \ @@ -402,6 +402,7 @@ threaded_context_unwrap_sync(struct pipe_context *pipe) struct tc_call_##func *p = (struct tc_call_##func*) \ tc_add_call(tc, TC_CALL_##func, tc_call_##func); \ p->state = deref(param); \ + __VA_ARGS__; \ } TC_FUNC1(set_active_query_state, , bool, , ) @@ -634,25 +635,27 @@ tc_render_condition(struct pipe_context *_pipe, return pipe->create_##name##_state(pipe, state); \ } -#define TC_CSO_BIND(name) TC_FUNC1(bind_##name##_state, , void *, , ) +#define TC_CSO_BIND(name, ...) TC_FUNC1(bind_##name##_state, , void *, , , ##__VA_ARGS__) #define TC_CSO_DELETE(name) TC_FUNC1(delete_##name##_state, , void *, , ) -#define TC_CSO_WHOLE2(name, sname) \ +#define TC_CSO(name, sname, ...) \ TC_CSO_CREATE(name, sname) \ - TC_CSO_BIND(name) \ + TC_CSO_BIND(name, ##__VA_ARGS__) \ TC_CSO_DELETE(name) -#define TC_CSO_WHOLE(name) TC_CSO_WHOLE2(name, name) +#define TC_CSO_WHOLE(name) TC_CSO(name, name) +#define TC_CSO_SHADER(name) TC_CSO(name, shader) +#define TC_CSO_SHADER_TRACK(name) TC_CSO(name, shader, tc->seen_##name = true;) TC_CSO_WHOLE(blend) TC_CSO_WHOLE(rasterizer) TC_CSO_WHOLE(depth_stencil_alpha) TC_CSO_WHOLE(compute) -TC_CSO_WHOLE2(fs, shader) -TC_CSO_WHOLE2(vs, shader) -TC_CSO_WHOLE2(gs, shader) -TC_CSO_WHOLE2(tcs, shader) -TC_CSO_WHOLE2(tes, shader) +TC_CSO_SHADER(fs) +TC_CSO_SHADER(vs) +TC_CSO_SHADER_TRACK(gs) +TC_CSO_SHADER_TRACK(tcs) +TC_CSO_SHADER_TRACK(tes) TC_CSO_CREATE(sampler, sampler) TC_CSO_DELETE(sampler) TC_CSO_BIND(vertex_elements) diff --git a/src/gallium/auxiliary/util/u_threaded_context.h b/src/gallium/auxiliary/util/u_threaded_context.h index 073781b8296..dedfe7ecb89 100644 --- a/src/gallium/auxiliary/util/u_threaded_context.h +++ b/src/gallium/auxiliary/util/u_threaded_context.h @@ -401,6 +401,10 @@ struct threaded_context { thread_id driver_thread; #endif + bool seen_tcs; + bool seen_tes; + bool seen_gs; + unsigned last, next; /* The list fences that the driver should signal after the next flush.