summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNaushir Patuck <naush@raspberrypi.com>2022-10-06 14:17:39 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-10-18 03:09:52 +0300
commitaa2fe6a86f260a9351621af3c110ee0fcbac7e8d (patch)
tree75de969da59438428b4dcb23d13543d1fc46b730 /src
parentf694da76bea11f47d21f41b396d901af2f165a2a (diff)
pipeline: ipa: raspberrypi: Add HBLANK control to DelayedControls
Update CamHelper::getDelays() to return the sensor HBLANK delay. The HBLANK delay is set to the same value as VBLANK delay for all sensors in the Raspberry Pi IPA. Return the HBLANK gain delay from the IPA to the pipeline handler, and initialise DelayedControls to handle V4L2_CID_HBLANK with this delay value. As a drive-by, check that the V4L2_CID_HBLANK control is available when calling IPARPi::configure(). Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Tested-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/ipa/raspberrypi/cam_helper.cpp3
-rw-r--r--src/ipa/raspberrypi/cam_helper.h2
-rw-r--r--src/ipa/raspberrypi/cam_helper_imx290.cpp5
-rw-r--r--src/ipa/raspberrypi/cam_helper_imx296.cpp6
-rw-r--r--src/ipa/raspberrypi/cam_helper_imx477.cpp5
-rw-r--r--src/ipa/raspberrypi/cam_helper_imx519.cpp5
-rw-r--r--src/ipa/raspberrypi/cam_helper_ov5647.cpp5
-rw-r--r--src/ipa/raspberrypi/cam_helper_ov9281.cpp5
-rw-r--r--src/ipa/raspberrypi/raspberrypi.cpp6
-rw-r--r--src/libcamera/pipeline/raspberrypi/raspberrypi.cpp1
10 files changed, 27 insertions, 16 deletions
diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp
index 45214531..dd7236f1 100644
--- a/src/ipa/raspberrypi/cam_helper.cpp
+++ b/src/ipa/raspberrypi/cam_helper.cpp
@@ -107,7 +107,7 @@ void CamHelper::setCameraMode(const CameraMode &mode)
}
void CamHelper::getDelays(int &exposureDelay, int &gainDelay,
- int &vblankDelay) const
+ int &vblankDelay, int &hblankDelay) const
{
/*
* These values are correct for many sensors. Other sensors will
@@ -116,6 +116,7 @@ void CamHelper::getDelays(int &exposureDelay, int &gainDelay,
exposureDelay = 2;
gainDelay = 1;
vblankDelay = 2;
+ hblankDelay = 2;
}
bool CamHelper::sensorEmbeddedDataPresent() const
diff --git a/src/ipa/raspberrypi/cam_helper.h b/src/ipa/raspberrypi/cam_helper.h
index 6771829a..db2387af 100644
--- a/src/ipa/raspberrypi/cam_helper.h
+++ b/src/ipa/raspberrypi/cam_helper.h
@@ -88,7 +88,7 @@ public:
virtual uint32_t gainCode(double gain) const = 0;
virtual double gain(uint32_t gainCode) const = 0;
virtual void getDelays(int &exposureDelay, int &gainDelay,
- int &vblankDelay) const;
+ int &vblankDelay, int &hblankDelay) const;
virtual bool sensorEmbeddedDataPresent() const;
virtual double getModeSensitivity(const CameraMode &mode) const;
virtual unsigned int hideFramesStartup() const;
diff --git a/src/ipa/raspberrypi/cam_helper_imx290.cpp b/src/ipa/raspberrypi/cam_helper_imx290.cpp
index 25f23d53..7d6f5b54 100644
--- a/src/ipa/raspberrypi/cam_helper_imx290.cpp
+++ b/src/ipa/raspberrypi/cam_helper_imx290.cpp
@@ -18,7 +18,7 @@ public:
uint32_t gainCode(double gain) const override;
double gain(uint32_t gainCode) const override;
void getDelays(int &exposureDelay, int &gainDelay,
- int &vblankDelay) const override;
+ int &vblankDelay, int &hblankDelay) const override;
unsigned int hideFramesModeSwitch() const override;
private:
@@ -46,11 +46,12 @@ double CamHelperImx290::gain(uint32_t gainCode) const
}
void CamHelperImx290::getDelays(int &exposureDelay, int &gainDelay,
- int &vblankDelay) const
+ int &vblankDelay, int &hblankDelay) const
{
exposureDelay = 2;
gainDelay = 2;
vblankDelay = 2;
+ hblankDelay = 2;
}
unsigned int CamHelperImx290::hideFramesModeSwitch() const
diff --git a/src/ipa/raspberrypi/cam_helper_imx296.cpp b/src/ipa/raspberrypi/cam_helper_imx296.cpp
index d86ff387..ecb845e7 100644
--- a/src/ipa/raspberrypi/cam_helper_imx296.cpp
+++ b/src/ipa/raspberrypi/cam_helper_imx296.cpp
@@ -23,7 +23,8 @@ public:
double gain(uint32_t gainCode) const override;
uint32_t exposureLines(const Duration exposure, const Duration lineLength) const override;
Duration exposure(uint32_t exposureLines, const Duration lineLength) const override;
- void getDelays(int &exposureDelay, int &gainDelay, int &vblankDelay) const override;
+ void getDelays(int &exposureDelay, int &gainDelay,
+ int &vblankDelay, int &hblankDelay) const override;
private:
static constexpr uint32_t minExposureLines = 1;
@@ -66,11 +67,12 @@ Duration CamHelperImx296::exposure(uint32_t exposureLines,
}
void CamHelperImx296::getDelays(int &exposureDelay, int &gainDelay,
- int &vblankDelay) const
+ int &vblankDelay, int &hblankDelay) const
{
exposureDelay = 2;
gainDelay = 2;
vblankDelay = 2;
+ hblankDelay = 2;
}
static CamHelper *create()
diff --git a/src/ipa/raspberrypi/cam_helper_imx477.cpp b/src/ipa/raspberrypi/cam_helper_imx477.cpp
index 71529bdd..76a82cc5 100644
--- a/src/ipa/raspberrypi/cam_helper_imx477.cpp
+++ b/src/ipa/raspberrypi/cam_helper_imx477.cpp
@@ -49,7 +49,7 @@ public:
uint32_t getVBlanking(Duration &exposure, Duration minFrameDuration,
Duration maxFrameDuration) const override;
void getDelays(int &exposureDelay, int &gainDelay,
- int &vblankDelay) const override;
+ int &vblankDelay, int &hblankDelay) const override;
bool sensorEmbeddedDataPresent() const override;
private:
@@ -153,11 +153,12 @@ uint32_t CamHelperImx477::getVBlanking(Duration &exposure,
}
void CamHelperImx477::getDelays(int &exposureDelay, int &gainDelay,
- int &vblankDelay) const
+ int &vblankDelay, int &hblankDelay) const
{
exposureDelay = 2;
gainDelay = 2;
vblankDelay = 3;
+ hblankDelay = 3;
}
bool CamHelperImx477::sensorEmbeddedDataPresent() const
diff --git a/src/ipa/raspberrypi/cam_helper_imx519.cpp b/src/ipa/raspberrypi/cam_helper_imx519.cpp
index 2c120dad..9dff1eeb 100644
--- a/src/ipa/raspberrypi/cam_helper_imx519.cpp
+++ b/src/ipa/raspberrypi/cam_helper_imx519.cpp
@@ -49,7 +49,7 @@ public:
uint32_t getVBlanking(Duration &exposure, Duration minFrameDuration,
Duration maxFrameDuration) const override;
void getDelays(int &exposureDelay, int &gainDelay,
- int &vblankDelay) const override;
+ int &vblankDelay, int &hblankDelay) const override;
bool sensorEmbeddedDataPresent() const override;
private:
@@ -153,11 +153,12 @@ uint32_t CamHelperImx519::getVBlanking(Duration &exposure,
}
void CamHelperImx519::getDelays(int &exposureDelay, int &gainDelay,
- int &vblankDelay) const
+ int &vblankDelay, int &hblankDelay) const
{
exposureDelay = 2;
gainDelay = 2;
vblankDelay = 3;
+ hblankDelay = 3;
}
bool CamHelperImx519::sensorEmbeddedDataPresent() const
diff --git a/src/ipa/raspberrypi/cam_helper_ov5647.cpp b/src/ipa/raspberrypi/cam_helper_ov5647.cpp
index 04fb725d..5a99083d 100644
--- a/src/ipa/raspberrypi/cam_helper_ov5647.cpp
+++ b/src/ipa/raspberrypi/cam_helper_ov5647.cpp
@@ -18,7 +18,7 @@ public:
uint32_t gainCode(double gain) const override;
double gain(uint32_t gainCode) const override;
void getDelays(int &exposureDelay, int &gainDelay,
- int &vblankDelay) const override;
+ int &vblankDelay, int &hblankDelay) const override;
unsigned int hideFramesStartup() const override;
unsigned int hideFramesModeSwitch() const override;
unsigned int mistrustFramesStartup() const override;
@@ -53,7 +53,7 @@ double CamHelperOv5647::gain(uint32_t gainCode) const
}
void CamHelperOv5647::getDelays(int &exposureDelay, int &gainDelay,
- int &vblankDelay) const
+ int &vblankDelay, int &hblankDelay) const
{
/*
* We run this sensor in a mode where the gain delay is bumped up to
@@ -62,6 +62,7 @@ void CamHelperOv5647::getDelays(int &exposureDelay, int &gainDelay,
exposureDelay = 2;
gainDelay = 2;
vblankDelay = 2;
+ hblankDelay = 2;
}
unsigned int CamHelperOv5647::hideFramesStartup() const
diff --git a/src/ipa/raspberrypi/cam_helper_ov9281.cpp b/src/ipa/raspberrypi/cam_helper_ov9281.cpp
index 66f56a31..86c5bc4c 100644
--- a/src/ipa/raspberrypi/cam_helper_ov9281.cpp
+++ b/src/ipa/raspberrypi/cam_helper_ov9281.cpp
@@ -18,7 +18,7 @@ public:
uint32_t gainCode(double gain) const override;
double gain(uint32_t gainCode) const override;
void getDelays(int &exposureDelay, int &gainDelay,
- int &vblankDelay) const override;
+ int &vblankDelay, int &hblankDelay) const override;
private:
/*
@@ -49,12 +49,13 @@ double CamHelperOv9281::gain(uint32_t gainCode) const
}
void CamHelperOv9281::getDelays(int &exposureDelay, int &gainDelay,
- int &vblankDelay) const
+ int &vblankDelay, int &hblankDelay) const
{
/* The driver appears to behave as follows: */
exposureDelay = 2;
gainDelay = 2;
vblankDelay = 2;
+ hblankDelay = 2;
}
static CamHelper *create()
diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
index 560b61bd..126a48d0 100644
--- a/src/ipa/raspberrypi/raspberrypi.cpp
+++ b/src/ipa/raspberrypi/raspberrypi.cpp
@@ -219,13 +219,14 @@ int IPARPi::init(const IPASettings &settings, IPAInitResult *result)
* Pass out the sensor config to the pipeline handler in order
* to setup the staggered writer class.
*/
- int gainDelay, exposureDelay, vblankDelay, sensorMetadata;
- helper_->getDelays(exposureDelay, gainDelay, vblankDelay);
+ int gainDelay, exposureDelay, vblankDelay, hblankDelay, sensorMetadata;
+ helper_->getDelays(exposureDelay, gainDelay, vblankDelay, hblankDelay);
sensorMetadata = helper_->sensorEmbeddedDataPresent();
result->sensorConfig.gainDelay = gainDelay;
result->sensorConfig.exposureDelay = exposureDelay;
result->sensorConfig.vblankDelay = vblankDelay;
+ result->sensorConfig.hblankDelay = hblankDelay;
result->sensorConfig.sensorMetadata = sensorMetadata;
/* Load the tuning file for this sensor. */
@@ -606,6 +607,7 @@ bool IPARPi::validateSensorControls()
V4L2_CID_ANALOGUE_GAIN,
V4L2_CID_EXPOSURE,
V4L2_CID_VBLANK,
+ V4L2_CID_HBLANK,
};
for (auto c : ctrls) {
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index d366a8be..343f8cb2 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -1297,6 +1297,7 @@ int PipelineHandlerRPi::registerCamera(MediaDevice *unicam, MediaDevice *isp, Me
std::unordered_map<uint32_t, DelayedControls::ControlParams> params = {
{ V4L2_CID_ANALOGUE_GAIN, { result.sensorConfig.gainDelay, false } },
{ V4L2_CID_EXPOSURE, { result.sensorConfig.exposureDelay, false } },
+ { V4L2_CID_HBLANK, { result.sensorConfig.hblankDelay, false } },
{ V4L2_CID_VBLANK, { result.sensorConfig.vblankDelay, true } }
};
data->delayedCtrls_ = std::make_unique<DelayedControls>(data->sensor_->device(), params);