@@ -217,7 +217,7 @@ stub implementations for the overridden class members.
};
PipelineHandlerVivid::PipelineHandlerVivid(CameraManager *manager)
- : PipelineHandler(manager)
+ : PipelineHandler(manager, {})
{
}
@@ -37,8 +37,11 @@ class PipelineHandler : public std::enable_shared_from_this<PipelineHandler>,
public Object
{
public:
- PipelineHandler(CameraManager *manager,
- unsigned int maxQueuedRequestsDevice = 32);
+ struct Options {
+ unsigned int maxQueuedRequestsDevice = 32;
+ };
+
+ PipelineHandler(CameraManager *manager, const Options &options);
virtual ~PipelineHandler();
virtual bool match(DeviceEnumerator *enumerator) = 0;
@@ -100,7 +103,6 @@ protected:
virtual void releaseDevice(Camera *camera);
CameraManager *manager_;
- const unsigned int maxQueuedRequestsDevice_;
private:
void unlockMediaDevices();
@@ -117,6 +119,8 @@ private:
const char *name_;
unsigned int useCount_;
+ const Options options_;
+
friend class PipelineHandlerFactoryBase;
};
@@ -612,7 +612,7 @@ CameraConfiguration::Status ISICameraConfiguration::validate()
*/
PipelineHandlerISI::PipelineHandlerISI(CameraManager *manager)
- : PipelineHandler(manager)
+ : PipelineHandler(manager, {})
{
}
@@ -385,7 +385,7 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()
}
PipelineHandlerIPU3::PipelineHandlerIPU3(CameraManager *manager)
- : PipelineHandler(manager), cio2MediaDev_(nullptr), imguMediaDev_(nullptr)
+ : PipelineHandler(manager, {}), cio2MediaDev_(nullptr), imguMediaDev_(nullptr)
{
}
@@ -786,7 +786,8 @@ private:
};
PipelineHandlerMaliC55::PipelineHandlerMaliC55(CameraManager *manager)
- : PipelineHandler(manager, kMaliC55BufferCount), dsFitted_(true)
+ : PipelineHandler(manager, { .maxQueuedRequestsDevice = kMaliC55BufferCount }),
+ dsFitted_(true)
{
}
@@ -782,7 +782,8 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate()
*/
PipelineHandlerRkISP1::PipelineHandlerRkISP1(CameraManager *manager)
- : PipelineHandler(manager, kRkISP1MaxQueuedRequests), hasSelfPath_(true)
+ : PipelineHandler(manager, { .maxQueuedRequestsDevice = kRkISP1MaxQueuedRequests }),
+ hasSelfPath_(true)
{
}
@@ -203,7 +203,7 @@ class PipelineHandlerBase : public PipelineHandler
{
public:
PipelineHandlerBase(CameraManager *manager)
- : PipelineHandler(manager)
+ : PipelineHandler(manager, {})
{
}
@@ -1402,7 +1402,7 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate()
*/
SimplePipelineHandler::SimplePipelineHandler(CameraManager *manager)
- : PipelineHandler(manager, kMaxQueuedRequestsDevice),
+ : PipelineHandler(manager, { .maxQueuedRequestsDevice = kMaxQueuedRequestsDevice }),
converter_(nullptr)
{
}
@@ -230,7 +230,7 @@ CameraConfiguration::Status UVCCameraConfiguration::validate()
}
PipelineHandlerUVC::PipelineHandlerUVC(CameraManager *manager)
- : PipelineHandler(manager)
+ : PipelineHandler(manager, {})
{
}
@@ -196,7 +196,7 @@ CameraConfiguration::Status VimcCameraConfiguration::validate()
}
PipelineHandlerVimc::PipelineHandlerVimc(CameraManager *manager)
- : PipelineHandler(manager)
+ : PipelineHandler(manager, {})
{
}
@@ -243,7 +243,7 @@ CameraConfiguration::Status VirtualCameraConfiguration::validate()
bool PipelineHandlerVirtual::created_ = false;
PipelineHandlerVirtual::PipelineHandlerVirtual(CameraManager *manager)
- : PipelineHandler(manager),
+ : PipelineHandler(manager, {}),
dmaBufAllocator_(DmaBufAllocator::DmaBufAllocatorFlag::CmaHeap |
DmaBufAllocator::DmaBufAllocatorFlag::SystemHeap |
DmaBufAllocator::DmaBufAllocatorFlag::UDmaBuf)
@@ -59,20 +59,37 @@ LOG_DEFINE_CATEGORY(Pipeline)
* PipelineHandler class where only the 'this' pointer is available.
*/
+/**
+ * \class PipelineHandler::Options
+ * \brief The collection of optional options of the base class
+ */
+
+/**
+ * \var PipelineHandler::Options::maxQueuedRequestsDevice
+ * \brief The maximum number of requests the pipeline handler shall queue to the
+ * device
+ *
+ * maxQueuedRequestsDevice limits the number of request that the
+ * pipeline handler shall queue to the underlying hardware, in order to
+ * saturate the pipeline with requests. The application may choose to queue
+ * as many requests as it desires, however only maxQueuedRequestsDevice
+ * requests will be queued to the hardware at a given point in time. The
+ * remaining requests will be kept waiting in the internal waiting
+ * queue, to be queued at a later stage.
+ */
+
/**
* \brief Construct a PipelineHandler instance
* \param[in] manager The camera manager
- * \param[in] maxQueuedRequestsDevice The maximum number of requests queued to
- * the device
+ * \param[in] options The options options for the pipeline handler base class
*
* In order to honour the std::enable_shared_from_this<> contract,
* PipelineHandler instances shall never be constructed manually, but always
* through the PipelineHandlerFactoryBase::create() function.
*/
PipelineHandler::PipelineHandler(CameraManager *manager,
- unsigned int maxQueuedRequestsDevice)
- : manager_(manager), maxQueuedRequestsDevice_(maxQueuedRequestsDevice),
- useCount_(0)
+ const Options &options)
+ : manager_(manager), useCount_(0), options_(options)
{
}
@@ -453,7 +470,7 @@ bool PipelineHandler::hasPendingRequests(const Camera *camera) const
* queued to the pipeline handler.
*
* The queue of waiting requests is iterated and up to \a
- * maxQueuedRequestsDevice_ prepared requests are passed to the pipeline handler
+ * maxQueuedRequestsDevice prepared requests are passed to the pipeline handler
* in the same order they have been queued by calling this function.
*
* If a Request fails during the preparation phase or if the pipeline handler
@@ -509,7 +526,7 @@ void PipelineHandler::doQueueRequests(Camera *camera)
{
Camera::Private *data = camera->_d();
while (!data->waitingRequests_.empty()) {
- if (data->queuedRequests_.size() == maxQueuedRequestsDevice_)
+ if (data->queuedRequests_.size() == options_.maxQueuedRequestsDevice)
break;
Request *request = data->waitingRequests_.front();
@@ -862,20 +879,6 @@ void PipelineHandler::disconnect()
* constant for the whole lifetime of the pipeline handler.
*/
-/**
- * \var PipelineHandler::maxQueuedRequestsDevice_
- * \brief The maximum number of requests the pipeline handler shall queue to the
- * device
- *
- * maxQueuedRequestsDevice_ limits the number of request that the
- * pipeline handler shall queue to the underlying hardware, in order to
- * saturate the pipeline with requests. The application may choose to queue
- * as many requests as it desires, however only maxQueuedRequestsDevice_
- * requests will be queued to the hardware at a given point in time. The
- * remaining requests will be kept waiting in the internal waiting
- * queue, to be queued at a later stage.
- */
-
/**
* \fn PipelineHandler::name()
* \brief Retrieve the pipeline handler name
Add a new `Options` type that stores the optional parameters for the pipeline handler base class. Currently there is only one, which is "maxQueuedRequestsDevice". TODO: `options = {}` does not work in the arg list, should it be worked around or is it fine? Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> --- Documentation/guides/pipeline-handler.rst | 2 +- include/libcamera/internal/pipeline_handler.h | 10 +++-- src/libcamera/pipeline/imx8-isi/imx8-isi.cpp | 2 +- src/libcamera/pipeline/ipu3/ipu3.cpp | 2 +- src/libcamera/pipeline/mali-c55/mali-c55.cpp | 3 +- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 3 +- .../pipeline/rpi/common/pipeline_base.h | 2 +- src/libcamera/pipeline/simple/simple.cpp | 2 +- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 2 +- src/libcamera/pipeline/vimc/vimc.cpp | 2 +- src/libcamera/pipeline/virtual/virtual.cpp | 2 +- src/libcamera/pipeline_handler.cpp | 45 ++++++++++--------- 12 files changed, 43 insertions(+), 34 deletions(-)