mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-14 16:09:51 +03:00
pipeline: raspberrypi: Fix the buffer count calculation for the ISP input stream
The ISP input stream currently only allocates a single slot in the V4L2VideoDevice cache as it follows the number of buffers allocated for use. However, this is wrong as the ISP input stream imports buffers from Unicam image stream. As a consequence of this, only one cache slot was used during runtime for the ISP input stream, and if multiple buffers were to be queued simultaneously, the queue operation would return a failure. Fix this by passing the same number of RAW buffers available from the Unicam image stream. Additionally, double this count in the cases where buffers could be allocated externally from the application. Bug: https://github.com/raspberrypi/libcamera-apps/issues/236 Bug: https://github.com/raspberrypi/libcamera-apps/issues/238 Bug: https://github.com/raspberrypi/libcamera-apps/issues/240 Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
355f4145b8
commit
e96d02015c
2 changed files with 10 additions and 1 deletions
|
@ -1391,6 +1391,14 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera)
|
|||
* minimise frame drops.
|
||||
*/
|
||||
numBuffers = std::max<int>(2, minBuffers - numRawBuffers);
|
||||
} else if (stream == &data->isp_[Isp::Input]) {
|
||||
/*
|
||||
* ISP input buffers are imported from Unicam, so follow
|
||||
* similar logic as above to count all the RAW buffers
|
||||
* available.
|
||||
*/
|
||||
numBuffers = numRawBuffers + std::max<int>(2, minBuffers - numRawBuffers);
|
||||
|
||||
} else if (stream == &data->unicam_[Unicam::Embedded]) {
|
||||
/*
|
||||
* Embedded data buffers are (currently) for internal use,
|
||||
|
|
|
@ -111,11 +111,12 @@ int Stream::prepareBuffers(unsigned int count)
|
|||
* If this is an external stream, we must allocate slots for buffers that
|
||||
* might be externally allocated. We have no indication of how many buffers
|
||||
* may be used, so this might overallocate slots in the buffer cache.
|
||||
* Similarly, if this stream is only importing buffers, we do the same.
|
||||
*
|
||||
* \todo Find a better heuristic, or, even better, an exact solution to
|
||||
* this issue.
|
||||
*/
|
||||
if (isExternal())
|
||||
if (isExternal() || importOnly_)
|
||||
count = count * 2;
|
||||
|
||||
return dev_->importBuffers(count);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue