From patchwork Tue Mar 7 10:30:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18349 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 222EBC329C for ; Tue, 7 Mar 2023 10:30:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 26EFD626C9; Tue, 7 Mar 2023 11:30:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1678185024; bh=lGYbbxoqtpGGSf8cC/frHzgSz4mi2oydf29mWnS4u/s=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=mzNDEKDAktkrNkXfVlaT4VNytGQuv079FI9ze9atp/swXtIAJuQSJ5LYlRbPU/7Q+ mxp53dBy0KZTXl89jKVH38O535vNBV/7573A0EFO7QvKt8FmsZRJbbCqnDD0Gi1BjX G3WfHKC2aY8R4hZtiUS+JBxe18lAM5P5QUzg6bW5CCV8mCchF/muUaUeoCMbZGmnh1 SMw5xrseZTqMdLEqnb7oTUdGAvI+JwG1uFkZs3AH3crqKB36K6RvVIilBpCVfL5/1m MV7XmjbtQKRRVATs+5IwQlE4joEjik7MYOjwQFSaiTAuFNTvvYK/pCAJSscrw+J5it SEJY487H1MxOQ== Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A4F77626B0 for ; Tue, 7 Mar 2023 11:30:21 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="RpjGoED6"; dkim-atps=neutral Received: by mail-wr1-x434.google.com with SMTP id e13so11572012wro.10 for ; Tue, 07 Mar 2023 02:30:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1678185021; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hf459/AQVIscT2N7Fl1SGWffRnnAiMEDRDiXUOvhwZQ=; b=RpjGoED6Z2R5cMy6MmTrUBs+dBXru/YHq7FiGyradTXMaq+MjoScdkFftSW71GGL5O 4kZxmMDPEsf4NBbc1BqM+MvbL3AniKHh3vEOT7YzzJcz6L+O0uOv0ykBtVMe7jAhFgBC D/ZXWH1mV1dsZrbrwzLVPEs7DK+EMKbSR9HZdVFXtQG8BcMdaZORZsnQOV2A6/bU5waa fxCx5o33AROD5wYheQBOKTkBAowYT1Bx99KjXfnRF+Gm9/fClADuKVlnd+rgML2jUPJ5 dJKvZs4OI38nw2RJagejSGBnSDuojOd/jO5DWlpnCsNSk7Xnlo5V1IU/R9KjO/rAGt9f 9GuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678185021; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hf459/AQVIscT2N7Fl1SGWffRnnAiMEDRDiXUOvhwZQ=; b=B02xWH6mLSDQZDGS4tmwTqKTbt/Z5bLWKUIMdLXWw37b/aOAuogaqGAri6CMxOcoyJ cq0N72+HeziP++RcRdkQVfQQLEJtDlUDktk0EyXUFpmjGefeUOPPBDafTBfb1cj6P3PR PT1+swTy8H3ssLvdt9Z7d13H0W76z25wjoPZLPqwCj2DpYxbMqhCca3UabyEXtl0GHvG fI1R8aMIGmfrgz1sCfHX9n280k67NGd3NX3IYqvShb5EUO4oXVXNuV6lOOHCdYWEAtRQ 5f7qchWit2NmGnTsQxNwZWkATqi1s1O7n1UL09yuSVCHXV3l7BLiKwWp1yI7xCtZD7lZ HiXw== X-Gm-Message-State: AO0yUKU0jY8oVWSSIM0JFvGILiXtHCJ0OG19AJsdG5mTVpacKZcMPVy6 zCmGW7TL+v0t1kZUPo/USopY5MY5BPLShWoiw6bMGQ== X-Google-Smtp-Source: AK7set/CrvW9fikQXhI0yhCk1XSp3F7Tkyt8l7v1GaPu72mxGmtHHex5yTYwhGU86bs/8Lv+mFCXQw== X-Received: by 2002:a05:6000:c4:b0:2c7:5247:e496 with SMTP id q4-20020a05600000c400b002c75247e496mr7801252wrx.60.1678185021068; Tue, 07 Mar 2023 02:30:21 -0800 (PST) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id r1-20020a056000014100b002c5534db60bsm12523621wrx.71.2023.03.07.02.30.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 02:30:20 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Tue, 7 Mar 2023 10:30:23 +0000 Message-Id: <20230307103023.3932-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230307103023.3932-1-naush@raspberrypi.com> References: <20230307103023.3932-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 3/3] pipeline: raspberrypi: Add a Unicam timeout override config options X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Cc: Jacopo Mondi Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add a new parameter to the pipeline handler config file named "unicam_timeout_value_ms" to allow users to override the automatically computed Unicam timeout value. This value is given in milliseconds, and setting a value of 0 (the default value) disables the override. An example use of this parameter would be if an application configured a RAW stream, and provides buffers for the stream on every request. If the application holds off on sending requests for a particular reason (e.g. a timelapse use case), then we will possibly hit the watchdog timeout as it is only a small multiple of the frame length. This override allows an application to select a larger value with the knowledge that it may space requests longer than the calculated timeout value. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Reviewed-by: Jacopo Mondi --- .../pipeline/raspberrypi/data/example.yaml | 11 ++++++++++- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 14 ++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/raspberrypi/data/example.yaml b/src/libcamera/pipeline/raspberrypi/data/example.yaml index ad5f2344384f..c90f518f8849 100644 --- a/src/libcamera/pipeline/raspberrypi/data/example.yaml +++ b/src/libcamera/pipeline/raspberrypi/data/example.yaml @@ -32,6 +32,15 @@ # Override any request from the IPA to drop a number of startup # frames. # - # "disable_startup_frame_drops": false + # "disable_startup_frame_drops": false, + + # Custom timeout value (in ms) for Unicam to use. This overrides + # the value computed by the pipeline handler based on frame + # durations. + # + # Set this value to 0 to use the pipeline handler computed + # timeout value. + # + # "unicam_timeout_value_ms": 0, } } diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 3d04842a2440..58bab6b6e0d5 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -319,6 +319,11 @@ public: * frames. */ bool disableStartupFrameDrops; + /* + * Override the Unicam timeout value calculated by the IPA based + * on frame durations. + */ + unsigned int unicamTimeoutValue; }; Config config_; @@ -1715,6 +1720,7 @@ int RPiCameraData::loadPipelineConfiguration() .minUnicamBuffers = 2, .minTotalUnicamBuffers = 4, .disableStartupFrameDrops = false, + .unicamTimeoutValue = 0, }; char const *configFromEnv = utils::secure_getenv("LIBCAMERA_RPI_CONFIG_FILE"); @@ -1750,6 +1756,14 @@ int RPiCameraData::loadPipelineConfiguration() phConfig["min_total_unicam_buffers"].get(config_.minTotalUnicamBuffers); config_.disableStartupFrameDrops = phConfig["disable_startup_frame_drops"].get(config_.disableStartupFrameDrops); + config_.unicamTimeoutValue = + phConfig["unicam_timeout_value_ms"].get(config_.unicamTimeoutValue); + + if (config_.unicamTimeoutValue) { + /* Disable the IPA signal to control timeout and set the user requested value. */ + ipa_->setCameraTimeout.disconnect(); + unicam_[Unicam::Image].dev()->setDequeueTimeout(config_.unicamTimeoutValue * 1ms); + } if (config_.minTotalUnicamBuffers < config_.minUnicamBuffers) { LOG(RPI, Error) << "Invalid configuration: min_total_unicam_buffers must be >= min_unicam_buffers";