Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/core/processingUnit/CBStage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,11 @@ int CBStage::allocateNode2SelfBuffers(const PSysLink& psysLink, uint32_t bufferS
}

int CBStage::setTerminalLinkAndAllocNode2SelfBuffers(const GraphLink** links, uint8_t numOfLink) {
CheckAndLogError(!links, UNKNOWN_ERROR, "%s: links is nullptr", __func__);
for (uint8_t i = 0U; i < numOfLink; i++) {
const GraphLink* link = links[i];

if (!link->isActive) {
if (!link || !link->isActive) {
continue;
}
const bool related = ((link->srcNode != nullptr) &&
Expand All @@ -416,7 +417,7 @@ int CBStage::setTerminalLinkAndAllocNode2SelfBuffers(const GraphLink** links, ui
continue;
}

PSysLink psysLink;
PSysLink psysLink = {};
switch (link->type) {
case LinkType::Source2Node:
psysLink.srcNodeCtxId = 0xFF;
Expand All @@ -425,12 +426,12 @@ int CBStage::setTerminalLinkAndAllocNode2SelfBuffers(const GraphLink** links, ui
psysLink.dstTermId = link->destTerminalId;
break;
case LinkType::Node2Node:
if (link->destNode->contextId == mOuterNodeCtxId) {
if (link->destNode && link->destNode->contextId == mOuterNodeCtxId) {
psysLink.srcNodeCtxId = 0xFF; // can't know psys ctx id of other node
psysLink.srcTermId = 0xFF;
psysLink.dstNodeCtxId = mContextId;
psysLink.dstTermId = link->destTerminalId;
} else if (link->srcNode->contextId == mOuterNodeCtxId) {
} else if (link->srcNode && link->srcNode->contextId == mOuterNodeCtxId) {
psysLink.srcNodeCtxId = mContextId;
psysLink.srcTermId = link->srcTerminalId;
psysLink.dstNodeCtxId = 0xFF;
Expand All @@ -454,10 +455,12 @@ int CBStage::setTerminalLinkAndAllocNode2SelfBuffers(const GraphLink** links, ui
break;
}

psysLink.streamingMode = link->linkConfiguration->streamingMode;
if (link->linkConfiguration) {
psysLink.streamingMode = link->linkConfiguration->streamingMode;
}
psysLink.delayedLink = link->frameDelay;

if (link->type == LinkType::Node2Self) {
if (link->type == LinkType::Node2Self && link->linkConfiguration) {
const int ret = allocateNode2SelfBuffers(psysLink, link->linkConfiguration->bufferSize);
CheckAndLogError(ret != OK, NO_MEMORY, "Failed to alloc node2self buffer");
}
Expand Down
6 changes: 4 additions & 2 deletions src/core/processingUnit/PipeLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,14 @@ status_t PipeLine::updateConfigurationSettingForPtz(bool isKeyResChanged) {
}

status_t PipeLine::createPSysGraph(int32_t numLinks, GraphLink** links) {
CheckAndLogError(!links, UNKNOWN_ERROR, "%s: links is nullptr", __func__);

mPSysGraph.links.clear();

std::map<uint8_t, PSysNode> nodes; // <contextId, node>
for (int32_t i = 0; i < numLinks; i++) {
const GraphLink* link = links[i];
if (!link->isActive) {
if (!link || !link->isActive) {
continue;
}

Expand Down Expand Up @@ -374,7 +376,7 @@ status_t PipeLine::createPSysGraph(int32_t numLinks, GraphLink** links) {
if (link->type != LinkType::Node2Node && link->type != LinkType::Node2Self) {
continue;
}
if (link->srcNode->type == NodeTypes::Isys) {
if (!link->srcNode || !link->destNode || link->srcNode->type == NodeTypes::Isys) {
continue;
}

Expand Down
23 changes: 14 additions & 9 deletions src/platformdata/gc/GraphConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,9 @@ void GraphConfig::getStaticGraphConfigData(const std::map<VirtualSink, const Hal
}

void GraphConfig::saveOuterNode(const GraphLink* link, StaticGraphInfo* graph) {
if (!link || !graph) {
return;
}
// Save nodes, except ISYS
if ((!link->isActive) || (link->destNode == nullptr) ||
(link->destNode->type == NodeTypes::Isys)) {
Expand Down Expand Up @@ -713,11 +716,11 @@ void GraphConfig::saveOuterNode(const GraphLink* link, StaticGraphInfo* graph) {

void GraphConfig::saveLink(int32_t streamId, const GraphLink* link,
std::map<HwSink, const HalStream*>* streams, StaticGraphInfo* graph) {
if (!link->isActive) {
if (!link || !graph || !link->isActive) {
return;
}
// Ignore link: src="-1:Sensor:0" dest="2:Isys:0" type="Source2Node"
if ((link->type == LinkType::Source2Node) && (link->destNode->type == NodeTypes::Isys)) {
if ((link->type == LinkType::Source2Node) && (link->destNode && link->destNode->type == NodeTypes::Isys)) {
return;
}

Expand All @@ -727,7 +730,7 @@ void GraphConfig::saveLink(int32_t streamId, const GraphLink* link,
// src="-1:LscBuffer:0" dest="0:LbffBayer:4" type="Source2Node"
ipuLink.isEdge = true;
hasNecessaryNode = link->destNode;
} else if ((link->type == LinkType::Node2Node) && (link->srcNode->type == NodeTypes::Isys)) {
} else if ((link->type == LinkType::Node2Node) && (link->srcNode && link->srcNode->type == NodeTypes::Isys)) {
// src="2:Isys:1" dest="0:LbffBayer:3" type="Node2Node"
ipuLink.isEdge = true;
hasNecessaryNode = link->destNode;
Expand All @@ -737,12 +740,14 @@ void GraphConfig::saveLink(int32_t streamId, const GraphLink* link,
ipuLink.isEdge = true;
hasNecessaryNode = link->srcNode;
// Find output stream
for (auto& s : *streams) {
if (((link->dest == GraphElementType::ImageMp) && (s.first == HwSink::ImageMpSink)) ||
((link->dest == GraphElementType::ImageDp) && (s.first == HwSink::ImageDpSink))) {
ipuLink.stream = s.second;
streams->erase(s.first);
break;
if (streams) {
for (auto& s : *streams) {
if (((link->dest == GraphElementType::ImageMp) && (s.first == HwSink::ImageMpSink)) ||
((link->dest == GraphElementType::ImageDp) && (s.first == HwSink::ImageDpSink))) {
ipuLink.stream = s.second;
streams->erase(s.first);
break;
}
}
}
}
Expand Down