From 30be8799a53ec6459553406be251309218963166 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Sun, 4 Apr 2021 13:09:59 -0400 Subject: [PATCH] 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 Part-of: --- src/gallium/drivers/zink/zink_context.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index a5b6f59..6110729 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) { -- 2.7.4