Patch Detail
Show a patch.
GET /api/patches/15533/?format=api
{ "id": 15533, "url": "https://patchwork.libcamera.org/api/patches/15533/?format=api", "web_url": "https://patchwork.libcamera.org/patch/15533/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20220324125444.1389060-1-kieran.bingham@ideasonboard.com>", "date": "2022-03-24T12:54:44", "name": "[libcamera-devel] test: v4l2_videodevice: Verify the Dequeue Watchdog", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "421a85a722c927a54f60bd930826fa0438f7aa28", "submitter": { "id": 4, "url": "https://patchwork.libcamera.org/api/people/4/?format=api", "name": "Kieran Bingham", "email": "kieran.bingham@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/15533/mbox/", "series": [ { "id": 2994, "url": "https://patchwork.libcamera.org/api/series/2994/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2994", "date": "2022-03-24T12:54:44", "name": "[libcamera-devel] test: v4l2_videodevice: Verify the Dequeue Watchdog", "version": 1, "mbox": "https://patchwork.libcamera.org/series/2994/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/15533/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/15533/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 1A2CFBD80A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 24 Mar 2022 12:54:50 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BA59C604DB;\n\tThu, 24 Mar 2022 13:54:49 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C1BBC60397\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Mar 2022 13:54:48 +0100 (CET)", "from Monstersaurus.ksquared.org.uk.beta.tailscale.net\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7322C1844;\n\tThu, 24 Mar 2022 13:54:48 +0100 (CET)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1648126489;\n\tbh=r8abn2wbWyXLuB6RSKE4ndCrIde3rzlxR/EdsK9rr1s=;\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=kK3kHLLRSjvE1YQpwmOnku7bBRAyWVbDj/QXJbHFFZ/k+lyoJR2YsRpuGmKjjSMBM\n\t6o1HtatgFWXWYoM1gizQt9LJxa5SD1CrJGMDNVwem5tafT6yJmE811Q7CUB98OHUFK\n\t464g7K/d80J68QLGAwJnrvJ8cNFjDt0qpKyqvYt996RHphOGUGT6mtF/YgZIzLo2gJ\n\tSEO5wuhG74weKXTpW/HlH4+97UG/InEFPb2DOO+WsfhmDOKNkiP/6kvWL03eROVQoy\n\ttpLB/AURfK51yQoJIhsl88iCIdwBUtDQHpkffeI8VymHyRnuw5q9LNwDrx+Ky6bFWo\n\tBNrwayp6z/c5A==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1648126488;\n\tbh=r8abn2wbWyXLuB6RSKE4ndCrIde3rzlxR/EdsK9rr1s=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=HhbldodoPpGNIWUGETLoyFUlHf1v2LOz5x4Uu4hDL0NUVF1GGVzsbcYTTvVdJvK2C\n\tSCoab6mTjfbl/xqsLZELwRm9+6kACOc+MuDdu3Lt3iXtDLPYZA04dfaJa4h+5cSuTP\n\txtM0+XrT8wibhOdwr0yOTCn4lOIcIdjv1FhwwHIk=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Hhbldodo\"; dkim-atps=neutral", "To": "libcamera devel <libcamera-devel@lists.libcamera.org>", "Date": "Thu, 24 Mar 2022 12:54:44 +0000", "Message-Id": "<20220324125444.1389060-1-kieran.bingham@ideasonboard.com>", "X-Mailer": "git-send-email 2.32.0", "In-Reply-To": "<20220324093409.29247-1-naush@raspberrypi.com>", "References": "<20220324093409.29247-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH] 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": "Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Kieran Bingham <kieran.bingham@ideasonboard.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Add 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>\n---\n test/v4l2_videodevice/dequeue_watchdog.cpp | 100 +++++++++++++++++++++\n test/v4l2_videodevice/meson.build | 1 +\n 2 files changed, 101 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..db0c65ff482e\n--- /dev/null\n+++ b/test/v4l2_videodevice/dequeue_watchdog.cpp\n@@ -0,0 +1,100 @@\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 std::chrono_literals;\n+using namespace libcamera;\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+\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+protected:\n+\tint run()\n+\t{\n+\t\tconst 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\tret = capture_->streamOn();\n+\t\tif (ret)\n+\t\t\treturn TestFail;\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 < 1) {\n+\t\t\tstd::cout << \"Failed to hear any barks.\" << std::endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tret = capture_->streamOff();\n+\t\tif (ret)\n+\t\t\treturn TestFail;\n+\n+\t\treturn TestPass;\n+\t}\n+\n+private:\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" ] }