[libcamera-devel] [PATCH v10 04/19] libcamera: pipeline: raspberrypi: Don't rely on bufferCount
Paul Elder
paul.elder at ideasonboard.com
Wed Dec 28 23:29:48 CET 2022
From: Nícolas F. R. A. Prado <nfraprado at collabora.com>
Currently the raspberrypi pipeline handler relies on bufferCount to
decide on the number of buffers to allocate internally and for the
number of V4L2 buffer slots to reserve.
There alrady exists a procedure for determining the number of buffers to
reserve, so to remove reliance onf bufferCount we simply replace the one
instance that it is used in, as well as remove populating it in
generateConfiguration().
Signed-off-by: Nícolas F. R. A. Prado <nfraprado at collabora.com>
Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
---
Changes in v10:
- completely changed, to leverage the existing buffer count calculations
- the refactoring that was in v9's rebase wasn't necessary, i think
- this also makes it conflict less with [1] which ought to be coming
soon
[1] https://patchwork.libcamera.org/project/libcamera/list/?series=3663
Changes in v9:
- rebased
- I've decided that the buffer allocation decisions that Nícolas
implemented covered the same cases that were added in
PipelineHandlerRPi::prepareBuffers(), but in a slightly nicer way,
especially considering that bufferCount is to be removed from
StreamConfiguration in this series. Comments welcome, of course.
Changes in v8:
- Reworked buffer allocation handling in the raspberrypi pipeline handler
- New
---
src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 4641c76f..15055d58 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -572,7 +572,6 @@ PipelineHandlerRPi::generateConfiguration(Camera *camera, const StreamRoles &rol
std::unique_ptr<CameraConfiguration> config =
std::make_unique<RPiCameraConfiguration>(data);
V4L2SubdeviceFormat sensorFormat;
- unsigned int bufferCount;
PixelFormat pixelFormat;
V4L2VideoDevice::Formats fmts;
Size size;
@@ -593,7 +592,6 @@ PipelineHandlerRPi::generateConfiguration(Camera *camera, const StreamRoles &rol
BayerFormat::Packing::CSI2);
ASSERT(pixelFormat.isValid());
colorSpace = ColorSpace::Raw;
- bufferCount = 2;
rawCount++;
break;
@@ -608,7 +606,6 @@ PipelineHandlerRPi::generateConfiguration(Camera *camera, const StreamRoles &rol
colorSpace = ColorSpace::Sycc;
/* Return the largest sensor resolution. */
size = sensorSize;
- bufferCount = 1;
outCount++;
break;
@@ -629,7 +626,6 @@ PipelineHandlerRPi::generateConfiguration(Camera *camera, const StreamRoles &rol
*/
colorSpace = ColorSpace::Rec709;
size = { 1920, 1080 };
- bufferCount = 4;
outCount++;
break;
@@ -638,7 +634,6 @@ PipelineHandlerRPi::generateConfiguration(Camera *camera, const StreamRoles &rol
pixelFormat = formats::ARGB8888;
colorSpace = ColorSpace::Sycc;
size = { 800, 600 };
- bufferCount = 4;
outCount++;
break;
@@ -685,7 +680,6 @@ PipelineHandlerRPi::generateConfiguration(Camera *camera, const StreamRoles &rol
cfg.size = size;
cfg.pixelFormat = pixelFormat;
cfg.colorSpace = colorSpace;
- cfg.bufferCount = bufferCount;
config->addConfiguration(cfg);
}
@@ -1433,7 +1427,7 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera)
for (Stream *s : camera->streams()) {
if (isRaw(s->configuration().pixelFormat)) {
- numRawBuffers = s->configuration().bufferCount;
+ numRawBuffers = data->unicam_[Unicam::Image].getBuffers().size();
break;
}
}
--
2.35.1
More information about the libcamera-devel
mailing list