Patch Detail
Show a patch.
GET /api/1.1/patches/16621/?format=api
{ "id": 16621, "url": "https://patchwork.libcamera.org/api/1.1/patches/16621/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16621/", "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": "<20220713120035.15604-1-naush@raspberrypi.com>", "date": "2022-07-13T12:00:35", "name": "[libcamera-devel] pipeline: raspberrypi: Improve image/embedded buffer matching logic", "commit_ref": "c49f47589cbafaa94e2baa53424f32a8755185cd", "pull_url": null, "state": "accepted", "archived": false, "hash": "a5217baa9d62e7aaca0ee48a435e1a742f408749", "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/16621/mbox/", "series": [ { "id": 3280, "url": "https://patchwork.libcamera.org/api/1.1/series/3280/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3280", "date": "2022-07-13T12:00:35", "name": "[libcamera-devel] pipeline: raspberrypi: Improve image/embedded buffer matching logic", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3280/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16621/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16621/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 AA484BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 13 Jul 2022 12:00:40 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0830B6330E;\n\tWed, 13 Jul 2022 14:00:40 +0200 (CEST)", "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 843576274E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Jul 2022 14:00:37 +0200 (CEST)", "by mail-wm1-x32f.google.com with SMTP id p4so6389908wms.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Jul 2022 05:00:37 -0700 (PDT)", "from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\to38-20020a05600c512600b003a2e2e965absm2061713wms.20.2022.07.13.05.00.36\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 13 Jul 2022 05:00:36 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1657713640;\n\tbh=29Lum28yNMjZv5s2PHjqhC6HGz01SxN8IMWP5t8rAcw=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:Cc:From;\n\tb=qRl/2eH9urF4ELvoZak+zCIR3dcp/94/Nds99hUcxmTP+WfWoCbZyov5ENnCA4x/V\n\tbgsHG6VhIZrRWO/KlGBUbZPBluSek+X7OeoU/niSO0Ca/BRMkxGZaEvwOPrJ3n4SPl\n\tl5Z4+b/dUp6/ZH7696Yce5QeJtHpspfWlElP0VCTVYj+mMQTqiHUglK5If1U4u4YbG\n\tYZEbZq3Y6KfSv+ZVDy3wOK1iHVEVC5fQtHN0x33HAql0EW2G2iAh3CXX7KZYUa0TJt\n\tzwfbO3qqdHO4KWu5UsyGWFKa19FGKfsy/69b1SWOrZwvqWD28DQJp36KkMqD2Wy/gZ\n\tb8572s14yeFyw==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=bsfTuucbWw8td0Lnu5XSHjzMDvmkMt1HhNuCPqZmtuc=;\n\tb=C7aCl4fHKypAjZJL38viIZ6Qgs5GTHC56vTvtWVhNDv/O2dpaJE8W3ys4WcCSj/FHv\n\twd4npgWyiMirPpgTP5GudSRr4NPMAFtWhnmmybFLYdyb3nZ8Stte/vzATmd2SrkTsVwe\n\tZ4/4qVKy4gujlUz/jCUawLp2ZjpSAHs8z6nMSHP6Z5YO+ChzbnXiI9OHWyK94YT5uYfr\n\tajGY+/AvYWSDvspWOGYd0SYAj2ckvVWfImg+kKXBeguTLab0NHk2HEMNwikQENXmCuKZ\n\tDfknQCb0cQx1BGGwHCDMnlLXEPYeAmVXo8qwBVPa0xREPXKqsnJcqvSP3cx7PJyk8yMD\n\tiurg==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"C7aCl4fH\"; 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:mime-version\n\t:content-transfer-encoding;\n\tbh=bsfTuucbWw8td0Lnu5XSHjzMDvmkMt1HhNuCPqZmtuc=;\n\tb=VgdHpelab4zAb3MKt8nwKahwlzoyPjtZVS1jQ9WhqvJQw9msk518XdesqCCfSQrVE0\n\toYtBt6nbVWRw/vOkTKCD1FmD+Au9x9lLt65ZuI7quHiOBK0K1EtMkHATd78TBX/GUoH1\n\tyYYHlCf8Itlq3OS9+1jROdlIahb/9B6RNnUbqpojUkZsBEna8Kz8yDVM6tFO8hdMFlSr\n\tyWWIB6Af1H56jVuvept6TRNWgMceRD918VebgyVnilIuQgZf4MoKq1T4tN6FjpNXIZuQ\n\t4b+shKDn7LGQth50HCTZsV+SUzqddVNAo2wB5TOTFicDBhmatOb1pXMUfPaA/Z7+BQsJ\n\tb6UQ==", "X-Gm-Message-State": "AJIora/1+QkZfGLi0ZKGT3LdScSqE1p04wIVW27Ue8XCQvqCgUqMoE2M\n\tYGYTqupXD9jQ1iB6Bz3PUhkHk665SLwHqg==", "X-Google-Smtp-Source": "AGRyM1v8EMmHDj+RVpHOvU1FVvKpCUu1r6paHfEykvcZaPrKc1snkEOtgPAyOXW6KNUSHi1TE+MNMQ==", "X-Received": "by 2002:a05:600c:3b9b:b0:3a2:d6d8:cfa7 with SMTP id\n\tn27-20020a05600c3b9b00b003a2d6d8cfa7mr3221644wms.77.1657713636860; \n\tWed, 13 Jul 2022 05:00:36 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 13 Jul 2022 13:00:35 +0100", "Message-Id": "<20220713120035.15604-1-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.25.1", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH] pipeline: raspberrypi: Improve\n\timage/embedded buffer matching logic", "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>", "Cc": "Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "The logic used to match asynchronous image and embedded buffers was being overly\naggressive by possibly allowing an unmatched image buffer to be sent to the IPA\nif the matching embedded buffer had not yet been dequeued. This condition only\noccurs when the system is heavily loaded and dropping frames.\n\nFix this by holding image buffer in the queue during these conditions until the\nnext embedded buffer dequeue event.\n\nReported-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp | 19 ++++++++++++++-----\n 1 file changed, 14 insertions(+), 5 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 66a84b1dfb97..ef3c2d11d253 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -2159,16 +2159,12 @@ bool RPiCameraData::findMatchingBuffers(BayerFrame &bayerFrame, FrameBuffer *&em\n \tif (bayerQueue_.empty())\n \t\treturn false;\n \n-\t/* Start with the front of the bayer queue. */\n-\tbayerFrame = std::move(bayerQueue_.front());\n-\tbayerQueue_.pop();\n-\n \t/*\n \t * Find the embedded data buffer with a matching timestamp to pass to\n \t * the IPA. Any embedded buffers with a timestamp lower than the\n \t * current bayer buffer will be removed and re-queued to the driver.\n \t */\n-\tuint64_t ts = bayerFrame.buffer->metadata().timestamp;\n+\tuint64_t ts = bayerQueue_.front().buffer->metadata().timestamp;\n \tembeddedBuffer = nullptr;\n \twhile (!embeddedQueue_.empty()) {\n \t\tFrameBuffer *b = embeddedQueue_.front();\n@@ -2188,10 +2184,23 @@ bool RPiCameraData::findMatchingBuffers(BayerFrame &bayerFrame, FrameBuffer *&em\n \t}\n \n \tif (!embeddedBuffer && sensorMetadata_) {\n+\t\tif (embeddedQueue_.empty()) {\n+\t\t\t/*\n+\t\t\t * If the embedded buffer queue is empty, wait for the next\n+\t\t\t * buffer to arrive - dequeue ordering may send the image\n+\t\t\t * buffer first.\n+\t\t\t */\n+\t\t\tLOG(RPI, Debug) << \"Waiting for next embedded buffer.\";\n+\t\t\treturn false;\n+\t\t}\n+\n \t\t/* Log if there is no matching embedded data buffer found. */\n \t\tLOG(RPI, Debug) << \"Returning bayer frame without a matching embedded buffer.\";\n \t}\n \n+\tbayerFrame = std::move(bayerQueue_.front());\n+\tbayerQueue_.pop();\n+\n \treturn true;\n }\n \n", "prefixes": [ "libcamera-devel" ] }