summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/include/v4l2_device.h2
-rw-r--r--src/libcamera/pipeline/ipu3/ipu3.cpp3
-rw-r--r--src/libcamera/pipeline/uvcvideo.cpp2
-rw-r--r--src/libcamera/pipeline/vimc.cpp2
-rw-r--r--src/libcamera/v4l2_device.cpp15
5 files changed, 10 insertions, 14 deletions
diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h
index 983b9d90..5a536393 100644
--- a/src/libcamera/include/v4l2_device.h
+++ b/src/libcamera/include/v4l2_device.h
@@ -99,7 +99,7 @@ public:
int getFormat(V4L2DeviceFormat *format);
int setFormat(V4L2DeviceFormat *format);
- int exportBuffers(unsigned int count, BufferPool *pool);
+ int exportBuffers(BufferPool *pool);
int releaseBuffers();
int queueBuffer(Buffer *buffer);
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 34b03995..677e127d 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -191,8 +191,7 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera, Stream *stream)
if (!cfg.bufferCount)
return -EINVAL;
- int ret = data->cio2_->exportBuffers(cfg.bufferCount,
- &stream->bufferPool());
+ int ret = data->cio2_->exportBuffers(&stream->bufferPool());
if (ret) {
LOG(IPU3, Error) << "Failed to request memory";
return ret;
diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp
index fc31c52c..b6a98657 100644
--- a/src/libcamera/pipeline/uvcvideo.cpp
+++ b/src/libcamera/pipeline/uvcvideo.cpp
@@ -102,7 +102,7 @@ int PipelineHandlerUVC::allocateBuffers(Camera *camera, Stream *stream)
LOG(UVC, Debug) << "Requesting " << cfg.bufferCount << " buffers";
- return video_->exportBuffers(cfg.bufferCount, &stream->bufferPool());
+ return video_->exportBuffers(&stream->bufferPool());
}
int PipelineHandlerUVC::freeBuffers(Camera *camera, Stream *stream)
diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp
index 46840a4f..543ff212 100644
--- a/src/libcamera/pipeline/vimc.cpp
+++ b/src/libcamera/pipeline/vimc.cpp
@@ -101,7 +101,7 @@ int PipelineHandlerVimc::allocateBuffers(Camera *camera, Stream *stream)
LOG(VIMC, Debug) << "Requesting " << cfg.bufferCount << " buffers";
- return video_->exportBuffers(cfg.bufferCount, &stream->bufferPool());
+ return video_->exportBuffers(&stream->bufferPool());
}
int PipelineHandlerVimc::freeBuffers(Camera *camera, Stream *stream)
diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
index 207ba933..ca6bb4ee 100644
--- a/src/libcamera/v4l2_device.cpp
+++ b/src/libcamera/v4l2_device.cpp
@@ -538,13 +538,12 @@ int V4L2Device::requestBuffers(unsigned int count)
}
/**
- * \brief Request \a count buffers to be allocated from the device and stored in
- * the buffer pool provided.
- * \param[in] count Number of buffers to allocate
+ * \brief Request buffers to be allocated from the device and stored in the
+ * buffer pool provided.
* \param[out] pool BufferPool to populate with buffers
* \return 0 on success or a negative error code otherwise
*/
-int V4L2Device::exportBuffers(unsigned int count, BufferPool *pool)
+int V4L2Device::exportBuffers(BufferPool *pool)
{
unsigned int allocatedBuffers;
unsigned int i;
@@ -552,21 +551,19 @@ int V4L2Device::exportBuffers(unsigned int count, BufferPool *pool)
memoryType_ = V4L2_MEMORY_MMAP;
- ret = requestBuffers(count);
+ ret = requestBuffers(pool->count());
if (ret < 0)
return ret;
allocatedBuffers = ret;
- if (allocatedBuffers < count) {
+ if (allocatedBuffers < pool->count()) {
LOG(V4L2, Error) << "Not enough buffers provided by V4L2Device";
requestBuffers(0);
return -ENOMEM;
}
- count = ret;
-
/* Map the buffers. */
- for (i = 0; i < count; ++i) {
+ for (i = 0; i < pool->count(); ++i) {
struct v4l2_plane planes[VIDEO_MAX_PLANES] = {};
struct v4l2_buffer buf = {};
struct Buffer &buffer = pool->buffers()[i];