{"id":15633,"url":"https://patchwork.libcamera.org/api/patches/15633/?format=json","web_url":"https://patchwork.libcamera.org/patch/15633/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220406123554.4042163-4-naush@raspberrypi.com>","date":"2022-04-06T12:35:54","name":"[libcamera-devel,v5,3/3] test: v4l2_videodevice: Verify the Dequeue Watchdog","commit_ref":"eea1c9c6319c63933cc47a7694b14729b4841928","pull_url":null,"state":"accepted","archived":false,"hash":"0acd2ab3147c6c9cb29a6b85b68a2873e6f184c2","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/15633/mbox/","series":[{"id":3035,"url":"https://patchwork.libcamera.org/api/series/3035/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3035","date":"2022-04-06T12:35:51","name":"Dequeue timeout","version":5,"mbox":"https://patchwork.libcamera.org/series/3035/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15633/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15633/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 6887CC0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  6 Apr 2022 12:36:07 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1A0F46564E;\n\tWed,  6 Apr 2022 14:36:07 +0200 (CEST)","from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com\n\t[IPv6:2a00:1450:4864:20::32c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 81B3065651\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  6 Apr 2022 14:36:04 +0200 (CEST)","by mail-wm1-x32c.google.com with SMTP id\n\tn38-20020a05600c502600b0038e4a0fc5easo1535121wmr.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 06 Apr 2022 05:36:04 -0700 (PDT)","from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:8464:e7f5:f44c:ee9f])\n\tby smtp.gmail.com with ESMTPSA id\n\tp8-20020a5d59a8000000b00204178688d3sm16712490wrr.100.2022.04.06.05.36.02\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 06 Apr 2022 05:36:03 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1649248567;\n\tbh=8Ewq6FpKQZHfDJbvneE/YsIROH3JjdaudrsCD96DizA=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=xqZt00pT7ejWTK3I+97oeT68qMK8H/6LVxAJLmxtdivz4H7KtSkYPR0wv6Cpds+k3\n\tsCfiZVC0xIkJ6ji+JS3Q+dCV9oLyeRWlnDC2//IQ+/iwRWAXDrz3UdAfDoInqFpSd2\n\t/Cqtf5RH2mUTnjM1Y/UTckmFlTAXa611ByYdmpC6mfBn5ydIC6O9L/66xIBUURZ9SY\n\tSkqpjzbyIUrh/s17NTsL6/t6acYqhstpJXZqukfpbUvhGpAp9I2Em03qIZ2jTz+qrg\n\tS63HyMgBoz8GZ1wcu2ukTnOcnqicE/L8Jmu8YYV/j/BFDDPYBCwneQAvO4QODwCi/V\n\ttIChoBZ+QHDmw==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=w2V02RKBfRqnzfen6tsvXrw2no3e3coAJ3zggKTkg3E=;\n\tb=M/yRwrFbX7sjNbJ/SbribQDUohCF4JIJ0kpAH1ZXWqt4jwYdZeEeUpBu4HxqVshRzp\n\tRdnjear8rc0LbIFNvgDavHKgsf3WoH/V5T3kLdIv493DsgkxS3pJK1fcuoPpCG+uPkAE\n\tQTAD2i6o/eP1BVFq+WbAFFAUzY6fPRs3uvgMIJUK2hE8XLITRe3cjrWhgJhGqZCujwms\n\tQ55tkUd7AFeqvAL9gW25Y5H+ceA6R1ds5oPeq/0DS1uX59zbDEolfHRAXiRRn71MBZHs\n\tmAbCUI71DEb9C0hG6EeKNoNf5gBaQxh+hAxDdAXtGxBUxMTWVCbxy8lDrx6srQmfqAc8\n\tZ4JQ=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"M/yRwrFb\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=w2V02RKBfRqnzfen6tsvXrw2no3e3coAJ3zggKTkg3E=;\n\tb=8Ck8AdwTlDDEotu8YM5lRg9hJjO0waujmWTtogyml7IROsv/1U7P9ProJqM3yCFcHr\n\t0QZl1EHmF/Zr60qthalm/7lIfCQbh7Va8bckKc0I/uwJnWaOfl2Jj9P7N1DHtlYNUsWp\n\tQ4Kq/MY1HrJM8yh4+xCxpmmetfZ4JYENXhulKh0kwOMx+IcLkIBqiVk+KuA5THgdx/3V\n\tD9NAXQ7hlEPHmBNhGLxJkSouJppkAiCWc8No6fdrJ0cbZ4QwXDk/2c+gFfc/sZ+HYGE3\n\tl2D81vKz/3WB0QgF8gp0b2q0uoOxrhfj1zTJDSFW+SQVcZfP8KT6k40IHK2ZN1c4UJ2l\n\t27Cw==","X-Gm-Message-State":"AOAM533ovVuYHFpNdb3Fvhw+D/8fLntz/Cc1SU0ffrcDuSLQ4kwQqVJj\n\tmdRGapPZWYphzn3Qd4n6Dyl2CyMBMX4bmw==","X-Google-Smtp-Source":"ABdhPJz5Pg6aOiap8zaQryEZxnbe8xY5AamC7Ilc3b5LU14PUM8Ogc+TCs0QI29jXseiADXG1nyvTA==","X-Received":"by 2002:a05:600c:4f86:b0:38c:bd13:e074 with SMTP id\n\tn6-20020a05600c4f8600b0038cbd13e074mr7411880wmq.97.1649248563839; \n\tWed, 06 Apr 2022 05:36:03 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  6 Apr 2022 13:35:54 +0100","Message-Id":"<20220406123554.4042163-4-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20220406123554.4042163-1-naush@raspberrypi.com>","References":"<20220406123554.4042163-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v5 3/3] test: v4l2_videodevice: Verify the\n\tDequeue Watchdog","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"From: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nAdd a test that captures 5 frames, with a short (5ms) watchdog.\nThe default framerate of the VIMC pipeline should ensure that\nwe never meet this watchdog, and the timeout should activate.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n test/v4l2_videodevice/dequeue_watchdog.cpp | 96 ++++++++++++++++++++++\n test/v4l2_videodevice/meson.build          |  1 +\n 2 files changed, 97 insertions(+)\n create mode 100644 test/v4l2_videodevice/dequeue_watchdog.cpp","diff":"diff --git a/test/v4l2_videodevice/dequeue_watchdog.cpp b/test/v4l2_videodevice/dequeue_watchdog.cpp\nnew file mode 100644\nindex 000000000000..0cb4de6f81a0\n--- /dev/null\n+++ b/test/v4l2_videodevice/dequeue_watchdog.cpp\n@@ -0,0 +1,96 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2022, Ideas on Board Oy.\n+ *\n+ * libcamera V4L2 dequeue watchdog test\n+ */\n+\n+#include <iostream>\n+\n+#include <libcamera/base/event_dispatcher.h>\n+#include <libcamera/base/thread.h>\n+#include <libcamera/base/timer.h>\n+\n+#include <libcamera/framebuffer.h>\n+\n+#include \"v4l2_videodevice_test.h\"\n+\n+using namespace libcamera;\n+using namespace std::chrono_literals;\n+\n+class DequeueWatchdogTest : public V4L2VideoDeviceTest\n+{\n+public:\n+\tDequeueWatchdogTest()\n+\t\t: V4L2VideoDeviceTest(\"vimc\", \"Raw Capture 0\"), frames_(0), barks_(0) {}\n+\n+protected:\n+\tint run()\n+\t{\n+\t\tconstexpr unsigned int bufferCount = 8;\n+\n+\t\tEventDispatcher *dispatcher = Thread::current()->eventDispatcher();\n+\t\tTimer timeout;\n+\n+\t\tint ret = capture_->allocateBuffers(bufferCount, &buffers_);\n+\t\tif (ret < 0)\n+\t\t\treturn TestFail;\n+\n+\t\tcapture_->dequeueTimeout.connect(this, &DequeueWatchdogTest::barkCounter);\n+\t\tcapture_->setDequeueTimeout(5ms);\n+\n+\t\tcapture_->bufferReady.connect(this, &DequeueWatchdogTest::receiveBuffer);\n+\n+\t\tfor (const std::unique_ptr<FrameBuffer> &buffer : buffers_) {\n+\t\t\tif (capture_->queueBuffer(buffer.get())) {\n+\t\t\t\tstd::cout << \"Failed to queue buffer\" << std::endl;\n+\t\t\t\treturn TestFail;\n+\t\t\t}\n+\t\t}\n+\n+\t\tcapture_->streamOn();\n+\n+\t\ttimeout.start(5s);\n+\t\twhile (timeout.isRunning()) {\n+\t\t\tdispatcher->processEvents();\n+\t\t\tif (frames_ > 5)\n+\t\t\t\tbreak;\n+\t\t}\n+\n+\t\tstd::cout << \"Processed \" << frames_ << \" frames_ and heard \"\n+\t\t\t  << barks_ << \" barks_\" << std::endl;\n+\n+\t\tif (!barks_) {\n+\t\t\tstd::cout << \"Failed to hear any barks_.\" << std::endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tcapture_->streamOff();\n+\n+\t\treturn TestPass;\n+\t}\n+\n+private:\n+\tvoid receiveBuffer(FrameBuffer *buffer)\n+\t{\n+\t\tif (buffer->metadata().status == FrameMetadata::FrameCancelled)\n+\t\t\treturn;\n+\n+\t\tstd::cout << \"Buffer received\" << std::endl;\n+\t\tframes_++;\n+\n+\t\t/* Requeue the buffer for further use. */\n+\t\tcapture_->queueBuffer(buffer);\n+\t}\n+\n+\tvoid barkCounter()\n+\t{\n+\t\tstd::cout << \"Watchdog is barking\" << std::endl;\n+\t\tbarks_++;\n+\t}\n+\n+\tunsigned int frames_;\n+\tunsigned int barks_;\n+};\n+\n+TEST_REGISTER(DequeueWatchdogTest)\ndiff --git a/test/v4l2_videodevice/meson.build b/test/v4l2_videodevice/meson.build\nindex 643f82edce5e..7a26f53d106a 100644\n--- a/test/v4l2_videodevice/meson.build\n+++ b/test/v4l2_videodevice/meson.build\n@@ -6,6 +6,7 @@ v4l2_videodevice_tests = [\n     ['double_open',         'double_open.cpp'],\n     ['controls',            'controls.cpp'],\n     ['formats',             'formats.cpp'],\n+    ['dequeue_watchdog',    'dequeue_watchdog.cpp'],\n     ['request_buffers',     'request_buffers.cpp'],\n     ['buffer_cache',        'buffer_cache.cpp'],\n     ['stream_on_off',       'stream_on_off.cpp'],\n","prefixes":["libcamera-devel","v5","3/3"]}