Show a patch.

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

{
    "id": 11310,
    "url": "https://patchwork.libcamera.org/api/patches/11310/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/11310/",
    "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": "<20210216103140.1077307-5-naush@raspberrypi.com>",
    "date": "2021-02-16T10:31:40",
    "name": "[libcamera-devel,4/4] pipeline: raspberrypi: Allow either strict or non-strict buffer matching",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": false,
    "hash": "499a32c892e06f5e699b6d3a43570de299b6e060",
    "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/11310/mbox/",
    "series": [
        {
            "id": 1696,
            "url": "https://patchwork.libcamera.org/api/series/1696/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1696",
            "date": "2021-02-16T10:31:36",
            "name": "Raspberry Pi: Embedded data usage",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1696/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/11310/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/11310/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 73D5DBD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 16 Feb 2021 10:32:17 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 34CFF637EE;\n\tTue, 16 Feb 2021 11:32:17 +0100 (CET)",
            "from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com\n\t[IPv6:2a00:1450:4864:20::32f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 61613637E5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 16 Feb 2021 11:32:14 +0100 (CET)",
            "by mail-wm1-x32f.google.com with SMTP id o24so13903226wmh.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 16 Feb 2021 02:32:14 -0800 (PST)",
            "from naush-laptop.patuck.local ([88.97.76.4])\n\tby smtp.gmail.com with ESMTPSA id\n\ta186sm3018054wme.17.2021.02.16.02.32.13\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 16 Feb 2021 02:32:13 -0800 (PST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"fsB5dkMx\"; dkim-atps=neutral",
        "DKIM-Signature": "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=LZl4tMiV9T5lpjTuzgxl4XgOZ5IV08IN5LTVWylkY4s=;\n\tb=fsB5dkMxsC/1iSwoCo7Nh3xL6vBSyKjF+0juCBHzP66KaBnCWIMWT5vIwXchbavf8w\n\t31yGVzKOkQBBh7AcMnV08DBb2nJtZnC6uHIx63d1+gOpccxSCv42U/nM2wElC6bYkPJa\n\tQtrDtz6VsOfdbHgtwKoOtTFR1rlh2Lc1ec53CG0OJPrmniSy5Dqa0Fk1/kFQlg5MViFr\n\tOEfd4xZojXsdZIk9qUdli4iTWn7Oqte1IP9mBaUs/xRDOW/TmappRYU6NuiYhCD94c2z\n\tTtAZBukVGXDoj1C/kx9EOxzQrCOaRu11Exlpw5MDlx+nT+RwpKbipemE/PBwXMghSYTd\n\taYDA==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\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=LZl4tMiV9T5lpjTuzgxl4XgOZ5IV08IN5LTVWylkY4s=;\n\tb=IgnjHsfCj+5Fvw+0RE8OTYIkvqlinfzg/TFT/uBlYMdthNvPCk4zgSj07kJsed0N+V\n\t7oU3TN4hPeW+MmlHvh0Eu2rlrFqPZjSq0DCLgqS8nyhyh3X8LQ6QIgE8etW0HjyD3REb\n\t0TGKFZdtfXPqiFlBCr/fPZ6H71XPtqGJ4i8oOhzE/Da0VxmvtkfpKzZSOf3JRd2L2l3t\n\tE4AaFf9wLZ6cLxFZ2lxc0GZSRWieZFGLHDl/6HsyUjnOmzaUmXVfvoD/gWzaxv6DR5sI\n\tuSY1f+487ravS3nW6rmf8fC3w2QvbR/2pe/mHzHbpeSgZucj4lm9C89e+suKiXz4PU5A\n\tdh0Q==",
        "X-Gm-Message-State": "AOAM530NfWxPTvEWMiB723HtKggbgRvTRjZLGihxeFXPDsUQdfGBMjOy\n\tf2TuVP7jPoCxLpFzbdibA9dQxPSU90BnA7NT",
        "X-Google-Smtp-Source": "ABdhPJxGat7M0IOdW7May/GEifsMSZnkvfnsmciMZ447+Sz6R3peWQQQKnh0PDon/sDm4Qb+Bgjk5g==",
        "X-Received": "by 2002:a05:600c:4656:: with SMTP id\n\tn22mr2755579wmo.130.1613471533874; \n\tTue, 16 Feb 2021 02:32:13 -0800 (PST)",
        "From": "Naushir Patuck <naush@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 16 Feb 2021 10:31:40 +0000",
        "Message-Id": "<20210216103140.1077307-5-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20210216103140.1077307-1-naush@raspberrypi.com>",
        "References": "<20210216103140.1077307-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH 4/4] pipeline: raspberrypi: Allow either\n\tstrict or non-strict buffer matching",
        "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>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "A new flag, StrictBufferMatching, is used to control the behavior of\nthe embedded and bayer buffer matching routine.\n\nIf set to true (default), we reject and drop all bayer frames that do\nnot have a matching embedded data buffer and vice-versa. This guarantees\nthe IPA will always have the correct frame exposure and gain values to\nuse.\n\nIf set to false, we use bayer frames that do not have a matching\nembedded data buffer. In this case, IPA will use use the ControlList\npassed to it for gain and exposure values.\n\nAdditionally, allow external stream buffers to behave as if\nStrictBufferMatching = false since we are not allowed to drop them.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp      | 31 ++++++++++++++++---\n 1 file changed, 26 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex b6ee014b620e..b0bb12ab0f37 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -43,6 +43,22 @@ namespace libcamera {\n \n LOG_DEFINE_CATEGORY(RPI)\n \n+/*\n+ * Set this to true to reject and drop all bayer frames that do not have a\n+ * matching embedded data buffer and vice-versa. This guarantees the IPA will\n+ * always have the correct frame exposure and gain values to use.\n+ *\n+ * Set this to false to use bayer frames that do not have a matching embedded\n+ * data buffer. In this case, IPA will use use our local history for gain and\n+ * exposure values, occasional frame drops may cause these number to be out of\n+ * sync for a short period.\n+ *\n+ * \\todo Ideally, this property should be set by the application, but we don't\n+ * have any mechanism to pass generic properties into a pipeline handler at\n+ * present.\n+ */\n+static const bool StrictBufferMatching = true;\n+\n namespace {\n \n bool isRaw(PixelFormat &pixFmt)\n@@ -1732,13 +1748,13 @@ bool RPiCameraData::findMatchingBuffers(BayerFrame &bayerFrame, FrameBuffer *&em\n \t\tembeddedBuffer = nullptr;\n \t\twhile (!embeddedQueue_.empty()) {\n \t\t\tFrameBuffer *b = embeddedQueue_.front();\n-\t\t\tif (!unicam_[Unicam::Embedded].isExternal() && b->metadata().timestamp < ts) {\n+\t\t\tif (b->metadata().timestamp < ts) {\n \t\t\t\tembeddedQueue_.pop();\n \t\t\t\tunicam_[Unicam::Embedded].queueBuffer(b);\n \t\t\t\tembeddedRequeueCount++;\n \t\t\t\tLOG(RPI, Warning) << \"Dropping unmatched input frame in stream \"\n \t\t\t\t\t\t  << unicam_[Unicam::Embedded].name();\n-\t\t\t} else if (unicam_[Unicam::Embedded].isExternal() || b->metadata().timestamp == ts) {\n+\t\t\t} else if (b->metadata().timestamp == ts) {\n \t\t\t\t/* We pop the item from the queue lower down. */\n \t\t\t\tembeddedBuffer = b;\n \t\t\t\tbreak;\n@@ -1752,10 +1768,15 @@ bool RPiCameraData::findMatchingBuffers(BayerFrame &bayerFrame, FrameBuffer *&em\n \n \t\t\tLOG(RPI, Debug) << \"Could not find matching embedded buffer\";\n \n-\t\t\tif (!sensorMetadata_) {\n+\t\t\tif (unicam_[Unicam::Embedded].isExternal() ||\n+\t\t\t    !StrictBufferMatching || !sensorMetadata_) {\n \t\t\t\t/*\n-\t\t\t\t * If there is no sensor metadata, simply return the\n-\t\t\t\t * first bayer frame in the queue.\n+\t\t\t\t * If any of the follwing is true:\n+\t\t\t\t * - This is an external stream buffer (so cannot be dropped).\n+\t\t\t\t * - We do not care about strict buffer matching.\n+\t\t\t\t * - There is no sensor metadata present.\n+\t\t\t\t * we can simply return the first bayer frame in the queue\n+\t\t\t\t * without a matching embedded buffer.\n \t\t\t\t */\n \t\t\t\tLOG(RPI, Debug) << \"Returning bayer frame without a match\";\n \t\t\t\tbayerQueue_.pop();\n",
    "prefixes": [
        "libcamera-devel",
        "4/4"
    ]
}