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 <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
macos/master
Chia-I Wu 3 years ago
parent 9f6329a0b0
commit 0432a546c3
  1. 5
      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); 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); vkr_cs_decoder_set_stream(&ctx->decoder, buffer, size);
while (vkr_cs_decoder_has_command(&ctx->decoder)) { while (vkr_cs_decoder_has_command(&ctx->decoder)) {
vn_dispatch_command(&ctx->dispatch); vn_dispatch_command(&ctx->dispatch);
/* TODO consider the client malicious and disconnect it */
if (vkr_cs_decoder_get_fatal(&ctx->decoder)) { if (vkr_cs_decoder_get_fatal(&ctx->decoder)) {
ret = EINVAL; ret = EINVAL;
break; break;

Loading…
Cancel
Save