summaryrefslogtreecommitdiff
path: root/src/ipa/rpi/common/ipa_base.cpp
diff options
context:
space:
mode:
authorNaushir Patuck <naush@raspberrypi.com>2024-01-04 11:38:55 +0000
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-01-05 00:40:28 +0200
commit271598618d81c99fa047f22297df56433321f9b7 (patch)
tree8d3b1d5d94ae6315c8cc68bdae9c12f6a6083c00 /src/ipa/rpi/common/ipa_base.cpp
parent577e0c6b7659f24c04476e675ea85cb666a87764 (diff)
ipa: rpi: Add hardware line rate constraints
Advertise hardware constraints on the pixel processing rate through the Controller::HardwareConfig structure. When calculating the minimum line length during a configure() operation, ensure that we don't exceed this constraint. If we do exceed the hardware constraints, increase the modes's minimum line length so the pixel processing rate falls below the hardware limit. If this is not possible, throw a loud error message in the logs. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/ipa/rpi/common/ipa_base.cpp')
-rw-r--r--src/ipa/rpi/common/ipa_base.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp
index 6ac9d5de..6ec91575 100644
--- a/src/ipa/rpi/common/ipa_base.cpp
+++ b/src/ipa/rpi/common/ipa_base.cpp
@@ -532,6 +532,33 @@ void IpaBase::setMode(const IPACameraSensorInfo &sensorInfo)
mode_.maxLineLength = sensorInfo.maxLineLength * (1.0s / sensorInfo.pixelRate);
/*
+ * Ensure that the maximum pixel processing rate does not exceed the ISP
+ * hardware capabilities. If it does, try adjusting the minimum line
+ * length to compensate if possible.
+ */
+ Duration minPixelTime = controller_.getHardwareConfig().minPixelProcessingTime;
+ Duration pixelTime = mode_.minLineLength / mode_.width;
+ if (minPixelTime && pixelTime < minPixelTime) {
+ Duration adjustedLineLength = minPixelTime * mode_.width;
+ if (adjustedLineLength <= mode_.maxLineLength) {
+ LOG(IPARPI, Info)
+ << "Adjusting mode minimum line length from " << mode_.minLineLength
+ << " to " << adjustedLineLength << " because of ISP constraints.";
+ mode_.minLineLength = adjustedLineLength;
+ } else {
+ LOG(IPARPI, Error)
+ << "Sensor minimum line length of " << pixelTime * mode_.width
+ << " (" << 1us / pixelTime << " MPix/s)"
+ << " is below the minimum allowable ISP limit of "
+ << adjustedLineLength
+ << " (" << 1us / minPixelTime << " MPix/s) ";
+ LOG(IPARPI, Error)
+ << "THIS WILL CAUSE IMAGE CORRUPTION!!! "
+ << "Please update the camera sensor driver to allow more horizontal blanking control.";
+ }
+ }
+
+ /*
* Set the frame length limits for the mode to ensure exposure and
* framerate calculations are clipped appropriately.
*/