{"id":18334,"url":"https://patchwork.libcamera.org/api/1.1/patches/18334/?format=json","web_url":"https://patchwork.libcamera.org/patch/18334/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<mailman.58.1677765273.25031.libcamera-devel@lists.libcamera.org>","date":"2023-03-02T13:54:29","name":"[libcamera-devel,v2,3/3] pipeline: raspberrypi: Add a Unicam timeout override config options","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"bcf49b5819e2cc4fc89557140b00188933f1fea2","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18334/mbox/","series":[{"id":3784,"url":"https://patchwork.libcamera.org/api/1.1/series/3784/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3784","date":"2023-03-02T13:54:26","name":"Raspberry Pi: Improving camera timeouts","version":2,"mbox":"https://patchwork.libcamera.org/series/3784/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18334/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18334/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 A5BB3C329C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  2 Mar 2023 13:54:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BCD92626EB;\n\tThu,  2 Mar 2023 14:54:34 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1677765274;\n\tbh=jduccelxlH2i28khcmaLGCPGUXhx5ZPLJ0/L5zT9sus=;\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=fyEhXgJVQi/3dhaKqeNWiy99pyFn8Kd6d35SY2f84z1pxpdanyhLBaOUb82TaF0+i\n\tpEoasqJGNwAwk9PL8r8DsmApKcCj7Xfbfm9PUzbUDLVMjPTHkzCmHtrX/Nrz5ePkwD\n\tpYAsU7+WfGGuXu4ZxrU60XewVb8w/EVFd8S2rFv6+ci+yFOO8TkMHjCsn9z3/IhE46\n\tFLFQIJcJn9VK6nzxgCSoEjGcACD0Ztnk9IGL+nYn22uwL24sjg+pl5pRrQj1w3lAuu\n\tirjtvEDx/5D90RJqSvAFI2jUG//8zgy+9XJ1ZgTwq3gMIKO4lAv1vdnFyew0QVQiwv\n\tNf4u1lSGp9QSw==","To":"libcamera-devel@lists.libcamera.org","Date":"Thu,  2 Mar 2023 13:54:29 +0000","In-Reply-To":"<20230302135429.23821-1-naush@raspberrypi.com>","References":"<20230302135429.23821-1-naush@raspberrypi.com>","MIME-Version":"1.0","Message-ID":"<mailman.58.1677765273.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 v2 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>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n---\n .../pipeline/raspberrypi/data/example.yaml         | 11 ++++++++++-\n src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 14 ++++++++++++++\n 2 files changed, 24 insertions(+), 1 deletion(-)","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..6b0880c579eb 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@@ -1715,6 +1720,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 +1756,14 @@ 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<unsigned int>(config_.unicamTimeoutValue);\n+\n+\tif (config_.unicamTimeoutValue) {\n+\t\t/* Disable the IPA signal to control timeout and set the user requested value. */\n+\t\tunicam_[Unicam::Image].dev()->dequeueTimeout.disconnect();\n+\t\tunicam_[Unicam::Image].dev()->setDequeueTimeout(config_.unicamTimeoutValue * 1ms);\n+\t}\n \n \tif (config_.minTotalUnicamBuffers < config_.minUnicamBuffers) {\n \t\tLOG(RPI, Error) << \"Invalid configuration: min_total_unicam_buffers must be >= min_unicam_buffers\";\n","prefixes":["libcamera-devel","v2","3/3"]}