Patch Detail
Show a patch.
GET /api/patches/18303/?format=api
{ "id": 18303, "url": "https://patchwork.libcamera.org/api/patches/18303/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18303/", "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": "<mailman.15.1677156593.25031.libcamera-devel@lists.libcamera.org>", "date": "2023-02-23T12:49:57", "name": "[libcamera-devel,v1,3/3] pipeline: raspberrypi: Add a Unicam timeout override config options", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "65c6c47f77c5f4fbacf1cd53d349de52d70bc04f", "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/18303/mbox/", "series": [ { "id": 3764, "url": "https://patchwork.libcamera.org/api/series/3764/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3764", "date": "2023-02-23T12:49:54", "name": "Raspberry Pi: Improving camera timeouts", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3764/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/18303/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18303/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 1D225C329C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 23 Feb 2023 12:49:56 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 34E396265D;\n\tThu, 23 Feb 2023 13:49:55 +0100 (CET)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1677156595;\n\tbh=HhJjBJBd0P3SylwEm8GEtgj6JxgPUMo3PQBrBPdb43s=;\n\th=To:Date:In-Reply-To:References:List-Id:List-Post:From:\n\tList-Subscribe:List-Unsubscribe:List-Archive:Reply-To:List-Help:\n\tSubject:From;\n\tb=XtSQsjRwZ80+7+oYpKGRoCmncWkAOvp5i4/SeMW3sx5P49Ss4/TlW8xhZGz2a0Nh7\n\tzUvxbJu7Edad1Krhpd3OWI4CpI8lrEcnbBX2nuWYv97+G9sB3X2nnCp5CnylsY4fbd\n\tTddEicmqHM2sRl8iTsH6t+Zh7bv3MnC0d+ZboTC/jUzo/Oxo0OUGBSHpEFX9KqKKSA\n\t2DdgZGNnXG6Ihg6Ea9Ps0AnG9wNuXgiGwLW2TOGHNp1J9nz23xKfZigKFzE0Q0ZD9H\n\tBC6igN2RXsPtH05f5usupeiQlqHYD7RapgDD+PwWKyOcwGjkX2p1yJ1qvV0rjHWz/m\n\tRlFN9k/Yxwt6w==", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 23 Feb 2023 12:49:57 +0000", "In-Reply-To": "<20230223124957.11084-1-naush@raspberrypi.com>", "References": "<20230223124957.11084-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Message-ID": "<mailman.15.1677156593.25031.libcamera-devel@lists.libcamera.org>", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "From": "Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Precedence": "list", "X-Mailman-Version": "2.1.29", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "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/>", "Reply-To": "Naushir Patuck <naush@raspberrypi.com>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "Subject": "[libcamera-devel] [PATCH v1 3/3] pipeline: raspberrypi: Add a\n\tUnicam timeout override config options", "Content-Type": "message/rfc822", "Content-Disposition": "inline", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Add a new parameter to the pipeline handler config file named\n\"unicam_timeout_value_ms\" to allow users to override the automiatically\ncomputed Unicam timeout value.\n\nThis value is given in milliseconds, and setting a value of 0 (the\ndefault value) disables the override.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n .../pipeline/raspberrypi/data/example.yaml | 11 ++++++-\n .../pipeline/raspberrypi/raspberrypi.cpp | 29 ++++++++++++++-----\n 2 files changed, 32 insertions(+), 8 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/data/example.yaml b/src/libcamera/pipeline/raspberrypi/data/example.yaml\nindex ad5f2344384f..5d4ca997b7a0 100644\n--- a/src/libcamera/pipeline/raspberrypi/data/example.yaml\n+++ b/src/libcamera/pipeline/raspberrypi/data/example.yaml\n@@ -32,6 +32,15 @@\n # Override any request from the IPA to drop a number of startup\n # frames.\n #\n- # \"disable_startup_frame_drops\": false\n+ # \"disable_startup_frame_drops\": false,\n+\n+ # Custom timeout value (in ms) for Unicam to use. This overrides\n+ # the value computed by the pipeline handler based on frame\n+ # durations.\n+ #\n+ # Set this value to 0 to use the pipeline handler computed\n+ # timeout value.\n+ #\n+ # \"unicam_timeout_value_ms\": 0\n }\n }\ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 3d04842a2440..7c8c66129014 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -319,6 +319,11 @@ public:\n \t\t * frames.\n \t\t */\n \t\tbool disableStartupFrameDrops;\n+\t\t/*\n+\t\t * Override the Unicam timeout value calculated by the IPA based\n+\t\t * on frame durations.\n+\t\t */\n+\t\tunsigned int unicamTimeoutValue;\n \t};\n \n \tConfig config_;\n@@ -1158,6 +1163,9 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls)\n \n \tdata->state_ = RPiCameraData::State::Idle;\n \n+\tif (data->config_.unicamTimeoutValue)\n+\t\tdata->setCameraTimeout(data->config_.unicamTimeoutValue);\n+\n \t/* Start all streams. */\n \tfor (auto const stream : data->streams_) {\n \t\tret = stream->dev()->streamOn();\n@@ -1715,6 +1723,7 @@ int RPiCameraData::loadPipelineConfiguration()\n \t\t.minUnicamBuffers = 2,\n \t\t.minTotalUnicamBuffers = 4,\n \t\t.disableStartupFrameDrops = false,\n+\t\t.unicamTimeoutValue = 0,\n \t};\n \n \tchar const *configFromEnv = utils::secure_getenv(\"LIBCAMERA_RPI_CONFIG_FILE\");\n@@ -1750,6 +1759,8 @@ int RPiCameraData::loadPipelineConfiguration()\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_.unicamTimeoutValue =\n+\t\tphConfig[\"unicam_timeout_value_ms\"].get<bool>(config_.disableStartupFrameDrops);\n \n \tif (config_.minTotalUnicamBuffers < config_.minUnicamBuffers) {\n \t\tLOG(RPI, Error) << \"Invalid configuration: min_total_unicam_buffers must be >= min_unicam_buffers\";\n@@ -1953,13 +1964,17 @@ void RPiCameraData::setLensControls(const ControlList &controls)\n \n void RPiCameraData::setCameraTimeout(uint32_t maxFrameLengthMs)\n {\n-\t/*\n-\t * Set the dequeue timeout to the larger of 5x the maximum reported\n-\t * frame length advertised by the IPA over a number of frames. Allow\n-\t * a minimum timeout value of 1s.\n-\t */\n-\tutils::Duration timeout =\n-\t\tstd::max<utils::Duration>(1s, 5 * maxFrameLengthMs * 1ms);\n+\tutils::Duration timeout;\n+\n+\tif (!config_.unicamTimeoutValue) {\n+\t\t/*\n+\t\t * Set the dequeue timeout to the larger of 5x the maximum reported\n+\t\t * frame length advertised by the IPA over a number of frames. Allow\n+\t\t * a minimum timeout value of 1s.\n+\t\t */\n+\t\ttimeout = std::max<utils::Duration>(1s, 5 * maxFrameLengthMs * 1ms);\n+\t} else\n+\t\ttimeout = config_.unicamTimeoutValue * 1ms;\n \n \tLOG(RPI, Debug) << \"Setting Unicam timeout to \" << timeout;\n \tunicam_[Unicam::Image].dev()->setDequeueTimeout(timeout);\n", "prefixes": [ "libcamera-devel", "v1", "3/3" ] }