From 0432a546c366d0da58262eae5709878a6bc4f479 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 21 Jul 2021 11:40:30 -0700 Subject: [PATCH] vkr: check decoder status before decoding We do not want to call vn_dispatch_command on the first command, which checks the decoder status after decoding. But the main motivation is to silence all but the first "vkFoo resulted in CS error". Signed-off-by: Chia-I Wu Reviewed-by: Yiwei Zhang --- src/vkr_renderer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/vkr_renderer.c b/src/vkr_renderer.c index fdaed22..78d240b 100644 --- a/src/vkr_renderer.c +++ b/src/vkr_renderer.c @@ -4493,11 +4493,14 @@ vkr_context_submit_cmd(struct virgl_context *base, const void *buffer, size_t si mtx_lock(&ctx->mutex); + /* CS error is considered fatal (destroy the context?) */ + if (vkr_cs_decoder_get_fatal(&ctx->decoder)) + return EINVAL; + vkr_cs_decoder_set_stream(&ctx->decoder, buffer, size); while (vkr_cs_decoder_has_command(&ctx->decoder)) { vn_dispatch_command(&ctx->dispatch); - /* TODO consider the client malicious and disconnect it */ if (vkr_cs_decoder_get_fatal(&ctx->decoder)) { ret = EINVAL; break;