Show a patch.

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

{
    "id": 11327,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/11327/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/11327/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20210217125008.1588781-5-naush@raspberrypi.com>",
    "date": "2021-02-17T12:50:08",
    "name": "[libcamera-devel,v2,4/4] pipeline: raspberrypi: Allow either strict or non-strict buffer matching",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "499a32c892e06f5e699b6d3a43570de299b6e060",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/1.1/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/11327/mbox/",
    "series": [
        {
            "id": 1703,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1703/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1703",
            "date": "2021-02-17T12:50:04",
            "name": "Raspberry Pi: Embedded data usage",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/1703/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/11327/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/11327/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 BDCC2BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 17 Feb 2021 12:51:33 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8C6E46831A;\n\tWed, 17 Feb 2021 13:51:33 +0100 (CET)",
            "from mail-wm1-x332.google.com (mail-wm1-x332.google.com\n\t[IPv6:2a00:1450:4864:20::332])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8ACCC6381E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 17 Feb 2021 13:51:31 +0100 (CET)",
            "by mail-wm1-x332.google.com with SMTP id x16so2043252wmk.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 17 Feb 2021 04:51:31 -0800 (PST)",
            "from naush-laptop.patuck.local ([88.97.76.4])\n\tby smtp.gmail.com with ESMTPSA id\n\tr12sm2745281wmg.44.2021.02.17.04.51.01\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 17 Feb 2021 04:51:01 -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=\"iKLINvyu\"; 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=A6IO9Hb2rCfpf+glJ0pLcQzpWIUiMwqvq1rQ0jE7FUw=;\n\tb=iKLINvyuX1eDkn+0Kdl0PgKGHTmBBy63QQIqyP5g0IV9XY0RjYBzigZI+HH7hZPqE1\n\tbr42jRv3nO11xGAH7cVElyOrH59Fchdy1kCDn2kzOm5FSrDVuJk+xnqqezwTbNmC5UTC\n\t/LceHXwVjpzqPMVmyas9+hC1NhpUd77Re/sYMie+OMJ3j1WMtG7PBjFm9AifMgUSoc72\n\tkQQxEnau084F9uHMVMoRfNvkekMmMoILWHdY29R2Gugkz90K81UrhMiokDp19iFpwQ7l\n\tPhDV9XumHM0P9W3LIkp+aelbRu4lL7geLi8z8uIAgB1aA/V7MBDw8VC09/JV5uzg9day\n\tnJ4g==",
        "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=A6IO9Hb2rCfpf+glJ0pLcQzpWIUiMwqvq1rQ0jE7FUw=;\n\tb=kHzYSFKVR/3QpWQCfzJVtVOCJSFunRpWjUyjBU62dYSo29dj7jqmPo90e/1f8jHI4V\n\tAL1MMP37uZCqou9dlVAJSXv4o3gIiz3DztyLL5maBuaQIZ5PTxhMG3o6x+xKP/zms1Eh\n\tTLZ7lkM8n5jPWeJbWxp8QoRth1cjwb6vKv3aN1RLZbVeyuPyF/0pIe24HvE/+4Gn4Es1\n\t/59VMlblE/cgtcWMBWxKYDIyi6hBLLLzgkdrl1AhIlL0dr0DspdQXQkE3uHS5WKaYTPc\n\ttMBu0UsQ6q/TMggFkTKAkk5kE1JIwLXf/NHFpT60C5dYgfC0kRcUy3rcc/AIeQ0tqnmq\n\tOMYg==",
        "X-Gm-Message-State": "AOAM530S5pXWqARinyqToUuuRqg/fEPs04R9ELZ93x0rsFztwXD/ZbKv\n\tP1HxJhYy/lgudLd6OXyDMMIVCvF76QFo7lwj",
        "X-Google-Smtp-Source": "ABdhPJww3QKZlow0q+YXLrrs2dvFf7hQg4Py8NY0XZP8uz7PfRY9JCoPbDke2+z42BbB3UzEyhOezg==",
        "X-Received": "by 2002:a1c:6285:: with SMTP id\n\tw127mr7224973wmb.73.1613566265997; \n\tWed, 17 Feb 2021 04:51:05 -0800 (PST)",
        "From": "Naushir Patuck <naush@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 17 Feb 2021 12:50:08 +0000",
        "Message-Id": "<20210217125008.1588781-5-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20210217125008.1588781-1-naush@raspberrypi.com>",
        "References": "<20210217125008.1588781-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v2 4/4] pipeline: raspberrypi: Allow\n\teither strict 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 e76ac486855c..4ab47f8746bd 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -46,6 +46,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@@ -1724,13 +1740,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@@ -1744,10 +1760,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",
        "v2",
        "4/4"
    ]
}