summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNaushir Patuck <naush@raspberrypi.com>2023-03-07 10:30:23 +0000
committerKieran Bingham <kieran.bingham@ideasonboard.com>2023-03-07 21:55:05 +0000
commit471cbc0ef7098c720a7395fa2f90cb3acdec7c4c (patch)
tree5546c87ba55d75ff7f6a17c5686f781ba69a4041 /src
parent9648e859946bfd5e2eb30cf2655777670d24ccfb (diff)
pipeline: raspberrypi: Add a Unicam timeout override config options
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 <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/pipeline/raspberrypi/data/example.yaml11
-rw-r--r--src/libcamera/pipeline/raspberrypi/raspberrypi.cpp14
2 files changed, 24 insertions, 1 deletions
diff --git a/src/libcamera/pipeline/raspberrypi/data/example.yaml b/src/libcamera/pipeline/raspberrypi/data/example.yaml
index ad5f2344..c90f518f 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 3d04842a..58bab6b6 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<unsigned int>(config_.minTotalUnicamBuffers);
config_.disableStartupFrameDrops =
phConfig["disable_startup_frame_drops"].get<bool>(config_.disableStartupFrameDrops);
+ config_.unicamTimeoutValue =
+ phConfig["unicam_timeout_value_ms"].get<unsigned int>(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";