diff options
author | Phi-Bang Nguyen <pnguyen@baylibre.com> | 2021-04-02 17:00:49 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2021-11-19 22:38:45 +0200 |
commit | 5d9877d697655f4d020520f5ead5b690d6a56034 (patch) | |
tree | 2512c7d6490c9d8631b2139e86c6435ac1d7282f /src | |
parent | e771c4392198988cfeba07b3b4ce3a32b2bcfd0d (diff) |
libcamera: pipeline: simple: Don't disable links carrying other streamsmtk/multi-cam
If a subdev supports the internal routing API, pads unrelated to the
pipeline for a given camera sensor may carry streams for other cameras.
The link setup logic is updated to take this into account, by avoiding
disabling links to unrelated pads.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/libcamera/pipeline/simple/simple.cpp | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 8c3fbc9e..3061504d 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -193,6 +193,11 @@ public: /* The media entity, always valid. */ MediaEntity *entity; /* + * Whether or not the entity is a subdev that supports the + * routing API. + */ + bool supportsRouting; + /* * The local sink pad connected to the upstream entity, null for * the camera sensor at the beginning of the pipeline. */ @@ -372,9 +377,13 @@ SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe, */ std::vector<const MediaPad *> pads; + bool supportsRouting = false; - if (sinkPad) + if (sinkPad) { pads = routedSourcePads(sinkPad); + if (!pads.empty()) + supportsRouting = true; + } if (pads.empty()) { for (const MediaPad *pad : entity->pads()) { @@ -389,7 +398,9 @@ SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe, MediaEntity *next = link->sink()->entity(); if (visited.find(next) == visited.end()) { queue.push({ next, link->sink() }); - parents.insert({ next, { entity, sinkPad, pad, link } }); + + Entity e{ entity, supportsRouting, sinkPad, pad, link }; + parents.insert({ next, e }); } } } @@ -403,7 +414,7 @@ SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe, * to the sensor. Store all the entities in the pipeline, from the * camera sensor to the video node, in entities_. */ - entities_.push_front({ entity, sinkPad, nullptr, nullptr }); + entities_.push_front({ entity, false, sinkPad, nullptr, nullptr }); for (auto it = parents.find(entity); it != parents.end(); it = parents.find(entity)) { @@ -568,6 +579,17 @@ int SimpleCameraData::setupLinks() } for (MediaPad *pad : e.entity->pads()) { + /* + * If the entity supports the V4L2 internal routing API, + * assume that it may carry multiple independent streams + * concurrently, and only disable links on the sink and + * source pads used by the pipeline. + */ + if (e.supportsRouting) { + if (pad != e.sink && pad != e.source) + continue; + } + for (MediaLink *link : pad->links()) { if (link == sinkLink) continue; |