@@ -37,6 +37,7 @@ struct BufferIds {
struct ConfigParams {
uint32 transform;
+ bool sensorHdr;
libcamera.ControlInfoMap sensorControls;
libcamera.ControlInfoMap ispControls;
libcamera.ControlInfoMap lensControls;
@@ -215,6 +215,7 @@ int32_t IpaBase::configure(const IPACameraSensorInfo &sensorInfo, const ConfigPa
setMode(sensorInfo);
mode_.transform = static_cast<libcamera::Transform>(params.transform);
+ mode_.sensorHdr = params.sensorHdr;
/* Pass the camera mode to the CamHelper to setup algorithms. */
helper_->setCameraMode(mode_);
@@ -56,4 +56,6 @@ struct CameraMode {
/* Mode specific analogue gain limits */
double minAnalogueGain;
double maxAnalogueGain;
+ /* sensor HDR state */
+ bool sensorHdr;
};
@@ -1236,6 +1236,16 @@ int CameraData::configureIPA(const CameraConfiguration *config, ipa::RPi::Config
Transform transform = config->orientation / Orientation::Rotate0;
params.transform = static_cast<unsigned int>(transform);
+ /*
+ * Sensor HDR may not change mode size or bit depth, so tell the IPA
+ * if it is enabled.
+ */
+ if (sensor_->controls().count(V4L2_CID_WIDE_DYNAMIC_RANGE)) {
+ ControlList ctrls = sensor_->getControls({ { V4L2_CID_WIDE_DYNAMIC_RANGE } });
+ if (!ctrls.empty())
+ params.sensorHdr = ctrls.get(V4L2_CID_WIDE_DYNAMIC_RANGE).get<int32_t>();
+ }
+
/* Ready the IPA - it must know about the sensor resolution. */
ret = ipa_->configure(sensorInfo_, params, result);
if (ret < 0) {
Some sensors switch HDR through V4L2_CID_WIDE_DYNAMIC_RANGE without changing mode size or bit depth. The IPA currently cannot tell such HDR and linear modes apart, although they need different processing, such as decompanding. Read the control at configure time and store its state in CameraMode for camera helpers and control algorithms. Signed-off-by: Danius Kalvaitis <danius@kurokesu.com> --- include/libcamera/ipa/raspberrypi.mojom | 1 + src/ipa/rpi/common/ipa_base.cpp | 1 + src/ipa/rpi/controller/camera_mode.h | 2 ++ src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 10 ++++++++++ 4 files changed, 14 insertions(+)