summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNaushir Patuck <naush@raspberrypi.com>2021-03-04 08:17:22 +0000
committerKieran Bingham <kieran.bingham@ideasonboard.com>2021-03-12 14:12:32 +0000
commit96c0eb338e5e9168147538736b688601c00b87f9 (patch)
treec14b4bbb4865f6c77e36c77195fad5d54f92d750 /include
parent6795ffe67f3318e474ee14141e5b394b0e5d2d85 (diff)
libcamera: delayed_controls: Add notion of priority write
If an exposure time change adjusts the vblanking limits, and we set both VBLANK and EXPOSURE controls through the VIDIOC_S_EXT_CTRLS ioctl, the latter may fail if the value is outside of the limits calculated by the old VBLANK value. This is a limitation in V4L2 and cannot be fixed by setting VBLANK before EXPOSURE in a single VIDIOC_S_EXT_CTRLS ioctl. The workaround here is to have the DelayedControls object mark the VBLANK control as "priority write", which then write VBLANK separately from (and ahead of) any other controls. This way, the sensor driver will update the EXPOSURE control with new limits before the new values is presented, and will thus be seen as valid. To support this, a new struct DelayedControls::ControlParams is used in the constructor to provide the control delay value as well as the priority write flag. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Tested-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> [Kieran: Fix up trivial comments, merge conflicts] Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/internal/delayed_controls.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/libcamera/internal/delayed_controls.h b/include/libcamera/internal/delayed_controls.h
index dc447a88..564d9f2e 100644
--- a/include/libcamera/internal/delayed_controls.h
+++ b/include/libcamera/internal/delayed_controls.h
@@ -19,8 +19,13 @@ class V4L2Device;
class DelayedControls
{
public:
+ struct ControlParams {
+ unsigned int delay;
+ bool priorityWrite;
+ };
+
DelayedControls(V4L2Device *device,
- const std::unordered_map<uint32_t, unsigned int> &delays);
+ const std::unordered_map<uint32_t, ControlParams> &controlParams);
void reset();
@@ -64,7 +69,7 @@ private:
V4L2Device *device_;
/* \todo Evaluate if we should index on ControlId * or unsigned int */
- std::unordered_map<const ControlId *, unsigned int> delays_;
+ std::unordered_map<const ControlId *, ControlParams> controlParams_;
unsigned int maxDelay_;
bool running_;