summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2021-04-04 13:09:59 -0400
committerMarge Bot <eric+marge@anholt.net>2021-05-05 02:46:06 +0000
commit30be8799a53ec6459553406be251309218963166 (patch)
tree04fcd75542988fc17143cd9ba848f82391a751f1
parent01c62fca0a951410b6b67c1727810b5a3836b092 (diff)
zink: add a ctx function for handling device lost resets
ensure the reset function is only called once when the screen flag is set Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10509>
-rw-r--r--src/gallium/drivers/zink/zink_context.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index a5b6f5999c1..61107298864 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -139,6 +139,17 @@ zink_context_destroy(struct pipe_context *pctx)
ralloc_free(ctx);
}
+static void
+check_device_lost(struct zink_context *ctx)
+{
+ if (!zink_screen(ctx->base.screen)->device_lost || ctx->is_device_lost)
+ return;
+ debug_printf("ZINK: device lost detected!\n");
+ if (ctx->reset.reset)
+ ctx->reset.reset(ctx->reset.data, PIPE_GUILTY_CONTEXT_RESET);
+ ctx->is_device_lost = true;
+}
+
static enum pipe_reset_status
zink_get_device_reset_status(struct pipe_context *pctx)
{