Message ID | 20190320163055.22056-12-jacopo@jmondi.org |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
Hi Jacopo, Thank you for the patch. On Wed, Mar 20, 2019 at 05:30:35PM +0100, Jacopo Mondi wrote: > Implement queueRequest for the IPU3 pipeline manager. When a request is > queued, a new buffer is queued to the ImgU output. > > Also queue buffers for the viewfinder and stat video nodes, even if > they're not used at the moment. > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> > --- > src/libcamera/pipeline/ipu3/ipu3.cpp | 25 +++++++++++++++++++++++-- > 1 file changed, 23 insertions(+), 2 deletions(-) > > diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp > index 965794494a4e..8410e1f4b4a6 100644 > --- a/src/libcamera/pipeline/ipu3/ipu3.cpp > +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp > @@ -161,11 +161,15 @@ private: > > std::shared_ptr<MediaDevice> cio2MediaDev_; > std::shared_ptr<MediaDevice> imguMediaDev_; > + > + unsigned int tmpBufferCount; > }; > > PipelineHandlerIPU3::PipelineHandlerIPU3(CameraManager *manager) > : PipelineHandler(manager), cio2MediaDev_(nullptr), imguMediaDev_(nullptr) > { > + /* FIXME: this is an hack. */ > + tmpBufferCount = 0; > } > > PipelineHandlerIPU3::~PipelineHandlerIPU3() > @@ -460,9 +464,26 @@ void PipelineHandlerIPU3::stop(Camera *camera) > int PipelineHandlerIPU3::queueRequest(Camera *camera, Request *request) > { > IPU3CameraData *data = cameraData(camera); > - V4L2Device *cio2 = data->cio2.output; > + V4L2Device *viewfinder = data->imgu->viewfinder; > + V4L2Device *output = data->imgu->output; > + V4L2Device *stat = data->imgu->stat; > Stream *stream = &data->stream_; > + Buffer *tmpBuffer; > + > + /* > + * Queue buffer on VF and stat. > + * FIXME: this is an hack! > + */ A pretty ugly one :-( You could allocate as many stats and viewfinder buffers as you have capture buffers, and queue the buffers with the same index as the output buffer. That would remove the need for a tmpBufferCount variable. That won't work as-is when using multiple streams, but it can at least delay the hack. > + tmpBuffer = &data->imgu->vfPool.buffers()[tmpBufferCount]; > + viewfinder->queueBuffer(tmpBuffer); > + > + tmpBuffer = &data->imgu->statPool.buffers()[tmpBufferCount]; > + stat->queueBuffer(tmpBuffer); > + > + tmpBufferCount++; > + tmpBufferCount %= IPU3_IMGU_BUFFER_COUNT; > > + /* Queue a buffer to the ImgU output for capture. */ > Buffer *buffer = request->findBuffer(stream); > if (!buffer) { > LOG(IPU3, Error) > @@ -470,7 +491,7 @@ int PipelineHandlerIPU3::queueRequest(Camera *camera, Request *request) > return -ENOENT; > } > > - int ret = cio2->queueBuffer(buffer); > + int ret = output->queueBuffer(buffer); > if (ret < 0) > return ret; >
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 965794494a4e..8410e1f4b4a6 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -161,11 +161,15 @@ private: std::shared_ptr<MediaDevice> cio2MediaDev_; std::shared_ptr<MediaDevice> imguMediaDev_; + + unsigned int tmpBufferCount; }; PipelineHandlerIPU3::PipelineHandlerIPU3(CameraManager *manager) : PipelineHandler(manager), cio2MediaDev_(nullptr), imguMediaDev_(nullptr) { + /* FIXME: this is an hack. */ + tmpBufferCount = 0; } PipelineHandlerIPU3::~PipelineHandlerIPU3() @@ -460,9 +464,26 @@ void PipelineHandlerIPU3::stop(Camera *camera) int PipelineHandlerIPU3::queueRequest(Camera *camera, Request *request) { IPU3CameraData *data = cameraData(camera); - V4L2Device *cio2 = data->cio2.output; + V4L2Device *viewfinder = data->imgu->viewfinder; + V4L2Device *output = data->imgu->output; + V4L2Device *stat = data->imgu->stat; Stream *stream = &data->stream_; + Buffer *tmpBuffer; + + /* + * Queue buffer on VF and stat. + * FIXME: this is an hack! + */ + tmpBuffer = &data->imgu->vfPool.buffers()[tmpBufferCount]; + viewfinder->queueBuffer(tmpBuffer); + + tmpBuffer = &data->imgu->statPool.buffers()[tmpBufferCount]; + stat->queueBuffer(tmpBuffer); + + tmpBufferCount++; + tmpBufferCount %= IPU3_IMGU_BUFFER_COUNT; + /* Queue a buffer to the ImgU output for capture. */ Buffer *buffer = request->findBuffer(stream); if (!buffer) { LOG(IPU3, Error) @@ -470,7 +491,7 @@ int PipelineHandlerIPU3::queueRequest(Camera *camera, Request *request) return -ENOENT; } - int ret = cio2->queueBuffer(buffer); + int ret = output->queueBuffer(buffer); if (ret < 0) return ret;
Implement queueRequest for the IPU3 pipeline manager. When a request is queued, a new buffer is queued to the ImgU output. Also queue buffers for the viewfinder and stat video nodes, even if they're not used at the moment. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> --- src/libcamera/pipeline/ipu3/ipu3.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-)