libcamera: camera: Fix up the AeEnable control during Camera::start()
In Camera::queueRequest() the control list is updated transparently by
converting AeEnable into ExposureTimeMode and AnalogueGainMode
controls.
However, this was not happening during Camera::start(), meaning that
setting AeEnable there was having no effect. It should behave the same
here too.
Fixes: 7abd413905 ("libcamera: camera: Pre-process AeEnable control")
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
committed by
Kieran Bingham
parent
486e042669
commit
1d65c02e71
@@ -165,6 +165,8 @@ private:
|
||||
friend class FrameBufferAllocator;
|
||||
int exportFrameBuffers(Stream *stream,
|
||||
std::vector<std::unique_ptr<FrameBuffer>> *buffers);
|
||||
|
||||
void patchControlList(ControlList &controls);
|
||||
};
|
||||
|
||||
} /* namespace libcamera */
|
||||
|
||||
@@ -1275,6 +1275,33 @@ std::unique_ptr<Request> Camera::createRequest(uint64_t cookie)
|
||||
return request;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Patch a control list that contains the AeEnable control
|
||||
* \param[inout] controls The control list to be patched
|
||||
*
|
||||
* The control list is patched in place, turning the AeEnable control into
|
||||
* the equivalent ExposureTimeMode/AnalogueGainMode controls.
|
||||
*/
|
||||
void Camera::patchControlList(ControlList &controls)
|
||||
{
|
||||
const auto &aeEnable = controls.get(controls::AeEnable);
|
||||
if (aeEnable) {
|
||||
if (_d()->controlInfo_.count(controls::AnalogueGainMode.id()) &&
|
||||
!controls.contains(controls::AnalogueGainMode.id())) {
|
||||
controls.set(controls::AnalogueGainMode,
|
||||
*aeEnable ? controls::AnalogueGainModeAuto
|
||||
: controls::AnalogueGainModeManual);
|
||||
}
|
||||
|
||||
if (_d()->controlInfo_.count(controls::ExposureTimeMode.id()) &&
|
||||
!controls.contains(controls::ExposureTimeMode.id())) {
|
||||
controls.set(controls::ExposureTimeMode,
|
||||
*aeEnable ? controls::ExposureTimeModeAuto
|
||||
: controls::ExposureTimeModeManual);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Queue a request to the camera
|
||||
* \param[in] request The request to queue to the camera
|
||||
@@ -1338,23 +1365,7 @@ int Camera::queueRequest(Request *request)
|
||||
}
|
||||
|
||||
/* Pre-process AeEnable. */
|
||||
ControlList &controls = request->controls();
|
||||
const auto &aeEnable = controls.get(controls::AeEnable);
|
||||
if (aeEnable) {
|
||||
if (_d()->controlInfo_.count(controls::AnalogueGainMode.id()) &&
|
||||
!controls.contains(controls::AnalogueGainMode.id())) {
|
||||
controls.set(controls::AnalogueGainMode,
|
||||
*aeEnable ? controls::AnalogueGainModeAuto
|
||||
: controls::AnalogueGainModeManual);
|
||||
}
|
||||
|
||||
if (_d()->controlInfo_.count(controls::ExposureTimeMode.id()) &&
|
||||
!controls.contains(controls::ExposureTimeMode.id())) {
|
||||
controls.set(controls::ExposureTimeMode,
|
||||
*aeEnable ? controls::ExposureTimeModeAuto
|
||||
: controls::ExposureTimeModeManual);
|
||||
}
|
||||
}
|
||||
patchControlList(request->controls());
|
||||
|
||||
d->pipe_->invokeMethod(&PipelineHandler::queueRequest,
|
||||
ConnectionTypeQueued, request);
|
||||
@@ -1392,8 +1403,16 @@ int Camera::start(const ControlList *controls)
|
||||
|
||||
ASSERT(d->requestSequence_ == 0);
|
||||
|
||||
ret = d->pipe_->invokeMethod(&PipelineHandler::start,
|
||||
ConnectionTypeBlocking, this, controls);
|
||||
if (controls) {
|
||||
ControlList copy(*controls);
|
||||
patchControlList(copy);
|
||||
ret = d->pipe_->invokeMethod(&PipelineHandler::start,
|
||||
ConnectionTypeBlocking, this, ©);
|
||||
} else {
|
||||
ret = d->pipe_->invokeMethod(&PipelineHandler::start,
|
||||
ConnectionTypeBlocking, this, nullptr);
|
||||
}
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user