Show a patch.

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

{
    "id": 15624,
    "url": "https://patchwork.libcamera.org/api/patches/15624/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15624/",
    "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": "<20220406075859.3857121-3-naush@raspberrypi.com>",
    "date": "2022-04-06T07:58:58",
    "name": "[libcamera-devel,v4,2/3] pipeline: raspberrypi: Add a Unicam dequeue timeout",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "856eafd2025361b8e9edeeaeeccc117d2f337a04",
    "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/15624/mbox/",
    "series": [
        {
            "id": 3031,
            "url": "https://patchwork.libcamera.org/api/series/3031/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3031",
            "date": "2022-04-06T07:58:56",
            "name": "Dequeue timeout",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/3031/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/15624/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15624/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 15B80C3260\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  6 Apr 2022 07:59:10 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B97B76564D;\n\tWed,  6 Apr 2022 09:59:09 +0200 (CEST)",
            "from mail-wr1-x430.google.com (mail-wr1-x430.google.com\n\t[IPv6:2a00:1450:4864:20::430])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BCD6665643\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  6 Apr 2022 09:59:06 +0200 (CEST)",
            "by mail-wr1-x430.google.com with SMTP id d29so1892794wra.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 06 Apr 2022 00:59:06 -0700 (PDT)",
            "from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:eedb:32e2:e3d4:3bfa])\n\tby smtp.gmail.com with ESMTPSA id\n\t14-20020a056000154e00b00203f8adde0csm17235503wry.32.2022.04.06.00.59.04\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 06 Apr 2022 00:59:05 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1649231949;\n\tbh=YfHkyuISdtpEFUz72XKQw2qLvqSSTFQnKC1b5Clku8o=;\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=eNidMTe+2SurCyhRescJ3eOtlg/2WZR5FqNG4B/b9SpEYMFEkdS2JpJGs1vVLvwZr\n\tR8OIBwsapcNfhuM6wm2AASbizjJ6e3v0MsjO81xsw4urtPYHBVkwpSNKPxdAzhu9nZ\n\tP6R7UZeGlz7lZ9ZWEogBOyuDea8iNe5WY5COd63Hqq2kyScf0WfiH+RYUHLYSqes5E\n\tKZH+0LAu9X3+8tkwRWHoF19HvF8X04ufSJ2mDDxJMkQ4BzjereGkIaz+G2C0SU5L2t\n\twkAHiYnRpSMp5agX2jh4+jT+ygzs3RJw2KCCI3WZKIiIesceM2uCmGmFMKwRKs9G8j\n\tfiVuHZ32EOiVw==",
            "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=n+SfiTLIZkbs8xSe1U6Qik4cd6Yqni5HDX2QUf9j1F4=;\n\tb=AdmdVrAq5m/5p0SeTRTsF+MIRDLTZINN4j9966/ZzsBbzAPHRp9xFaqwZGUZ6fKsnh\n\toknRVLDmvF4xtQMgeLvc7/UmJ35V1/GZccacKr0qcSTXpiPS9KrTan4oGyrN0YYJt+Wo\n\tVcq6CGPvYru80pG1GPBeeBT41482R+N0t3HhexEixSdvWIGpkKe3iVRvZGfW+fcwIUSJ\n\tvNiwH/DFfBVkhHINABfiwYllHO9fXStiExwlrcapr7cX4lnymrkiAX1IjbLqaYMYQKOF\n\tATo8MtPaPprk9eBtrHHfeGQR8h9ZnWUsw99EMJrDq094Z/4FaHYJ0KZSyro9WEQtkeq8\n\tMjAQ=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"AdmdVrAq\"; 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=n+SfiTLIZkbs8xSe1U6Qik4cd6Yqni5HDX2QUf9j1F4=;\n\tb=4k/yxdiFO7D3VrrxqmuatO6iDI5H9VWmEWp+y+jzXMlWytpVeqTLQXGuVSHUJcJh8B\n\tt+XXe12zC3CmPuZj0xkdDj2uItwEyDlCfG6AtNRjdlS7dEJseH0Jt2XL4CIFoXfgOerk\n\t+mlGsyAesFbDxGmZMzm6USF4YBo92/8t+hT7JJtyGHZGQ5SqAvxK4sGS2GQeDbLz+9v/\n\tBOGBlErErHno9AP61hIrP5NNi3eT6p3p9G3REvfkKaSKb/HRXhGXj0Y4YxdtBHse/ifg\n\t0v5jHDBpUvCkeedtqEXsL7/57nBsxPMB08qB5XTgHnjL8kiXLyR8OOtOVD9CKdpJ5L20\n\tgjjA==",
        "X-Gm-Message-State": "AOAM532iu/LV90YpNbGrHH+N2hXMo58oRuhJtPiBRIfX23RPjp5kD/sl\n\t5c7M9U4HiXmOvVFekBMjH272oLa7j1Oljw==",
        "X-Google-Smtp-Source": "ABdhPJw7FXdXEMlMzYDUfZY9IlTY7x3dkz2KVE+kU+7j5OuIEXuarcN3THftm7+s86gTIukCjIVKtQ==",
        "X-Received": "by 2002:adf:f60a:0:b0:206:1201:e223 with SMTP id\n\tt10-20020adff60a000000b002061201e223mr5580212wrp.712.1649231946069; \n\tWed, 06 Apr 2022 00:59:06 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed,  6 Apr 2022 08:58:58 +0100",
        "Message-Id": "<20220406075859.3857121-3-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20220406075859.3857121-1-naush@raspberrypi.com>",
        "References": "<20220406075859.3857121-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v4 2/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": "From: Naushir Patuck via libcamera-devel <libcamera-devel@lists.libcamera.org>\n\nEnable 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 an 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>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.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 8fd79be67988..98c463e39548 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::chrono_literals;\n+\n namespace libcamera {\n \n LOG_DEFINE_CATEGORY(RPI)\n@@ -208,6 +210,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@@ -1050,6 +1053,10 @@ 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 timeout(2 * startConfig.maxSensorFrameLengthMs * 1ms);\n+\tdata->unicam_[Unicam::Image].dev()->setDequeueTimeout(timeout);\n+\n \treturn 0;\n }\n \n@@ -1192,6 +1199,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@@ -1773,6 +1781,13 @@ void RPiCameraData::setSensorControls(ControlList &controls)\n \tsensor_->setControls(&controls);\n }\n \n+void RPiCameraData::unicamTimeout()\n+{\n+\tLOG(RPI, Error) << \"Unicam has timed out!\";\n+\tLOG(RPI, Error) << \"Please check that your camera sensor connector is attached securely.\";\n+\tLOG(RPI, Error) << \"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",
        "v4",
        "2/3"
    ]
}