gallium/u_threaded: Get reset status without sync

GPU hangs are asynchronous already, there should not be an expectation
that this is synchronized with driver thread.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Mike Blumenkrantz <michael.blumenkrantz@gmail.com>

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13163>
This commit is contained in:
Rob Clark
2021-10-03 09:12:25 -07:00
committed by Marge Bot
parent 1a20cfb7d6
commit 75808934f8
8 changed files with 32 additions and 3 deletions
@@ -459,7 +459,7 @@ static struct pipe_context *noop_create_context(struct pipe_screen *screen,
noop_replace_buffer_storage,
noop_create_fence,
noop_is_resource_busy,
false, NULL);
false, false, NULL);
if (tc && tc != ctx)
threaded_context_init_bytes_mapped_limit((struct threaded_context *)tc, 4);
@@ -2592,7 +2592,6 @@ tc_texture_subdata(struct pipe_context *_pipe,
return pipe->func(pipe); \
}
TC_FUNC_SYNC_RET0(enum pipe_reset_status, get_device_reset_status)
TC_FUNC_SYNC_RET0(uint64_t, get_timestamp)
static void
@@ -2608,6 +2607,18 @@ tc_get_sample_position(struct pipe_context *_pipe,
out_value);
}
static enum pipe_reset_status
tc_get_device_reset_status(struct pipe_context *_pipe)
{
struct threaded_context *tc = threaded_context(_pipe);
struct pipe_context *pipe = tc->pipe;
if (!tc->unsynchronized_get_device_reset_status)
tc_sync(tc);
return pipe->get_device_reset_status(pipe);
}
static void
tc_set_device_reset_callback(struct pipe_context *_pipe,
const struct pipe_device_reset_callback *cb)
@@ -4181,6 +4192,9 @@ void tc_driver_internal_flush_notify(struct threaded_context *tc)
* \param driver_calls_flush_notify whether the driver calls
* tc_driver_internal_flush_notify after every
* driver flush
* \param unsynchronized_get_device_reset_status if true, get_device_reset_status()
* calls will not be synchronized with
* driver thread
* \param out if successful, the threaded_context will be returned here in
* addition to the return value if "out" != NULL
*/
@@ -4191,6 +4205,7 @@ threaded_context_create(struct pipe_context *pipe,
tc_create_fence_func create_fence,
tc_is_resource_busy is_resource_busy,
bool driver_calls_flush_notify,
bool unsynchronized_get_device_reset_status,
struct threaded_context **out)
{
struct threaded_context *tc;
@@ -4219,6 +4234,7 @@ threaded_context_create(struct pipe_context *pipe,
tc->create_fence = create_fence;
tc->is_resource_busy = is_resource_busy;
tc->driver_calls_flush_notify = driver_calls_flush_notify;
tc->unsynchronized_get_device_reset_status = unsynchronized_get_device_reset_status;
tc->map_buffer_alignment =
pipe->screen->get_param(pipe->screen, PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT);
tc->ubo_alignment =
@@ -430,6 +430,14 @@ struct threaded_context {
bool add_all_gfx_bindings_to_buffer_list;
bool add_all_compute_bindings_to_buffer_list;
/**
* If true, ctx->get_device_reset_status() will be called without
* synchronizing with driver thread. Drivers can enable this to avoid
* TC syncs if their implementation of get_device_reset_status() is
* safe to call without synchronizing with driver thread.
*/
bool unsynchronized_get_device_reset_status;
/* Estimation of how much vram/gtt bytes are mmap'd in
* the current tc_batch.
*/
@@ -500,6 +508,7 @@ threaded_context_create(struct pipe_context *pipe,
tc_create_fence_func create_fence,
tc_is_resource_busy is_resource_busy,
bool driver_calls_flush_notify,
bool unsynchronized_get_device_reset_status,
struct threaded_context **out);
void
@@ -327,6 +327,7 @@ crocus_create_context(struct pipe_screen *pscreen, void *priv, unsigned flags)
NULL, /* TODO: asynchronous flushes? */
NULL,
false,
false,
&ice->thrctx);
}
@@ -701,6 +701,7 @@ fd_context_init_tc(struct pipe_context *pctx, unsigned flags)
fd_fence_create_unflushed,
fd_resource_busy,
false,
false,
&ctx->tc);
if (tc && tc != pctx)
+1
View File
@@ -381,5 +381,6 @@ iris_create_context(struct pipe_screen *pscreen, void *priv, unsigned flags)
NULL, /* TODO: asynchronous flushes? */
NULL,
false,
false,
&ice->thrctx);
}
+1
View File
@@ -839,6 +839,7 @@ static struct pipe_context *si_pipe_create_context(struct pipe_screen *screen, v
sscreen->info.is_amdgpu ? si_create_fence : NULL,
si_is_resource_busy,
true,
false,
&((struct si_context *)ctx)->tc);
if (tc && tc != ctx)
+1 -1
View File
@@ -4215,7 +4215,7 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
struct threaded_context *tc = (struct threaded_context*)threaded_context_create(&ctx->base, &screen->transfer_pool,
zink_context_replace_buffer_storage,
zink_create_tc_fence_for_tc,
zink_context_is_resource_busy, true, &ctx->tc);
zink_context_is_resource_busy, true, false, &ctx->tc);
if (tc && (struct zink_context*)tc != ctx) {
threaded_context_init_bytes_mapped_limit(tc, 4);