summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline/simple
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-12-24 17:54:07 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-03-03 00:59:32 +0200
commit6715a31f39457c57098e397109e4902a7df1f9a6 (patch)
tree98d49653e344af2b0feeaa9bdf6fb45fb2315b46 /src/libcamera/pipeline/simple
parent379af2ee5212faf7b4b8a8d3f4de5febdcf2d630 (diff)
libcamera: pipeline: simple: Enable multiple streams for compatible devices
Allow support for multiple streams on a per-device basis. The decision should be made based on the ability of the converter to run multiple times within the duration of one frame. Hardcode it in SimplePipelineInfo for now. We may later compute the number of supported streams dynamically based on the requested configuration, using converter bandwidth information instead of a hardcoded fixed value. All platforms are currently limited to a single stream until they get successfully tested with multiple streams. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Phi-Bang Nguyen <pnguyen@baylibre.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/libcamera/pipeline/simple')
-rw-r--r--src/libcamera/pipeline/simple/simple.cpp39
1 files changed, 21 insertions, 18 deletions
diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index d3e7f782..7fba495c 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -126,14 +126,15 @@ class SimplePipelineHandler;
struct SimplePipelineInfo {
const char *driver;
const char *converter;
+ unsigned int numStreams;
};
namespace {
static const SimplePipelineInfo supportedDevices[] = {
- { "imx7-csi", "pxp" },
- { "qcom-camss", nullptr },
- { "sun6i-csi", nullptr },
+ { "imx7-csi", "pxp", 1 },
+ { "qcom-camss", nullptr, 1 },
+ { "sun6i-csi", nullptr, 1 },
};
} /* namespace */
@@ -141,7 +142,9 @@ static const SimplePipelineInfo supportedDevices[] = {
class SimpleCameraData : public CameraData
{
public:
- SimpleCameraData(SimplePipelineHandler *pipe, MediaEntity *sensor);
+ SimpleCameraData(SimplePipelineHandler *pipe,
+ const SimplePipelineInfo *info,
+ MediaEntity *sensor);
bool isValid() const { return sensor_ != nullptr; }
@@ -259,13 +262,12 @@ private:
*/
SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe,
+ const SimplePipelineInfo *info,
MediaEntity *sensor)
- : CameraData(pipe)
+ : CameraData(pipe), streams_(info->numStreams)
{
int ret;
- streams_.resize(1);
-
/*
* Walk the pipeline towards the video node and store all entities
* along the way.
@@ -868,25 +870,26 @@ int SimplePipelineHandler::queueRequestDevice(Camera *camera, Request *request)
bool SimplePipelineHandler::match(DeviceEnumerator *enumerator)
{
+ const SimplePipelineInfo *info = nullptr;
MediaDevice *converter = nullptr;
- for (const SimplePipelineInfo &info : supportedDevices) {
- DeviceMatch dm(info.driver);
+ for (const SimplePipelineInfo &inf : supportedDevices) {
+ DeviceMatch dm(inf.driver);
media_ = acquireMediaDevice(enumerator, dm);
- if (!media_)
- continue;
-
- if (!info.converter)
+ if (media_) {
+ info = &inf;
break;
-
- DeviceMatch converterMatch(info.converter);
- converter = acquireMediaDevice(enumerator, converterMatch);
- break;
+ }
}
if (!media_)
return false;
+ if (info->converter) {
+ DeviceMatch converterMatch(info->converter);
+ converter = acquireMediaDevice(enumerator, converterMatch);
+ }
+
/* Locate the sensors. */
std::vector<MediaEntity *> sensors;
@@ -930,7 +933,7 @@ bool SimplePipelineHandler::match(DeviceEnumerator *enumerator)
for (MediaEntity *sensor : sensors) {
std::unique_ptr<SimpleCameraData> data =
- std::make_unique<SimpleCameraData>(this, sensor);
+ std::make_unique<SimpleCameraData>(this, info, sensor);
if (!data->isValid()) {
LOG(SimplePipeline, Error)
<< "No valid pipeline for sensor '"