Patch Detail
Show a patch.
GET /api/1.1/patches/18137/?format=api
{ "id": 18137, "url": "https://patchwork.libcamera.org/api/1.1/patches/18137/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18137/", "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": "<20230118085953.7027-12-naush@raspberrypi.com>", "date": "2023-01-18T08:59:52", "name": "[libcamera-devel,v5,11/12] pipeline: raspberrypi: Allow pipeline handler to always use the newest frame", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "caee3dc2984fc4f506faa96291ea86decfae481c", "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/18137/mbox/", "series": [ { "id": 3713, "url": "https://patchwork.libcamera.org/api/1.1/series/3713/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3713", "date": "2023-01-18T08:59:41", "name": "Raspberry Pi: Platform configuration and buffer allocation improvements", "version": 5, "mbox": "https://patchwork.libcamera.org/series/3713/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/18137/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18137/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 4A8D2C3296\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 18 Jan 2023 09:01:29 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0967E62608;\n\tWed, 18 Jan 2023 10:01:29 +0100 (CET)", "from mail-wr1-x432.google.com (mail-wr1-x432.google.com\n\t[IPv6:2a00:1450:4864:20::432])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E4C1A625F6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 18 Jan 2023 10:01:23 +0100 (CET)", "by mail-wr1-x432.google.com with SMTP id k8so18695011wrc.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 18 Jan 2023 01:01:23 -0800 (PST)", "from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\ti6-20020adfe486000000b002423dc3b1a9sm30312464wrm.52.2023.01.18.01.01.21\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 18 Jan 2023 01:01:22 -0800 (PST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1674032489;\n\tbh=sxi3z4CTMGPw3NMx/xRPBi3JYi/YJTSm90v0e0/aqNQ=;\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=dogR+PUbd1tiw4QXZ3o7TuWbMqak4Djs4JrsgtvgLSGlN5rXBD1voDJY0COI7nR6q\n\tz7HCoZCL8aVbSM//h3kuWpp2cs7vhDvmVW7Hmz3c2/5jUcc6akroK5L/kqX79Ou4oS\n\tXoyhYZE5CNjFVcCIV4EMSdOuUYSR2zWyfS+Vs7tNkbMdf+/l2pB8FjpGY8pi+AcAZU\n\t3UeqATeMA8G3UKYVA27zELEF4BHAvElb7nxY+SZo/8Qrd26Ft9FN0EkMGzImITP9Sz\n\tGLSkuuYggO+cIYOl1jTEbgtEzF54SV3You3NKsZA6hrjpzhINVrIme17SjSEpMJnqM\n\tRCz/X8GK8okbQ==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=x5JG3wUYq4xcmcSB2omZlxtc+5jDqfCvpE5cZCfhkuI=;\n\tb=NAA70eWvMXW3R4n46g7aj5SLm1aMljJfsDyf0el2wCEVwhb22nddPOFtkazHA3yvSh\n\tI7HOqGcxzG/WwsJ4z7ClBn7N8r6hvQDuXSfX3f6q50jUKEjWwjbNPYCJRmcgXE2Jp4Ik\n\tUAFLJ7qWr5t8DGtqxD9UBmW/gaHyvAA+xEE7EqN80WT7KNsckIAdOfn2xnmtzoXKdkAe\n\tfyzL4YLoZL9ROD6ndpSXqaH3wNZgwWK8JZzbuyqOmlXpORNwl+msPkBBbuqEi90ECMs5\n\t6UxK4Wvj1a7r+SXLDFpbP7QbXl0jFIGHyEfGDUEVUWiZCTiajJwAifQPUtGx92XQmeSt\n\tmcSA==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"NAA70eWv\"; dkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=x5JG3wUYq4xcmcSB2omZlxtc+5jDqfCvpE5cZCfhkuI=;\n\tb=FhhoxeBo0O2Kzk7f7uKNAq5eqguIaGPONO33RZNggRdzN0NG/SqQaqlyACVRD/uCW4\n\tWorY5uBKNjeDO5V/Wc09BEjjtqVSF401002X95p1XlXBJbI/ISXFxHlm5YSss3MCOnGj\n\t5V4Ki3GHWC38UdxDvPJTgpRebD2W99nnbIeP5JfLmTG1D+tpx8BvDQ1vC3tpv5YuWHI3\n\tzsBWB/ZdYf6X9KKU+aBzfG6NXEimxCuLBwEvWA/xsIolEsMPEYZU+oUzyZK02nglRvVo\n\t0zIgCEAkvIiOZQu6LGorftZiR7BU3Xk9+pIWzM/3/obk38F+tIo0sQ0Km4q7e/DO3ATr\n\tlZYw==", "X-Gm-Message-State": "AFqh2kpYDFSDSsnZEXqceRn81k1FhnDx4YUdASO2/jDAe0e5ltVHZbJF\n\tBYgNVfNhVxxPomz/ScACW2U0764hfMI+3U5LJ20=", "X-Google-Smtp-Source": "AMrXdXv1TQRZXy0aliKibyoMNdZA6o1E3QY9HYnqxll0GCY0UGJKQyX5NCNKjKCTl7xChace9MfU1A==", "X-Received": "by 2002:adf:d0c5:0:b0:2be:34fa:7bdb with SMTP id\n\tz5-20020adfd0c5000000b002be34fa7bdbmr373198wrh.39.1674032482536; \n\tWed, 18 Jan 2023 01:01:22 -0800 (PST)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 18 Jan 2023 08:59:52 +0000", "Message-Id": "<20230118085953.7027-12-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20230118085953.7027-1-naush@raspberrypi.com>", "References": "<20230118085953.7027-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v5 11/12] pipeline: raspberrypi: Allow\n\tpipeline handler to always use the newest frame", "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": "Add a pipeline config parameter \"return_newest_frames\" to always use the\nmost recently captured Unicam frame when processing a request. This effectively\nstops the pipeline handler from queuing Unicam buffers and processing requests\nusing the buffer at the front of the queue.\n\nNote that setting this parameter might incur unnecessary frame drops during\ntimes of high transient CPU loads where the application might not be able to\nprovide requests quick enough.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n---\n .../pipeline/raspberrypi/data/example.yaml | 7 +++++-\n .../pipeline/raspberrypi/raspberrypi.cpp | 23 +++++++++++++++++++\n 2 files changed, 29 insertions(+), 1 deletion(-)", "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/data/example.yaml b/src/libcamera/pipeline/raspberrypi/data/example.yaml\nindex 421f30e62aa3..04a117f38ada 100644\n--- a/src/libcamera/pipeline/raspberrypi/data/example.yaml\n+++ b/src/libcamera/pipeline/raspberrypi/data/example.yaml\n@@ -19,6 +19,11 @@\n \n # Override any request from the IPA to drop a number of startup\n # frames.\n- \"disable_startup_frame_drops\": false\n+ \"disable_startup_frame_drops\": false,\n+\n+ # Always process a pending request with the last captured sensor\n+ # frame. Note that this might lead to avoidable frame drops\n+ # during periods of transient heavy CPU loading.\n+ \"return_newest_frames\": false\n }\n }\ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 3529d331deb6..21edc8e05469 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -314,6 +314,11 @@ public:\n \t\t * frames.\n \t\t */\n \t\tbool disableStartupFrameDrops;\n+\t\t/*\n+\t\t * Always process a pending request with the last captured sensor\n+\t\t * frame.\n+\t\t */\n+\t\tbool returnNewestFrames;\n \t};\n \n \tConfig config_;\n@@ -1712,6 +1717,7 @@ int RPiCameraData::configurePipeline()\n \t\t.minUnicamBuffers = 2,\n \t\t.minTotalUnicamBuffers = 4,\n \t\t.disableStartupFrameDrops = false,\n+\t\t.returnNewestFrames = false,\n \t};\n \n \tchar const *configFromEnv = utils::secure_getenv(\"LIBCAMERA_RPI_CONFIG_FILE\");\n@@ -1747,6 +1753,8 @@ int RPiCameraData::configurePipeline()\n \t\tphConfig[\"min_total_unicam_buffers\"].get<unsigned int>(config_.minTotalUnicamBuffers);\n \tconfig_.disableStartupFrameDrops =\n \t\tphConfig[\"disable_startup_frame_drops\"].get<bool>(config_.disableStartupFrameDrops);\n+\tconfig_.returnNewestFrames =\n+\t\tphConfig[\"return_newest_frames\"].get<bool>(config_.returnNewestFrames);\n \n \tif (config_.minTotalUnicamBuffers < config_.minUnicamBuffers) {\n \t\tLOG(RPI, Error) << \"Invalid configuration: min_total_unicam_buffers must be >= min_unicam_buffers\";\n@@ -2329,6 +2337,21 @@ bool RPiCameraData::findMatchingBuffers(BayerFrame &bayerFrame, FrameBuffer *&em\n \tif (bayerQueue_.empty())\n \t\treturn false;\n \n+\t/*\n+\t * If the pipeline is configured to only ever return the most recently\n+\t * captured frame, empty the buffer queue until a single element is\n+\t * left, corresponding to the most recent buffer. Note that this will\n+\t * likely result in possibly avoidable dropped frames.\n+\t */\n+\tif (config_.returnNewestFrames && !unicam_[Unicam::Image].isExternal()) {\n+\t\twhile (bayerQueue_.size() > 1) {\n+\t\t\tFrameBuffer *bayer = bayerQueue_.front().buffer;\n+\n+\t\t\tunicam_[Unicam::Image].returnBuffer(bayer);\n+\t\t\tbayerQueue_.pop();\n+\t\t}\n+\t}\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", "prefixes": [ "libcamera-devel", "v5", "11/12" ] }