summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-07-03 18:33:55 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-08-31 22:44:10 +0300
commit0f65875bafd7a870319283413810922f88dc0464 (patch)
treec16cb7dd6d4b7166b9468586e59d7b7acc8cacc8 /src
parenta376aa331ae9308f55baa9bb50680c35dc032058 (diff)
libcamera: pipeline: simple: Add sink and source pads to entity data
Record the sink and source pads through which an entity is traversed in the list of entities stored in the camera data. This prepares for implementing mutually exclusive access to entities between cameras. The debug message that displays detected pipelines now prints pads to describe the pipeline more precisely: [0:00:35.901275750] [260] DEBUG SimplePipeline simple.cpp:404 Found pipeline: [imx290 2-001a|0] -> [0|csis-32e40000.csi|1] -> [0|mxc_isi.0|1] -> [0|mxc_isi.0.capture] Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Martin Kepplinger <martin.kepplinger@puri.sm>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/pipeline/simple/simple.cpp38
1 files changed, 32 insertions, 6 deletions
diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index 8ff95472..32bfd45f 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -168,7 +168,22 @@ public:
}
struct Entity {
+ /* The media entity, always valid. */
MediaEntity *entity;
+ /*
+ * The local sink pad connected to the upstream entity, null for
+ * the camera sensor at the beginning of the pipeline.
+ */
+ const MediaPad *sink;
+ /*
+ * The local source pad connected to the downstream entity, null
+ * for the video node at the end of the pipeline.
+ */
+ const MediaPad *source;
+ /*
+ * The link to the downstream entity, null for the video node at
+ * the end of the pipeline.
+ */
MediaLink *link;
};
@@ -289,16 +304,18 @@ SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe,
* encoders and image converters, and will end in a CSI capture device.
*/
std::unordered_set<MediaEntity *> visited;
- std::queue<MediaEntity *> queue;
+ std::queue<std::tuple<MediaEntity *, MediaPad *>> queue;
/* Remember at each entity where we came from. */
std::unordered_map<MediaEntity *, Entity> parents;
MediaEntity *entity = nullptr;
- queue.push(sensor);
+ queue.push({ sensor, nullptr });
while (!queue.empty()) {
- entity = queue.front();
+ MediaPad *sinkPad;
+
+ std::tie(entity, sinkPad) = queue.front();
queue.pop();
/* Found the capture device. */
@@ -318,8 +335,8 @@ SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe,
for (MediaLink *link : pad->links()) {
MediaEntity *next = link->sink()->entity();
if (visited.find(next) == visited.end()) {
- queue.push(next);
- parents.insert({ next, { entity, link } });
+ queue.push({ next, link->sink() });
+ parents.insert({ next, { entity, sinkPad, pad, link } });
}
}
}
@@ -350,7 +367,16 @@ SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe,
LOG(SimplePipeline, Debug)
<< "Found pipeline: "
<< utils::join(entities_, " -> ",
- [](const Entity &e) { return e.entity->name(); });
+ [](const Entity &e) {
+ std::string s = "[";
+ if (e.sink)
+ s += std::to_string(e.sink->index()) + "|";
+ s += e.entity->name();
+ if (e.source)
+ s += "|" + std::to_string(e.source->index());
+ s += "]";
+ return s;
+ });
}
SimplePipelineHandler *SimpleCameraData::pipe()