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>
This commit is contained in:
Mike Blumenkrantz
2021-04-04 13:09:59 -04:00
committed by Marge Bot
parent 01c62fca0a
commit 30be8799a5
+11
View File
@@ -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)
{