@@ -166,6 +166,8 @@ private:
MediaDevice *cio2MediaDev_;
MediaDevice *imguMediaDev_;
+ Camera *inUseCamera_ = nullptr;
+
std::vector<IPABuffer> ipaBuffers_;
};
@@ -765,6 +767,14 @@ int PipelineHandlerIPU3::freeBuffers(Camera *camera)
int PipelineHandlerIPU3::start(Camera *camera, [[maybe_unused]] const ControlList *controls)
{
+ /*
+ * Enforce that only a single camera can be used at a time to use both
+ * ImgUs on the camera, so that StillCapture stream can adopt another
+ * set of configuration.
+ */
+ if (inUseCamera_ && inUseCamera_ != camera)
+ return -EBUSY;
+
IPU3CameraData *data = cameraData(camera);
CIO2Device *cio2 = &data->cio2_;
ImgUDevice *imgu = data->imgu_;
@@ -781,6 +791,8 @@ int PipelineHandlerIPU3::start(Camera *camera, [[maybe_unused]] const ControlLis
if (ret)
return ret;
+ inUseCamera_ = camera;
+
ret = data->ipa_->start();
if (ret)
goto error;
@@ -808,6 +820,8 @@ error:
freeBuffers(camera);
LOG(IPU3, Error) << "Failed to start camera " << camera->id();
+ inUseCamera_ = nullptr;
+
return ret;
}
@@ -826,6 +840,8 @@ void PipelineHandlerIPU3::stopDevice(Camera *camera)
LOG(IPU3, Warning) << "Failed to stop camera " << camera->id();
freeBuffers(camera);
+
+ inUseCamera_ = nullptr;
}
void IPU3CameraData::cancelPendingRequests()