Show a patch.

GET /api/patches/15531/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 15531,
    "url": "https://patchwork.libcamera.org/api/patches/15531/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15531/",
    "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": "<20220324093409.29247-2-naush@raspberrypi.com>",
    "date": "2022-03-24T09:34:09",
    "name": "[libcamera-devel,v2,2/2] pipeline: raspberrypi: Add a Unicam dequeue timeout",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "862f1a727a8470e3631a82a15c2943c6747563ef",
    "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/15531/mbox/",
    "series": [
        {
            "id": 2992,
            "url": "https://patchwork.libcamera.org/api/series/2992/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2992",
            "date": "2022-03-24T09:34:08",
            "name": "[libcamera-devel,v2,1/2] libcamera: v4l2_videodevice: Add a dequeue timer",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/2992/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/15531/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15531/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 14311BD80A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 24 Mar 2022 09:34:16 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7D3D4604C5;\n\tThu, 24 Mar 2022 10:34:15 +0100 (CET)",
            "from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com\n\t[IPv6:2a00:1450:4864:20::42d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2E707601F5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Mar 2022 10:34:13 +0100 (CET)",
            "by mail-wr1-x42d.google.com with SMTP id u3so5752972wrg.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Mar 2022 02:34:13 -0700 (PDT)",
            "from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:18f1:1b78:a3ab:7eda])\n\tby smtp.gmail.com with ESMTPSA id\n\tv15-20020a056000144f00b002057eac999fsm2243889wrx.76.2022.03.24.02.34.11\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 24 Mar 2022 02:34:12 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1648114455;\n\tbh=cvsUhuGJdi2+O8B/WNlehg1JM8ArO7iMbY7zdhfE6Aw=;\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=XGVQpMA4SUWCF0Z/z6lNF6V5eLqJ/y7syFAv0eeXtatRIuXcxoisp6lV36dv2cfML\n\tDyNrjHXeXa5BhwWw44zFyoAPyjcTWgrjpIjUc7PlUQxJWAMV6LLLARN31U81YPI2Dc\n\t9GQn1kvbqug+BCfqJbdB0d8+foHf/KzvjqGHhLRXbAofTvEs1/L9Z/IgGOD60/lvLv\n\tX5f7AbS5f8/DwZ8YMhR16ZHy7u2v4MeWJjtHMMIzwjXtMod9OrPh0dOGJssA6tRqfd\n\trHr5jaDN3JitSIZxtHxPWw99pyVkC/sON80LBTaifmuxnAYq0ccLZhMl1oCcJXpDGE\n\t46dQWwoA8Z55A==",
            "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=J177DCPIrCbnU3M3SWgf1jMhEAT05MNMBbvF1zi1x+I=;\n\tb=mhnNwlIdzUzDEWS0nZSddNYhMm33dq0QmJgi7sZrs9U4ubo1VjHrT2lhnXaeq+289h\n\tYpjTrceag+BjUPvnjzdN1dSPpcF+cga2xikmSUqFBclDrrYXRLxO9mKvihqRXqs7VpdV\n\ttTgfcXXgjpKFxY4EWwrZuycKlc9bnfY2CwoQThUqp0omeLtNLcedAgPNqWbNVPZwFgif\n\tgDdx+VErpITX2oo0nyBjoP02CQw+V6BpEJWuMe+43MxYvg+krIm7a/KLZMvnjEhmdXe6\n\t+OPgnn7SLJrxrNek2hdLwE7WF1KuU1VD+TMmmM4vW1jR3rjVh8DxLp2TeTa+Eb2ENVrC\n\tTF/Q=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"mhnNwlId\"; 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=J177DCPIrCbnU3M3SWgf1jMhEAT05MNMBbvF1zi1x+I=;\n\tb=6VZZMteu7qG8vdjwMxw04V1l49iYMK1uyY2cH/jaEicw+KFuz/AhLL/i23mkRfMq4n\n\tcCppmLF2tMKHrla1X4tbUrF54PF7FCb1dDACK3GQsM7x5aFpivVBlGBZCTTFv792kJKs\n\tlrM5Td1DnW1pHMFleZbJ8z/1LpnzOzXWHSR1wKyw+K0AvIO3ZDgoGtTl8Exlf18odf0Z\n\tBv/F2IpVe1Y2gChFna/QlMNz2thLaupWB3AIsQN+qGBDVxK+++9jK285Bc1DQtJNAzL+\n\tVAi+V6I2n/OqkQV+hY/sE4gnW5Id7dfE7+MU+KbHrb7PPZwZVISCXpQCioi3z5wMFJqK\n\t9loA==",
        "X-Gm-Message-State": "AOAM531ID6P3Jq5DBcI/srDkqg9n47B4VkGkCZimbUqRfGIlxa2vX3Wv\n\tuCIk/dA5JGMO6hqyYkoKx/dojZiVmSAACQ==",
        "X-Google-Smtp-Source": "ABdhPJxLXGjFXdUAXtuOVL84sBS6K8T1G4N36p+Oo3NtIKZqCPDVw8CCa93j/D97LWP0zolBYLvMaw==",
        "X-Received": "by 2002:a05:6000:1547:b0:204:213:ae28 with SMTP id\n\t7-20020a056000154700b002040213ae28mr3786796wry.114.1648114452617; \n\tThu, 24 Mar 2022 02:34:12 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 24 Mar 2022 09:34:09 +0000",
        "Message-Id": "<20220324093409.29247-2-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "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 v2 2/2] 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 1bf4e270b062..89767a9db471 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..58b1179c4294 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -202,6 +202,7 @@ public:\n \tvoid setIspControls(const ControlList &controls);\n \tvoid setDelayedControls(const ControlList &controls);\n \tvoid setSensorControls(ControlList &controls);\n+\tvoid unicamTimeout();\n \n \t/* bufferComplete signal handlers. */\n \tvoid unicamBufferDequeue(FrameBuffer *buffer);\n@@ -1032,6 +1033,11 @@ 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+\tstd::chrono::milliseconds msec(startConfig.maxSensorFrameLengthMs * 2);\n+\tdata->unicam_[Unicam::Image].dev()->setDequeueTimeout(msec);\n+\tLOG(RPI, Debug) << \"Setting Unicam timeout to \" << msec << \" ms.\";\n+\n \treturn 0;\n }\n \n@@ -1176,6 +1182,7 @@ int PipelineHandlerRPi::registerCamera(MediaDevice *unicam, MediaDevice *isp, Me\n \tdata->isp_[Isp::Stats] = RPi::Stream(\"ISP Stats\", ispCapture3);\n \n \t/* Wire up all the buffer connections. */\n+\tdata->unicam_[Unicam::Image].dev()->dequeueTimeout.connect(data.get(), &RPiCameraData::unicamTimeout);\n \tdata->unicam_[Unicam::Image].dev()->frameStart.connect(data.get(), &RPiCameraData::frameStarted);\n \tdata->unicam_[Unicam::Image].dev()->bufferReady.connect(data.get(), &RPiCameraData::unicamBufferDequeue);\n \tdata->isp_[Isp::Input].dev()->bufferReady.connect(data.get(), &RPiCameraData::ispInputDequeue);\n@@ -1757,6 +1764,14 @@ void RPiCameraData::setSensorControls(ControlList &controls)\n \tsensor_->setControls(&controls);\n }\n \n+void RPiCameraData::unicamTimeout()\n+{\n+\tLOG(RPI, Error)\n+\t\t<< \"Unicam has timed out!\\n\"\n+\t\t   \"Please check that your camera sensor connector is attached securely.\\n\"\n+\t\t   \"Alternatively, try another cable and/or sensor.\";\n+}\n+\n void RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer)\n {\n \tRPi::Stream *stream = nullptr;\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "2/2"
    ]
}