venus: log some fatal errors

Log fatal errors internally generated by vkr_cs.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
macos/master
Chia-I Wu 3 years ago
parent 6117a1bc7b
commit 7c97b7b26c
  1. 1
      src/venus/vkr_common.h
  2. 3
      src/venus/vkr_cs.c
  3. 9
      src/venus/vkr_cs.h

@ -10,6 +10,7 @@
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <inttypes.h>
#include <stdatomic.h> #include <stdatomic.h>
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h> #include <stddef.h>

@ -99,6 +99,7 @@ vkr_cs_encoder_seek_stream(struct vkr_cs_encoder *enc, size_t pos)
size_t iov_offset; size_t iov_offset;
if (pos > enc->stream.size || if (pos > enc->stream.size ||
!vkr_cs_encoder_translate_stream_offset(enc, offset, &iov_index, &iov_offset)) { !vkr_cs_encoder_translate_stream_offset(enc, offset, &iov_index, &iov_offset)) {
vkr_log("failed to seek the reply stream to %zu", pos);
vkr_cs_encoder_set_fatal(enc); vkr_cs_encoder_set_fatal(enc);
return; return;
} }
@ -158,6 +159,7 @@ vkr_cs_encoder_write_internal(struct vkr_cs_encoder *enc,
size_t ptr_size; size_t ptr_size;
uint8_t *ptr = vkr_cs_encoder_get_ptr(enc, val_size, &ptr_size); uint8_t *ptr = vkr_cs_encoder_get_ptr(enc, val_size, &ptr_size);
if (unlikely(!ptr)) { if (unlikely(!ptr)) {
vkr_log("failed to write value to the reply stream");
vkr_cs_encoder_set_fatal(enc); vkr_cs_encoder_set_fatal(enc);
return; return;
} }
@ -171,6 +173,7 @@ vkr_cs_encoder_write_internal(struct vkr_cs_encoder *enc,
size_t ptr_size; size_t ptr_size;
const void *ptr = vkr_cs_encoder_get_ptr(enc, pad_size, &ptr_size); const void *ptr = vkr_cs_encoder_get_ptr(enc, pad_size, &ptr_size);
if (unlikely(!ptr)) { if (unlikely(!ptr)) {
vkr_log("failed to write padding to the reply stream");
vkr_cs_encoder_set_fatal(enc); vkr_cs_encoder_set_fatal(enc);
return; return;
} }

@ -160,6 +160,7 @@ vkr_cs_decoder_peek_internal(const struct vkr_cs_decoder *dec,
assert(val_size <= size); assert(val_size <= size);
if (unlikely(size > (size_t)(dec->end - dec->cur))) { if (unlikely(size > (size_t)(dec->end - dec->cur))) {
vkr_log("failed to peek %zu bytes", size);
vkr_cs_decoder_set_fatal(dec); vkr_cs_decoder_set_fatal(dec);
memset(val, 0, val_size); memset(val, 0, val_size);
return false; return false;
@ -199,8 +200,13 @@ vkr_cs_decoder_lookup_object(const struct vkr_cs_decoder *dec,
const struct hash_entry *entry = const struct hash_entry *entry =
_mesa_hash_table_search((struct hash_table *)dec->object_table, &id); _mesa_hash_table_search((struct hash_table *)dec->object_table, &id);
obj = likely(entry) ? entry->data : NULL; obj = likely(entry) ? entry->data : NULL;
if (!obj || obj->type != type) if (unlikely(!obj || obj->type != type)) {
if (obj)
vkr_log("object " PRIu64 " has type %d, not %d", id, obj->type, type);
else
vkr_log("failed to look up object " PRIu64, id);
vkr_cs_decoder_set_fatal(dec); vkr_cs_decoder_set_fatal(dec);
}
return obj; return obj;
} }
@ -222,6 +228,7 @@ vkr_cs_decoder_alloc_temp(struct vkr_cs_decoder *dec, size_t size)
if (unlikely(size > (size_t)(pool->end - pool->cur))) { if (unlikely(size > (size_t)(pool->end - pool->cur))) {
if (!vkr_cs_decoder_alloc_temp_internal(dec, size)) { if (!vkr_cs_decoder_alloc_temp_internal(dec, size)) {
vkr_log("failed to suballocate %zu bytes from the temp pool", size);
vkr_cs_decoder_set_fatal(dec); vkr_cs_decoder_set_fatal(dec);
return NULL; return NULL;
} }

Loading…
Cancel
Save