libcamera: v4l2_device: Replace V4L2ControlList with ControlList

The V4L2Device class uses V4L2ControlList as a controls container for
the getControls() and setControls() operations. Having a distinct
container from ControlList will makes the IPA API more complex, as it
needs to explicitly transport both types of lists. This will become even
more painful when implementing serialisation and deserialisation.

To simplify the IPA API and ease the implementation of serialisation and
deserialisation, replace usage of V4L2ControlList with ControlList in
the V4L2Device (and thus CameraSensor) API. The V4L2ControlList class
becomes a thin wrapper around ControlList that slightly simplifies the
creation of control lists for V4L2 controls, and may be removed in the
future.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
Laurent Pinchart 2019-10-07 22:31:59 +03:00
parent 2fe723440a
commit 343978af0b
11 changed files with 128 additions and 289 deletions

View file

@ -49,6 +49,8 @@ private:
std::map<unsigned int, BufferMemory> bufferInfo_;
V4L2ControlInfoMap ctrls_;
/* Camera sensor controls. */
bool autoExposure_;
uint32_t exposure_;
@ -65,16 +67,16 @@ void IPARkISP1::configure(const std::map<unsigned int, IPAStream> &streamConfig,
if (entityControls.empty())
return;
const V4L2ControlInfoMap &ctrls = entityControls.at(0);
ctrls_ = entityControls.at(0);
const auto itExp = ctrls.find(V4L2_CID_EXPOSURE);
if (itExp == ctrls.end()) {
const auto itExp = ctrls_.find(V4L2_CID_EXPOSURE);
if (itExp == ctrls_.end()) {
LOG(IPARkISP1, Error) << "Can't find exposure control";
return;
}
const auto itGain = ctrls.find(V4L2_CID_ANALOGUE_GAIN);
if (itGain == ctrls.end()) {
const auto itGain = ctrls_.find(V4L2_CID_ANALOGUE_GAIN);
if (itGain == ctrls_.end()) {
LOG(IPARkISP1, Error) << "Can't find gain control";
return;
}
@ -210,9 +212,9 @@ void IPARkISP1::setControls(unsigned int frame)
IPAOperationData op;
op.operation = RKISP1_IPA_ACTION_V4L2_SET;
V4L2ControlList ctrls;
ctrls.add(V4L2_CID_EXPOSURE, exposure_);
ctrls.add(V4L2_CID_ANALOGUE_GAIN, gain_);
V4L2ControlList ctrls(ctrls_);
ctrls.set(V4L2_CID_EXPOSURE, static_cast<int32_t>(exposure_));
ctrls.set(V4L2_CID_ANALOGUE_GAIN, static_cast<int32_t>(gain_));
op.v4l2controls.push_back(ctrls);
queueFrameAction.emit(frame, op);