From 6732ebd37033a9f533be653665b8b1696cab1f1f Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Sun, 17 Apr 2016 13:46:47 +0100 Subject: [PATCH] vcilcs: Warn as message queue approaches fullness See: https://github.com/raspberrypi/firmware/issues/449 --- interface/vmcs_host/vcilcs.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/interface/vmcs_host/vcilcs.c b/interface/vmcs_host/vcilcs.c index a189c5771..ee78a2484 100644 --- a/interface/vmcs_host/vcilcs.c +++ b/interface/vmcs_host/vcilcs.c @@ -385,6 +385,22 @@ static int ilcs_callback(VCHIQ_REASON_T reason, VCHIQ_HEADER_T *header, void *se #endif case VCHIQ_MESSAGE_AVAILABLE: +#ifndef _VIDEOCORE + { + static int queue_warn = 0; + int queue_len = st->queue.write - st->queue.read; + if (!queue_warn) + queue_warn = getenv("ILCS_WARN") ? (st->queue.size/2) : st->queue.size; + if (queue_len >= queue_warn) + { + if (queue_len == st->queue.size) + VCOS_ALERT("ILCS queue full"); + else + VCOS_ALERT("ILCS queue len = %d", queue_len); + queue_warn = queue_warn + (st->queue.size - queue_warn)/2; + } + } +#endif vchiu_queue_push(&st->queue, header); break;