[libcamera-devel] [PATCH v3 10/14] libcamera: pipeline: ipu3: Migrate to Camera::Private
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Thu Aug 12 01:26:21 CEST 2021
As part of the effort to remove the CameraData class, migrate the
pipeline handler-specific camera data from CameraData to the
Camera::Private class.
Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>
---
src/libcamera/pipeline/ipu3/ipu3.cpp | 38 +++++++++++++---------------
1 file changed, 18 insertions(+), 20 deletions(-)
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index b9c0941c5ea8..4d07592e0c7e 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -53,11 +53,11 @@ static const ControlInfoMap::Map IPU3Controls = {
{ &controls::draft::PipelineDepth, ControlInfo(2, 3) },
};
-class IPU3CameraData : public CameraData
+class IPU3CameraData : public Camera::Private
{
public:
IPU3CameraData(PipelineHandler *pipe)
- : CameraData(pipe), exposureTime_(0), supportsFlips_(false)
+ : Camera::Private(pipe), exposureTime_(0), supportsFlips_(false)
{
}
@@ -146,10 +146,9 @@ public:
bool match(DeviceEnumerator *enumerator) override;
private:
- IPU3CameraData *cameraData(const Camera *camera)
+ IPU3CameraData *cameraData(Camera *camera)
{
- return static_cast<IPU3CameraData *>(
- PipelineHandler::cameraData(camera));
+ return static_cast<IPU3CameraData *>(camera->_d());
}
int initControls(IPU3CameraData *data);
@@ -814,10 +813,10 @@ void IPU3CameraData::cancelPendingRequests()
for (auto it : request->buffers()) {
FrameBuffer *buffer = it.second;
buffer->cancel();
- pipe_->completeBuffer(request, buffer);
+ pipe()->completeBuffer(request, buffer);
}
- pipe_->completeRequest(request);
+ pipe()->completeRequest(request);
pendingRequests_.pop();
}
}
@@ -1198,12 +1197,11 @@ int PipelineHandlerIPU3::registerCameras()
&IPU3CameraData::statBufferReady);
/* Create and register the Camera instance. */
- std::string cameraId = cio2->sensor()->id();
+ const std::string &cameraId = cio2->sensor()->id();
std::shared_ptr<Camera> camera =
- Camera::create(std::make_unique<Camera::Private>(this),
- cameraId, streams);
+ Camera::create(std::move(data), cameraId, streams);
- registerCamera(std::move(camera), std::move(data));
+ registerCamera(std::move(camera), nullptr);
LOG(IPU3, Info)
<< "Registered Camera[" << numCameras << "] \""
@@ -1218,7 +1216,7 @@ int PipelineHandlerIPU3::registerCameras()
int IPU3CameraData::loadIPA()
{
- ipa_ = IPAManager::createIPA<ipa::ipu3::IPAProxyIPU3>(pipe_, 1, 1);
+ ipa_ = IPAManager::createIPA<ipa::ipu3::IPAProxyIPU3>(pipe(), 1, 1);
if (!ipa_)
return -ENOENT;
@@ -1275,7 +1273,7 @@ void IPU3CameraData::queueFrameAction(unsigned int id,
info->metadataProcessed = true;
if (frameInfos_.tryComplete(info))
- pipe_->completeRequest(request);
+ pipe()->completeRequest(request);
break;
}
@@ -1303,7 +1301,7 @@ void IPU3CameraData::imguOutputBufferReady(FrameBuffer *buffer)
Request *request = info->request;
- pipe_->completeBuffer(request, buffer);
+ pipe()->completeBuffer(request, buffer);
request->metadata().set(controls::draft::PipelineDepth, 3);
/* \todo Move the ExposureTime control to the IPA. */
@@ -1314,7 +1312,7 @@ void IPU3CameraData::imguOutputBufferReady(FrameBuffer *buffer)
request->metadata().set(controls::ScalerCrop, cropRegion_);
if (frameInfos_.tryComplete(info))
- pipe_->completeRequest(request);
+ pipe()->completeRequest(request);
}
/**
@@ -1346,16 +1344,16 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer)
for (auto it : request->buffers()) {
FrameBuffer *b = it.second;
b->cancel();
- pipe_->completeBuffer(request, b);
+ pipe()->completeBuffer(request, b);
}
frameInfos_.remove(info);
- pipe_->completeRequest(request);
+ pipe()->completeRequest(request);
return;
}
if (request->findBuffer(&rawStream_))
- pipe_->completeBuffer(request, buffer);
+ pipe()->completeBuffer(request, buffer);
ipa::ipu3::IPU3Event ev;
ev.op = ipa::ipu3::EventFillParams;
@@ -1381,7 +1379,7 @@ void IPU3CameraData::paramBufferReady(FrameBuffer *buffer)
Request *request = info->request;
if (frameInfos_.tryComplete(info))
- pipe_->completeRequest(request);
+ pipe()->completeRequest(request);
}
void IPU3CameraData::statBufferReady(FrameBuffer *buffer)
@@ -1400,7 +1398,7 @@ void IPU3CameraData::statBufferReady(FrameBuffer *buffer)
* In that event, we must have obtained the Request before hand.
*/
if (frameInfos_.tryComplete(info))
- pipe_->completeRequest(request);
+ pipe()->completeRequest(request);
return;
}
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list