mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-13 15:29:45 +03:00
delayed_controls: Remove reduandant firstSequence_
The DelayedControls implementation tracked the sequence numbers to determine the offset if a device did not commence with a sequence number of 0. This guarantee is now handled by the V4L2VideoDevice. Remove the firstSequence_ offset and the corresponding running_ flag which was used to track setting firstSequence_ from the DelayedControls. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
b3fd8e14b5
commit
6f539a6d2f
2 changed files with 2 additions and 13 deletions
|
@ -72,9 +72,6 @@ private:
|
||||||
std::unordered_map<const ControlId *, ControlParams> controlParams_;
|
std::unordered_map<const ControlId *, ControlParams> controlParams_;
|
||||||
unsigned int maxDelay_;
|
unsigned int maxDelay_;
|
||||||
|
|
||||||
bool running_;
|
|
||||||
uint32_t firstSequence_;
|
|
||||||
|
|
||||||
uint32_t queueCount_;
|
uint32_t queueCount_;
|
||||||
uint32_t writeCount_;
|
uint32_t writeCount_;
|
||||||
/* \todo Evaluate if we should index on ControlId * or unsigned int */
|
/* \todo Evaluate if we should index on ControlId * or unsigned int */
|
||||||
|
|
|
@ -115,8 +115,6 @@ DelayedControls::DelayedControls(V4L2Device *device,
|
||||||
*/
|
*/
|
||||||
void DelayedControls::reset()
|
void DelayedControls::reset()
|
||||||
{
|
{
|
||||||
running_ = false;
|
|
||||||
firstSequence_ = 0;
|
|
||||||
queueCount_ = 1;
|
queueCount_ = 1;
|
||||||
writeCount_ = 0;
|
writeCount_ = 0;
|
||||||
|
|
||||||
|
@ -204,8 +202,7 @@ bool DelayedControls::push(const ControlList &controls)
|
||||||
*/
|
*/
|
||||||
ControlList DelayedControls::get(uint32_t sequence)
|
ControlList DelayedControls::get(uint32_t sequence)
|
||||||
{
|
{
|
||||||
uint32_t adjustedSeq = sequence - firstSequence_;
|
unsigned int index = std::max<int>(0, sequence - maxDelay_);
|
||||||
unsigned int index = std::max<int>(0, adjustedSeq - maxDelay_);
|
|
||||||
|
|
||||||
ControlList out(device_->controls());
|
ControlList out(device_->controls());
|
||||||
for (const auto &ctrl : values_) {
|
for (const auto &ctrl : values_) {
|
||||||
|
@ -236,11 +233,6 @@ void DelayedControls::applyControls(uint32_t sequence)
|
||||||
{
|
{
|
||||||
LOG(DelayedControls, Debug) << "frame " << sequence << " started";
|
LOG(DelayedControls, Debug) << "frame " << sequence << " started";
|
||||||
|
|
||||||
if (!running_) {
|
|
||||||
firstSequence_ = sequence;
|
|
||||||
running_ = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create control list peeking ahead in the value queue to ensure
|
* Create control list peeking ahead in the value queue to ensure
|
||||||
* values are set in time to satisfy the sensor delay.
|
* values are set in time to satisfy the sensor delay.
|
||||||
|
@ -279,7 +271,7 @@ void DelayedControls::applyControls(uint32_t sequence)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
writeCount_ = sequence - firstSequence_ + 1;
|
writeCount_ = sequence + 1;
|
||||||
|
|
||||||
while (writeCount_ > queueCount_) {
|
while (writeCount_ > queueCount_) {
|
||||||
LOG(DelayedControls, Debug)
|
LOG(DelayedControls, Debug)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue