summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ipa/raspberrypi/raspberrypi.cpp2
-rw-r--r--src/libcamera/pipeline/raspberrypi/raspberrypi.cpp24
2 files changed, 17 insertions, 9 deletions
diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
index 9b08ae4c..f6826bf2 100644
--- a/src/ipa/raspberrypi/raspberrypi.cpp
+++ b/src/ipa/raspberrypi/raspberrypi.cpp
@@ -341,7 +341,7 @@ void IPARPi::start(const ControlList &controls, StartConfig *startConfig)
startConfig->dropFrameCount = dropFrameCount_;
const Duration maxSensorFrameDuration = mode_.maxFrameLength * mode_.maxLineLength;
- startConfig->maxSensorFrameLengthMs = maxSensorFrameDuration.get<std::milli>();
+ setCameraTimeout.emit(maxSensorFrameDuration.get<std::milli>());
firstStart_ = false;
lastRunTimestamp_ = 0;
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 84120954..3d04842a 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -212,6 +212,7 @@ public:
void setIspControls(const ControlList &controls);
void setDelayedControls(const ControlList &controls, uint32_t delayContext);
void setLensControls(const ControlList &controls);
+ void setCameraTimeout(uint32_t maxExposureTimeMs);
void setSensorControls(ControlList &controls);
void unicamTimeout();
@@ -1166,14 +1167,6 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls)
}
}
- /*
- * Set the dequeue timeout to the larger of 2x the maximum possible
- * frame duration or 1 second.
- */
- utils::Duration timeout =
- std::max<utils::Duration>(1s, 2 * startConfig.maxSensorFrameLengthMs * 1ms);
- data->unicam_[Unicam::Image].dev()->setDequeueTimeout(timeout);
-
return 0;
}
@@ -1645,6 +1638,7 @@ int RPiCameraData::loadIPA(ipa::RPi::IPAInitResult *result)
ipa_->setIspControls.connect(this, &RPiCameraData::setIspControls);
ipa_->setDelayedControls.connect(this, &RPiCameraData::setDelayedControls);
ipa_->setLensControls.connect(this, &RPiCameraData::setLensControls);
+ ipa_->setCameraTimeout.connect(this, &RPiCameraData::setCameraTimeout);
/*
* The configuration (tuning file) is made from the sensor name unless
@@ -1957,6 +1951,20 @@ void RPiCameraData::setLensControls(const ControlList &controls)
}
}
+void RPiCameraData::setCameraTimeout(uint32_t maxFrameLengthMs)
+{
+ /*
+ * Set the dequeue timeout to the larger of 5x the maximum reported
+ * frame length advertised by the IPA over a number of frames. Allow
+ * a minimum timeout value of 1s.
+ */
+ utils::Duration timeout =
+ std::max<utils::Duration>(1s, 5 * maxFrameLengthMs * 1ms);
+
+ LOG(RPI, Debug) << "Setting Unicam timeout to " << timeout;
+ unicam_[Unicam::Image].dev()->setDequeueTimeout(timeout);
+}
+
void RPiCameraData::setSensorControls(ControlList &controls)
{
/*