Patch Detail
Show a patch.
GET /api/patches/15509/?format=api
{ "id": 15509, "url": "https://patchwork.libcamera.org/api/patches/15509/?format=api", "web_url": "https://patchwork.libcamera.org/patch/15509/", "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": "<20220322131635.2869526-4-naush@raspberrypi.com>", "date": "2022-03-22T13:16:35", "name": "[libcamera-devel,v1,3/3] pipeline: raspberrypi: Add a Unicam dequeue timeout", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "caf4654bd0af2cb06de4868c9c0a014bd79c3463", "submitter": { "id": 34, "url": "https://patchwork.libcamera.org/api/people/34/?format=api", "name": "Naushir Patuck", "email": "naush@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/15509/mbox/", "series": [ { "id": 2983, "url": "https://patchwork.libcamera.org/api/series/2983/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2983", "date": "2022-03-22T13:16:32", "name": "V4L2 dequeue timeout", "version": 1, "mbox": "https://patchwork.libcamera.org/series/2983/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/15509/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/15509/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 C88A8C0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 22 Mar 2022 13:16:46 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 85FBB604DB;\n\tTue, 22 Mar 2022 14:16:46 +0100 (CET)", "from mail-wm1-x333.google.com (mail-wm1-x333.google.com\n\t[IPv6:2a00:1450:4864:20::333])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 77414604E8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Mar 2022 14:16:41 +0100 (CET)", "by mail-wm1-x333.google.com with SMTP id\n\tbi13-20020a05600c3d8d00b0038c2c33d8f3so2431665wmb.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Mar 2022 06:16:41 -0700 (PDT)", "from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:9e9a:99af:e5a6:319b])\n\tby smtp.gmail.com with ESMTPSA id\n\tn14-20020a7bcbce000000b0038c7776a300sm2293478wmi.0.2022.03.22.06.16.40\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 22 Mar 2022 06:16:40 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1647955006;\n\tbh=SRHd8zX2rGP5uypPrEvgme6+IFfRAI8ytSzNdhWjXDU=;\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=D5qzvjP6uOl583JNYA/E3nICiCPFvW01Ew0nW34BrlaLI7xUrBNB4FXP5B1OLyTOt\n\tTpsJsL7dUiXMdCwi4UnpMNOTGzBrYXP56PACqc9ekX1qLQVomdu1h3J5QwbU55Qnfg\n\ttOxlUNV0Wk7g7AH2gDg0zijTS/wJHjGYTlQ+NQb5h4fvsL/MmaQG8mjzWr27RQ0uCn\n\tMQOp4bsyc6HrlUgFRMyL6cHt+6Hv0cj2GZDE+mDEydiqSSb6vkdMqj6kITFFyHEN40\n\tuMywRtJvUOx1HGrv5Zir2O/2TsWkdxL1Tckr2hYxnHCGPnvhHO/Dxd3OcH/04O9xyx\n\tQ14OmBadrkUxw==", "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=tgA21Uc9i7A/Vd4j8bEgnI9K63bVJqGeeiMn4t/Uurs=;\n\tb=Bvu3mWU9RKcLvF9hkwFGQi3koH+ZoCIfbYAblzfJ2VHgDX7ekNcxYuSKLVIJwfWqyb\n\tpog/NsbBWwoDv0KOah+7yQbIziKfypTIA0PqRxLWuLM/4jVuNiE54y8hR0suOrpfa8zf\n\tQpA0TpywAY9H0Ik49RbNy39NMDYKSxnnU54ZsSLd1oyI9JgjPAjEYxZK3UGh8T0HBAix\n\tijiYq76rm62YIbJ29P5vO/RYcNDOdDNIfXNWT3z8hZlImdYwkRdMoVoQZiAqoKmcsX0i\n\tQo3+ry5i/7Q0pHhnIcAPKss9SggMahbo0S7w0H84Ly9P3N8fUuNpUIBo5GM/cEGDbSu3\n\tDdxQ==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"Bvu3mWU9\"; 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=tgA21Uc9i7A/Vd4j8bEgnI9K63bVJqGeeiMn4t/Uurs=;\n\tb=r7+cVDqJbWaUif04VNSXnZtZSxzqV/Cwq2fA/khPQIY9YOBJXcSU0/FTFOh2l8e7Zf\n\tNPOMvD7CyvHGr7H5q8mkAz0JAxF1i9iWms9rZUq+ymtTYKmYzYLnKDY4B/hp+LvATGop\n\tJpfXx0gWPy/xSE018h3bEtjksZYylgfiyJ1PPoPOAp/TweMGSP3PhjXWjZTXPryI8k6h\n\tK+NZnrEUIab6A2d7DfaKNQb9dTKoVHGDIlIhjmkxrFYodVI0BSgBQNegWlKFGvq+E9Li\n\tpxfjTDglqTCzMxMkjL9dh9GSFtVCupeLPnEYoD0lpvV6FkAPTctdKWMnmzI1LibRrgfc\n\tun1A==", "X-Gm-Message-State": "AOAM533yBcnOfMbeew9MlVMX4lxHhZa2vSHlnXPBWZP/COJ9dvtOWlaA\n\tD4UGCiMy104R8nHyXxFUgdjGFfUvmZ2Kpw==", "X-Google-Smtp-Source": "ABdhPJxKY8R0YQ6OafX9uarK9lQ5wWJVLxv+YBh6Y18/S0oFmklCel0XNLDZcMJ409In0f8GKnqcZg==", "X-Received": "by 2002:adf:e6ce:0:b0:203:d9cb:a1b4 with SMTP id\n\ty14-20020adfe6ce000000b00203d9cba1b4mr22731083wrm.140.1647955000933; \n\tTue, 22 Mar 2022 06:16:40 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 22 Mar 2022 13:16:35 +0000", "Message-Id": "<20220322131635.2869526-4-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20220322131635.2869526-1-naush@raspberrypi.com>", "References": "<20220322131635.2869526-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v1 3/3] pipeline: raspberrypi: Add a\n\tUnicam dequeue timeout", "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": "Enable the V4L2VideoDevice dequeue timeout for the Unicam Image node, and\nconnect the timeout signal to a slot in the pipeline handler. This slot will\nlog a fatal error message informing the user of a possible hardware stall.\n\nThe timeout is calculated as 2x the maximum frame length possible for a given\nmode, returned by the IPA.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n include/libcamera/ipa/raspberrypi.mojom | 1 +\n src/ipa/raspberrypi/raspberrypi.cpp | 2 ++\n .../pipeline/raspberrypi/raspberrypi.cpp | 15 +++++++++++++++\n 3 files changed, 18 insertions(+)", "diff": "diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom\nindex acd3cafe6c91..5a228b75cd2f 100644\n--- a/include/libcamera/ipa/raspberrypi.mojom\n+++ b/include/libcamera/ipa/raspberrypi.mojom\n@@ -41,6 +41,7 @@ struct IPAConfig {\n struct StartConfig {\n \tlibcamera.ControlList controls;\n \tint32 dropFrameCount;\n+\tuint32 maxSensorFrameLengthMs;\n };\n \n interface IPARPiInterface {\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex fd8fecb07f81..675f9ba1b350 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -280,6 +280,8 @@ void IPARPi::start(const ControlList &controls, ipa::RPi::StartConfig *startConf\n \t}\n \n \tstartConfig->dropFrameCount = dropFrameCount_;\n+\tconst Duration maxSensorFrameDuration = mode_.max_frame_length * mode_.line_length;\n+\tstartConfig->maxSensorFrameLengthMs = maxSensorFrameDuration.get<std::milli>();\n \n \tfirstStart_ = false;\n \tlastRunTimestamp_ = 0;\ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex c2230199fed7..50b39f1adf93 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -45,6 +45,8 @@\n #include \"dma_heaps.h\"\n #include \"rpi_stream.h\"\n \n+using namespace std::literals::chrono_literals;\n+\n namespace libcamera {\n \n LOG_DEFINE_CATEGORY(RPI)\n@@ -202,6 +204,7 @@ public:\n \tvoid setIspControls(const ControlList &controls);\n \tvoid setDelayedControls(const ControlList &controls);\n \tvoid setSensorControls(ControlList &controls);\n+\tvoid unicamTimeout(V4L2VideoDevice *dev);\n \n \t/* bufferComplete signal handlers. */\n \tvoid unicamBufferDequeue(FrameBuffer *buffer);\n@@ -1032,6 +1035,12 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls)\n \t\t}\n \t}\n \n+\t/* Set the dequeue timeout to 2x the maximum possible frame duration. */\n+\tutils::Duration duration = startConfig.maxSensorFrameLengthMs * 2 * 1ms;\n+\tdata->unicam_[Unicam::Image].dev()->setDequeueTimeout(duration);\n+\tdata->unicam_[Unicam::Image].dev()->dequeueTimeout.connect(data, &RPiCameraData::unicamTimeout);\n+\tLOG(RPI, Debug) << \"Setting sensor timeout to \" << duration;\n+\n \treturn 0;\n }\n \n@@ -1040,6 +1049,7 @@ void PipelineHandlerRPi::stopDevice(Camera *camera)\n \tRPiCameraData *data = cameraData(camera);\n \n \tdata->state_ = RPiCameraData::State::Stopped;\n+\tdata->unicam_[Unicam::Image].dev()->dequeueTimeout.disconnect();\n \n \t/* Disable SOF event generation. */\n \tdata->unicam_[Unicam::Image].dev()->setFrameStartEnabled(false);\n@@ -1757,6 +1767,11 @@ void RPiCameraData::setSensorControls(ControlList &controls)\n \tsensor_->setControls(&controls);\n }\n \n+void RPiCameraData::unicamTimeout([[maybe_unused]] V4L2VideoDevice *dev)\n+{\n+\tLOG(RPI, Fatal) << \"Unicam has timed out!\";\n+}\n+\n void RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer)\n {\n \tRPi::Stream *stream = nullptr;\n", "prefixes": [ "libcamera-devel", "v1", "3/3" ] }