<div dir="ltr"><div dir="ltr">HI Nicolas,<div><br></div><div>Thank you for your work.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 24 Aug 2021 at 20:57, Nícolas F. R. A. Prado <<a href="mailto:nfraprado@collabora.com">nfraprado@collabora.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Now that the number of buffers allocated by the FrameBufferAllocator<br>
helper is passed through FrameBufferAllocator::allocate() and the<br>
pipelines no longer use bufferCount for internal buffer or V4L2 buffer<br>
slots allocation, we no longer need to have bufferCount in the<br>
StreamConfiguration, so remove it.<br></blockquote><div><br></div><div>I've tried to pull this series into my tree to have a closer look, but there are many</div><div>merge conflicts. Am I missing some patches on-top of master that this series needs?</div><div><br></div><div>Regarding the change, It looks like this will fail compilation with the Raspberry Pi</div><div>pipeline handler. We use bufferCount in PipelineHandlerRPi::prepareBuffers() and</div><div>it does not seem to be removed. I'm curious how we can update that logic, as our</div><div>internal buffer allocation routine needs to know the external buffer count for the steram.</div><div><br></div><div>Thanks,</div><div>Naush</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Signed-off-by: Nícolas F. R. A. Prado <<a href="mailto:nfraprado@collabora.com" target="_blank">nfraprado@collabora.com</a>><br>
<br>
---<br>
<br>
Changes in v8:<br>
- Updated the pipeline-handler guide to use MinimumRequests instead of<br>
bufferCount<br>
- Removed kNumInternalBuffers as it was unused<br>
<br>
Changes in v6:<br>
- Removed IPU3_BUFFER_COUNT as it was unused<br>
<br>
Documentation/guides/pipeline-handler.rst | 15 +++++++++------<br>
include/libcamera/stream.h | 2 --<br>
src/android/camera_stream.cpp | 2 +-<br>
src/libcamera/pipeline/ipu3/cio2.cpp | 1 -<br>
src/libcamera/pipeline/ipu3/cio2.h | 2 --<br>
src/libcamera/pipeline/ipu3/ipu3.cpp | 8 --------<br>
.../pipeline/raspberrypi/raspberrypi.cpp | 6 ------<br>
src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 2 --<br>
src/libcamera/pipeline/rkisp1/rkisp1_path.h | 2 --<br>
src/libcamera/pipeline/simple/converter.cpp | 3 ---<br>
src/libcamera/pipeline/simple/converter.h | 3 ---<br>
src/libcamera/pipeline/simple/simple.cpp | 6 +-----<br>
src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 3 ---<br>
src/libcamera/pipeline/vimc/vimc.cpp | 3 ---<br>
src/libcamera/stream.cpp | 12 +++---------<br>
test/camera/buffer_import.cpp | 10 +++++++---<br>
test/libtest/buffer_source.cpp | 4 ++--<br>
test/libtest/buffer_source.h | 2 +-<br>
test/v4l2_videodevice/buffer_cache.cpp | 3 +--<br>
19 files changed, 25 insertions(+), 64 deletions(-)<br>
<br>
diff --git a/Documentation/guides/pipeline-handler.rst b/Documentation/guides/pipeline-handler.rst<br>
index 2a69ef7d7461..3ee79b98c4dc 100644<br>
--- a/Documentation/guides/pipeline-handler.rst<br>
+++ b/Documentation/guides/pipeline-handler.rst<br>
@@ -826,14 +826,12 @@ As well as a list of supported StreamFormats, the StreamConfiguration is also<br>
expected to provide an initialsed default configuration. This may be arbitrary,<br>
but depending on use case you may which to select an output that matches the<br>
Sensor output, or prefer a pixelformat which might provide higher performance on<br>
-the hardware. The bufferCount represents the number of buffers required to<br>
-support functional continuous processing on this stream.<br>
+the hardware.<br>
<br>
.. code-block:: cpp<br>
<br>
cfg.pixelFormat = formats::BGR888;<br>
cfg.size = { 1280, 720 };<br>
- cfg.bufferCount = 4;<br>
<br>
Finally add each ``StreamConfiguration`` generated to the<br>
``CameraConfiguration``, and ensure that it has been validated before returning<br>
@@ -899,8 +897,6 @@ Add the following function implementation to your file:<br>
status = Adjusted;<br>
}<br>
<br>
- cfg.bufferCount = 4;<br>
-<br>
return status;<br>
}<br>
<br>
@@ -1144,13 +1140,20 @@ is performed by using the ``V4L2VideoDevice`` API, which provides an<br>
<br>
.. _FrameBuffer: <a href="http://libcamera.org/api-html/classlibcamera_1_1FrameBuffer.html" rel="noreferrer" target="_blank">http://libcamera.org/api-html/classlibcamera_1_1FrameBuffer.html</a><br>
<br>
+The number passed to ``importBuffers()`` should be at least equal to the value<br>
+of the ``MinimumRequests`` property in order to be possible to queue enough<br>
+buffers to the video device that frames won't be dropped during capture. A<br>
+bigger value can be advantageous to reduce the thrashing of dma-buf file<br>
+descriptor mappings in case the application queues more requests and therefore<br>
+improve performance, but for simplicity we'll just use ``MinimumRequests``.<br>
+<br>
Implement the pipeline handler ``start()`` function by replacing the stub<br>
version with the following code:<br>
<br>
.. code-block:: c++<br>
<br>
VividCameraData *data = cameraData(camera);<br>
- unsigned int count = data->stream_.configuration().bufferCount;<br>
+ unsigned int count = camera->properties().get(properties::MinimumRequests);<br>
<br>
int ret = data->video_->importBuffers(count);<br>
if (ret < 0)<br>
diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h<br>
index 0c55e7164592..b25f0059f2f1 100644<br>
--- a/include/libcamera/stream.h<br>
+++ b/include/libcamera/stream.h<br>
@@ -45,8 +45,6 @@ struct StreamConfiguration {<br>
unsigned int stride;<br>
unsigned int frameSize;<br>
<br>
- unsigned int bufferCount;<br>
-<br>
Stream *stream() const { return stream_; }<br>
void setStream(Stream *stream) { stream_ = stream; }<br>
const StreamFormats &formats() const { return formats_; }<br>
diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp<br>
index 29be1ac5ca4f..d9ee8842938f 100644<br>
--- a/src/android/camera_stream.cpp<br>
+++ b/src/android/camera_stream.cpp<br>
@@ -96,7 +96,7 @@ int CameraStream::configure()<br>
buffers_.push_back(frameBuffer.get());<br>
}<br>
<br>
- camera3Stream_->max_buffers = configuration().bufferCount;<br>
+ camera3Stream_->max_buffers = bufferCount;<br>
<br>
return 0;<br>
}<br>
diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp<br>
index b940a0f6d7d6..c555ef5ffd27 100644<br>
--- a/src/libcamera/pipeline/ipu3/cio2.cpp<br>
+++ b/src/libcamera/pipeline/ipu3/cio2.cpp<br>
@@ -214,7 +214,6 @@ StreamConfiguration CIO2Device::generateConfiguration(Size size) const<br>
<br>
cfg.size = sensorFormat.size;<br>
cfg.pixelFormat = mbusCodesToPixelFormat.at(sensorFormat.mbus_code);<br>
- cfg.bufferCount = CIO2_BUFFER_COUNT;<br>
<br>
return cfg;<br>
}<br>
diff --git a/src/libcamera/pipeline/ipu3/cio2.h b/src/libcamera/pipeline/ipu3/cio2.h<br>
index ab915b6a16fa..50ccb20765d3 100644<br>
--- a/src/libcamera/pipeline/ipu3/cio2.h<br>
+++ b/src/libcamera/pipeline/ipu3/cio2.h<br>
@@ -30,8 +30,6 @@ struct StreamConfiguration;<br>
class CIO2Device<br>
{<br>
public:<br>
- static constexpr unsigned int CIO2_BUFFER_COUNT = 4;<br>
-<br>
CIO2Device();<br>
<br>
std::vector<PixelFormat> formats() const;<br>
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp<br>
index cc519ae6adbe..4a60f00ecf8b 100644<br>
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp<br>
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp<br>
@@ -39,7 +39,6 @@ namespace libcamera {<br>
<br>
LOG_DEFINE_CATEGORY(IPU3)<br>
<br>
-static constexpr unsigned int IPU3_BUFFER_COUNT = 4;<br>
static constexpr unsigned int IPU3_MAX_STREAMS = 3;<br>
static const Size IMGU_OUTPUT_MIN_SIZE = { 2, 2 };<br>
static const Size IMGU_OUTPUT_MAX_SIZE = { 4480, 34004 };<br>
@@ -313,7 +312,6 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()<br>
/* Initialize the RAW stream with the CIO2 configuration. */<br>
cfg->size = cio2Configuration_.size;<br>
cfg->pixelFormat = cio2Configuration_.pixelFormat;<br>
- cfg->bufferCount = cio2Configuration_.bufferCount;<br>
cfg->stride = info.stride(cfg->size.width, 0, 64);<br>
cfg->frameSize = info.frameSize(cfg->size, 64);<br>
cfg->setStream(const_cast<Stream *>(&data_->rawStream_));<br>
@@ -357,7 +355,6 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()<br>
IMGU_OUTPUT_HEIGHT_ALIGN);<br>
<br>
cfg->pixelFormat = formats::NV12;<br>
- cfg->bufferCount = IPU3_BUFFER_COUNT;<br>
cfg->stride = info.stride(cfg->size.width, 0, 1);<br>
cfg->frameSize = info.frameSize(cfg->size, 1);<br>
<br>
@@ -425,7 +422,6 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,<br>
Size sensorResolution = data->cio2_.sensor()->resolution();<br>
for (const StreamRole role : roles) {<br>
std::map<PixelFormat, std::vector<SizeRange>> streamFormats;<br>
- unsigned int bufferCount;<br>
PixelFormat pixelFormat;<br>
Size size;<br>
<br>
@@ -446,7 +442,6 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,<br>
size.height = utils::alignDown(size.height - 1,<br>
IMGU_OUTPUT_HEIGHT_MARGIN);<br>
pixelFormat = formats::NV12;<br>
- bufferCount = IPU3_BUFFER_COUNT;<br>
streamFormats[pixelFormat] = { { IMGU_OUTPUT_MIN_SIZE, size } };<br>
<br>
break;<br>
@@ -456,7 +451,6 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,<br>
data->cio2_.generateConfiguration(sensorResolution);<br>
pixelFormat = cio2Config.pixelFormat;<br>
size = cio2Config.size;<br>
- bufferCount = cio2Config.bufferCount;<br>
<br>
for (const PixelFormat &format : data->cio2_.formats())<br>
streamFormats[format] = data->cio2_.sizes();<br>
@@ -475,7 +469,6 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,<br>
.alignedDownTo(IMGU_OUTPUT_WIDTH_ALIGN,<br>
IMGU_OUTPUT_HEIGHT_ALIGN);<br>
pixelFormat = formats::NV12;<br>
- bufferCount = IPU3_BUFFER_COUNT;<br>
streamFormats[pixelFormat] = { { IMGU_OUTPUT_MIN_SIZE, size } };<br>
<br>
break;<br>
@@ -492,7 +485,6 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,<br>
StreamConfiguration cfg(formats);<br>
cfg.size = size;<br>
cfg.pixelFormat = pixelFormat;<br>
- cfg.bufferCount = bufferCount;<br>
config->addConfiguration(cfg);<br>
}<br>
<br>
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
index a7c1cc1d5001..12d6729044e6 100644<br>
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
@@ -492,7 +492,6 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,<br>
RPiCameraData *data = cameraData(camera);<br>
CameraConfiguration *config = new RPiCameraConfiguration(data);<br>
V4L2DeviceFormat sensorFormat;<br>
- unsigned int bufferCount;<br>
PixelFormat pixelFormat;<br>
V4L2VideoDevice::Formats fmts;<br>
Size size;<br>
@@ -510,7 +509,6 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,<br>
sensorFormat = findBestMode(fmts, size);<br>
pixelFormat = sensorFormat.fourcc.toPixelFormat();<br>
ASSERT(pixelFormat.isValid());<br>
- bufferCount = 2;<br>
rawCount++;<br>
break;<br>
<br>
@@ -519,7 +517,6 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,<br>
pixelFormat = formats::NV12;<br>
/* Return the largest sensor resolution. */<br>
size = data->sensor_->resolution();<br>
- bufferCount = 1;<br>
outCount++;<br>
break;<br>
<br>
@@ -535,7 +532,6 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,<br>
fmts = data->isp_[Isp::Output0].dev()->formats();<br>
pixelFormat = formats::YUV420;<br>
size = { 1920, 1080 };<br>
- bufferCount = 4;<br>
outCount++;<br>
break;<br>
<br>
@@ -543,7 +539,6 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,<br>
fmts = data->isp_[Isp::Output0].dev()->formats();<br>
pixelFormat = formats::ARGB8888;<br>
size = { 800, 600 };<br>
- bufferCount = 4;<br>
outCount++;<br>
break;<br>
<br>
@@ -573,7 +568,6 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,<br>
StreamConfiguration cfg(formats);<br>
cfg.size = size;<br>
cfg.pixelFormat = pixelFormat;<br>
- cfg.bufferCount = bufferCount;<br>
config->addConfiguration(cfg);<br>
}<br>
<br>
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp<br>
index 515f4be16d7e..9bbdf951d9b6 100644<br>
--- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp<br>
+++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp<br>
@@ -61,7 +61,6 @@ StreamConfiguration RkISP1Path::generateConfiguration(const Size &resolution)<br>
StreamConfiguration cfg(formats);<br>
cfg.pixelFormat = formats::NV12;<br>
cfg.size = maxResolution;<br>
- cfg.bufferCount = RKISP1_BUFFER_COUNT;<br>
<br>
return cfg;<br>
}<br>
@@ -77,7 +76,6 @@ CameraConfiguration::Status RkISP1Path::validate(StreamConfiguration *cfg)<br>
<br>
cfg->size.boundTo(maxResolution_);<br>
cfg->size.expandTo(minResolution_);<br>
- cfg->bufferCount = RKISP1_BUFFER_COUNT;<br>
<br>
V4L2DeviceFormat format;<br>
format.fourcc = video_->toV4L2PixelFormat(cfg->pixelFormat);<br>
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h<br>
index 267d8f988ace..dd54fc609da6 100644<br>
--- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h<br>
+++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h<br>
@@ -57,8 +57,6 @@ public:<br>
Signal<FrameBuffer *> &bufferReady() { return video_->bufferReady; }<br>
<br>
private:<br>
- static constexpr unsigned int RKISP1_BUFFER_COUNT = 4;<br>
-<br>
const char *name_;<br>
bool running_;<br>
<br>
diff --git a/src/libcamera/pipeline/simple/converter.cpp b/src/libcamera/pipeline/simple/converter.cpp<br>
index 3133b3dbda07..46ab503b7c38 100644<br>
--- a/src/libcamera/pipeline/simple/converter.cpp<br>
+++ b/src/libcamera/pipeline/simple/converter.cpp<br>
@@ -89,9 +89,6 @@ int SimpleConverter::Stream::configure(const StreamConfiguration &inputCfg,<br>
return -EINVAL;<br>
}<br>
<br>
- inputBufferCount_ = inputCfg.bufferCount;<br>
- outputBufferCount_ = outputCfg.bufferCount;<br>
-<br>
return 0;<br>
}<br>
<br>
diff --git a/src/libcamera/pipeline/simple/converter.h b/src/libcamera/pipeline/simple/converter.h<br>
index deb3df0d08df..365b99e9853e 100644<br>
--- a/src/libcamera/pipeline/simple/converter.h<br>
+++ b/src/libcamera/pipeline/simple/converter.h<br>
@@ -86,9 +86,6 @@ private:<br>
SimpleConverter *converter_;<br>
unsigned int index_;<br>
std::unique_ptr<V4L2M2MDevice> m2m_;<br>
-<br>
- unsigned int inputBufferCount_;<br>
- unsigned int outputBufferCount_;<br>
};<br>
<br>
std::string deviceNode_;<br>
diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp<br>
index d0a658a23be8..6deba5d7dd61 100644<br>
--- a/src/libcamera/pipeline/simple/simple.cpp<br>
+++ b/src/libcamera/pipeline/simple/simple.cpp<br>
@@ -252,7 +252,6 @@ protected:<br>
int queueRequestDevice(Camera *camera, Request *request) override;<br>
<br>
private:<br>
- static constexpr unsigned int kNumInternalBuffers = 3;<br>
static constexpr unsigned int kSimpleBufferSlotCount = 16;<br>
<br>
SimpleCameraData *cameraData(Camera *camera)<br>
@@ -638,7 +637,7 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate()<br>
cfg.size != pipeConfig_->captureSize)<br>
needConversion_ = true;<br>
<br>
- /* Set the stride, frameSize and bufferCount. */<br>
+ /* Set the stride and frameSize. */<br>
if (needConversion_) {<br>
std::tie(cfg.stride, cfg.frameSize) =<br>
converter->strideAndFrameSize(cfg.pixelFormat, cfg.size);<br>
@@ -656,8 +655,6 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate()<br>
cfg.stride = format.planes[0].bpl;<br>
cfg.frameSize = format.planes[0].size;<br>
}<br>
-<br>
- cfg.bufferCount = 3;<br>
}<br>
<br>
return status;<br>
@@ -780,7 +777,6 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)<br>
inputCfg.pixelFormat = pipeConfig->captureFormat;<br>
inputCfg.size = pipeConfig->captureSize;<br>
inputCfg.stride = captureFormat.planes[0].bpl;<br>
- inputCfg.bufferCount = kNumInternalBuffers;<br>
<br>
/* Set the MinimumRequests property. */<br>
unsigned int minimumRequests;<br>
diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp<br>
index c210cf57750f..5977312a795d 100644<br>
--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp<br>
+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp<br>
@@ -150,8 +150,6 @@ CameraConfiguration::Status UVCCameraConfiguration::validate()<br>
status = Adjusted;<br>
}<br>
<br>
- cfg.bufferCount = 4;<br>
-<br>
V4L2DeviceFormat format;<br>
format.fourcc = data_->video_->toV4L2PixelFormat(cfg.pixelFormat);<br>
format.size = cfg.size;<br>
@@ -193,7 +191,6 @@ CameraConfiguration *PipelineHandlerUVC::generateConfiguration(Camera *camera,<br>
<br>
cfg.pixelFormat = formats.pixelformats().front();<br>
cfg.size = formats.sizes(cfg.pixelFormat).back();<br>
- cfg.bufferCount = 4;<br>
<br>
config->addConfiguration(cfg);<br>
<br>
diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp<br>
index d2943f61a745..ad71bfc67228 100644<br>
--- a/src/libcamera/pipeline/vimc/vimc.cpp<br>
+++ b/src/libcamera/pipeline/vimc/vimc.cpp<br>
@@ -170,8 +170,6 @@ CameraConfiguration::Status VimcCameraConfiguration::validate()<br>
status = Adjusted;<br>
}<br>
<br>
- cfg.bufferCount = 4;<br>
-<br>
V4L2DeviceFormat format;<br>
format.fourcc = data_->video_->toV4L2PixelFormat(cfg.pixelFormat);<br>
format.size = cfg.size;<br>
@@ -227,7 +225,6 @@ CameraConfiguration *PipelineHandlerVimc::generateConfiguration(Camera *camera,<br>
<br>
cfg.pixelFormat = formats::BGR888;<br>
cfg.size = { 1920, 1080 };<br>
- cfg.bufferCount = 4;<br>
<br>
config->addConfiguration(cfg);<br>
<br>
diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp<br>
index b421e17ecb36..d4cc0fafb76f 100644<br>
--- a/src/libcamera/stream.cpp<br>
+++ b/src/libcamera/stream.cpp<br>
@@ -280,8 +280,7 @@ SizeRange StreamFormats::range(const PixelFormat &pixelformat) const<br>
* handlers provide StreamFormats.<br>
*/<br>
StreamConfiguration::StreamConfiguration()<br>
- : pixelFormat(0), stride(0), frameSize(0), bufferCount(0),<br>
- stream_(nullptr)<br>
+ : pixelFormat(0), stride(0), frameSize(0), stream_(nullptr)<br>
{<br>
}<br>
<br>
@@ -289,8 +288,8 @@ StreamConfiguration::StreamConfiguration()<br>
* \brief Construct a configuration with stream formats<br>
*/<br>
StreamConfiguration::StreamConfiguration(const StreamFormats &formats)<br>
- : pixelFormat(0), stride(0), frameSize(0), bufferCount(0),<br>
- stream_(nullptr), formats_(formats)<br>
+ : pixelFormat(0), stride(0), frameSize(0), stream_(nullptr),<br>
+ formats_(formats)<br>
{<br>
}<br>
<br>
@@ -324,11 +323,6 @@ StreamConfiguration::StreamConfiguration(const StreamFormats &formats)<br>
* validating the configuration with a call to CameraConfiguration::validate().<br>
*/<br>
<br>
-/**<br>
- * \var StreamConfiguration::bufferCount<br>
- * \brief Requested number of buffers to allocate for the stream<br>
- */<br>
-<br>
/**<br>
* \fn StreamConfiguration::stream()<br>
* \brief Retrieve the stream associated with the configuration<br>
diff --git a/test/camera/buffer_import.cpp b/test/camera/buffer_import.cpp<br>
index c504ea09e64b..67ac0ad20e15 100644<br>
--- a/test/camera/buffer_import.cpp<br>
+++ b/test/camera/buffer_import.cpp<br>
@@ -16,6 +16,8 @@<br>
#include <libcamera/base/thread.h><br>
#include <libcamera/base/timer.h><br>
<br>
+#include <libcamera/property_ids.h><br>
+<br>
#include "libcamera/internal/device_enumerator.h"<br>
#include "libcamera/internal/media_device.h"<br>
#include "libcamera/internal/v4l2_videodevice.h"<br>
@@ -92,10 +94,12 @@ protected:<br>
return TestFail;<br>
}<br>
<br>
+ unsigned int bufferCount = camera_->properties().get(properties::MinimumRequests);<br>
+<br>
Stream *stream = cfg.stream();<br>
<br>
BufferSource source;<br>
- int ret = source.allocate(cfg);<br>
+ int ret = source.allocate(cfg, bufferCount);<br>
if (ret != TestPass)<br>
return ret;<br>
<br>
@@ -139,10 +143,10 @@ protected:<br>
while (timer.isRunning())<br>
dispatcher->processEvents();<br>
<br>
- if (completeRequestsCount_ < cfg.bufferCount * 2) {<br>
+ if (completeRequestsCount_ < bufferCount * 2) {<br>
std::cout << "Failed to capture enough frames (got "<br>
<< completeRequestsCount_ << " expected at least "<br>
- << cfg.bufferCount * 2 << ")" << std::endl;<br>
+ << bufferCount * 2 << ")" << std::endl;<br>
return TestFail;<br>
}<br>
<br>
diff --git a/test/libtest/buffer_source.cpp b/test/libtest/buffer_source.cpp<br>
index 73563f2fc39d..c3d5286a2462 100644<br>
--- a/test/libtest/buffer_source.cpp<br>
+++ b/test/libtest/buffer_source.cpp<br>
@@ -24,7 +24,7 @@ BufferSource::~BufferSource()<br>
media_->release();<br>
}<br>
<br>
-int BufferSource::allocate(const StreamConfiguration &config)<br>
+int BufferSource::allocate(const StreamConfiguration &config, unsigned int count)<br>
{<br>
/* Locate and open the video device. */<br>
std::string videoDeviceName = "vivid-000-vid-out";<br>
@@ -77,7 +77,7 @@ int BufferSource::allocate(const StreamConfiguration &config)<br>
return TestFail;<br>
}<br>
<br>
- if (video->allocateBuffers(config.bufferCount, &buffers_) < 0) {<br>
+ if (video->allocateBuffers(count, &buffers_) < 0) {<br>
std::cout << "Failed to allocate buffers" << std::endl;<br>
return TestFail;<br>
}<br>
diff --git a/test/libtest/buffer_source.h b/test/libtest/buffer_source.h<br>
index 14b4770e8d8a..6a18e269a575 100644<br>
--- a/test/libtest/buffer_source.h<br>
+++ b/test/libtest/buffer_source.h<br>
@@ -20,7 +20,7 @@ public:<br>
BufferSource();<br>
~BufferSource();<br>
<br>
- int allocate(const StreamConfiguration &config);<br>
+ int allocate(const StreamConfiguration &config, unsigned int count);<br>
const std::vector<std::unique_ptr<FrameBuffer>> &buffers();<br>
<br>
private:<br>
diff --git a/test/v4l2_videodevice/buffer_cache.cpp b/test/v4l2_videodevice/buffer_cache.cpp<br>
index b3f2bec11783..6c8183800d0b 100644<br>
--- a/test/v4l2_videodevice/buffer_cache.cpp<br>
+++ b/test/v4l2_videodevice/buffer_cache.cpp<br>
@@ -145,10 +145,9 @@ public:<br>
StreamConfiguration cfg;<br>
cfg.pixelFormat = formats::YUYV;<br>
cfg.size = Size(600, 800);<br>
- cfg.bufferCount = numBuffers;<br>
<br>
BufferSource source;<br>
- int ret = source.allocate(cfg);<br>
+ int ret = source.allocate(cfg, numBuffers);<br>
if (ret != TestPass)<br>
return ret;<br>
<br>
-- <br>
2.33.0<br>
<br>
</blockquote></div></div>