@@ -59,6 +59,7 @@ public:
int init();
void bufferReady(FrameBuffer *buffer);
+ void bufferReadyRaw(FrameBuffer *buffer);
MediaDevice *media_;
CameraSensor *sensor_;
@@ -433,29 +434,50 @@ int PipelineHandlerVimc::exportFrameBuffers(Camera *camera, Stream *stream,
VimcCameraData *data = cameraData(camera);
unsigned int count = stream->configuration().bufferCount;
- return data->video_->exportBuffers(count, buffers);
+ if (stream == &data->rawStream_)
+ return data->raw_->exportBuffers(count, buffers);
+ else if (stream == &data->rgbStream_)
+ return data->video_->exportBuffers(count, buffers);
+ else
+ return -EINVAL;
}
int PipelineHandlerVimc::start(Camera *camera)
{
VimcCameraData *data = cameraData(camera);
unsigned int count = data->rgbStream_.configuration().bufferCount;
+ unsigned int rCount = data->rawStream_.configuration().bufferCount;
int ret = data->video_->importBuffers(count);
if (ret < 0)
return ret;
+ ret = data->raw_->importBuffers(rCount);
+ if (ret < 0)
+ return ret;
+
ret = data->ipa_->start();
if (ret) {
data->video_->releaseBuffers();
+ data->raw_->releaseBuffers();
return ret;
}
- ret = data->video_->streamOn();
- if (ret < 0) {
- data->ipa_->stop();
- data->video_->releaseBuffers();
- return ret;
+ if (count) {
+ ret = data->video_->streamOn();
+ if (ret < 0) {
+ data->ipa_->stop();
+ data->video_->releaseBuffers();
+ return ret;
+ }
+ }
+ if (rCount) {
+ ret = data->raw_->streamOn();
+ if (ret < 0) {
+ data->ipa_->stop();
+ data->raw_->releaseBuffers();
+ return ret;
+ }
}
return 0;
@@ -464,8 +486,10 @@ int PipelineHandlerVimc::start(Camera *camera)
void PipelineHandlerVimc::stop(Camera *camera)
{
VimcCameraData *data = cameraData(camera);
+ data->raw_->streamOff();
data->video_->streamOff();
data->ipa_->stop();
+ data->raw_->releaseBuffers();
data->video_->releaseBuffers();
}
@@ -653,7 +677,21 @@ void VimcCameraData::bufferReady(FrameBuffer *buffer)
Request *request = buffer->request();
pipe_->completeBuffer(camera_, request, buffer);
- pipe_->completeRequest(camera_, request);
+ if (!(request->hasPendingBuffers())) {
+ pipe_->completeRequest(camera_, request);
+ }
+ return;
+}
+
+void VimcCameraData::bufferReadyRaw(FrameBuffer *buffer)
+{
+ Request *request = buffer->request();
+
+ pipe_->completeBuffer(camera_, request, buffer);
+ if (!(request->hasPendingBuffers())) {
+ pipe_->completeRequest(camera_, request);
+ }
+ return;
}
REGISTER_PIPELINE_HANDLER(PipelineHandlerVimc);
Introduce a bufferReady function for RAW streams. Take care of exporting the correct buffers according to the stream required. Also start and stop the correct buffers accordingly. Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in> --- src/libcamera/pipeline/vimc/vimc.cpp | 52 ++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 7 deletions(-)