From 438ede3ca34ba92d03d3db45a60ede251981a513 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 16 Oct 2019 17:09:29 -0400 Subject: [PATCH] radeonsi: call the reset callback if get_device_reset_status returns a failure Reviewed-by: Pierre-Eric Pelloux-Prayer --- src/gallium/drivers/radeonsi/si_gfx_cs.c | 2 +- src/gallium/drivers/radeonsi/si_pipe.c | 22 ++++++---------------- src/gallium/drivers/radeonsi/si_pipe.h | 3 --- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_gfx_cs.c b/src/gallium/drivers/radeonsi/si_gfx_cs.c index 5df6e080792..48bb259339f 100644 --- a/src/gallium/drivers/radeonsi/si_gfx_cs.c +++ b/src/gallium/drivers/radeonsi/si_gfx_cs.c @@ -97,7 +97,7 @@ void si_flush_gfx_cs(struct si_context *ctx, unsigned flags, (!wait_flags || !ctx->gfx_last_ib_is_busy)) return; - if (si_check_device_reset(ctx)) + if (ctx->b.get_device_reset_status(&ctx->b) != PIPE_NO_RESET) return; if (ctx->screen->debug_flags & DBG(CHECK_VM)) diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index 39a4e7bf2b7..9ca64b05d63 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -312,8 +312,13 @@ static void si_destroy_context(struct pipe_context *context) static enum pipe_reset_status si_get_reset_status(struct pipe_context *ctx) { struct si_context *sctx = (struct si_context *)ctx; + enum pipe_reset_status status = sctx->ws->ctx_query_reset_status(sctx->ctx); - return sctx->ws->ctx_query_reset_status(sctx->ctx); + if (status != PIPE_NO_RESET && sctx->device_reset_callback.reset) { + sctx->device_reset_callback.reset(sctx->device_reset_callback.data, + status); + } + return status; } static void si_set_device_reset_callback(struct pipe_context *ctx, @@ -328,21 +333,6 @@ static void si_set_device_reset_callback(struct pipe_context *ctx, sizeof(sctx->device_reset_callback)); } -bool si_check_device_reset(struct si_context *sctx) -{ - enum pipe_reset_status status; - - if (!sctx->device_reset_callback.reset) - return false; - - status = sctx->ws->ctx_query_reset_status(sctx->ctx); - if (status == PIPE_NO_RESET) - return false; - - sctx->device_reset_callback.reset(sctx->device_reset_callback.data, status); - return true; -} - /* Apitrace profiling: * 1) qapitrace : Tools -> Profile: Measure CPU & GPU times * 2) In the middle panel, zoom in (mouse wheel) on some bad draw call diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index 8c805ce10e8..1a65c309e25 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -1430,9 +1430,6 @@ void si_initialize_prim_discard_tunables(struct si_context *sctx); void si_init_perfcounters(struct si_screen *screen); void si_destroy_perfcounters(struct si_screen *screen); -/* si_pipe.c */ -bool si_check_device_reset(struct si_context *sctx); - /* si_query.c */ void si_init_screen_query_functions(struct si_screen *sscreen); void si_init_query_functions(struct si_context *sctx); -- 2.30.2