Skip to content
Merged
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
22 changes: 22 additions & 0 deletions src/ipc/ipc4/handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,28 @@ static struct ipc_comp_dev *pipeline_get_host_dev(struct ipc_comp_dev *ppl_icd)
struct ipc *ipc = ipc_get();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: in commit message

This synchronization of the
direction property guarantees that the pipeline's data flow is correctly
established.

This synchronization of the direction property guarantees that the
pipeline's data flow is correctly established

looks like a duplication

int host_id;

/* If the source component's direction is not set but the sink's direction is,
* this block will copy the direction from the sink to the source component and
* mark the source's direction as set.
*/
if (!ppl_icd->pipeline->source_comp->direction_set &&
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identical code and logic is already done in ipc_comp_connect(). It would be interesting to understand better why this can happen in some case. If this cannot be avoided, can we have a shared helped used by both this function and ipc_comp_connect() ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the choice of a function to place this code into isn't very obvious. Is this function called for each new pipeline before it's activated? Maybe some more obvious place like when a streaming attempt is made would be clearer?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lyakh I had the same concern, but looks like it's not so easy to pick another spot. This is called from multiple places, from the state machine implementing pipeline state changes. I'm happy with the extended git commit message to explain the change.

ppl_icd->pipeline->sink_comp->direction_set) {
ppl_icd->pipeline->source_comp->direction =
ppl_icd->pipeline->sink_comp->direction;
ppl_icd->pipeline->source_comp->direction_set = true;
}

/* If the sink component's direction is not set but the source's direction is,
* this block will copy the direction from the source to the sink component and
* mark the sink's direction as set.
*/
if (!ppl_icd->pipeline->sink_comp->direction_set &&
ppl_icd->pipeline->source_comp->direction_set) {
ppl_icd->pipeline->sink_comp->direction =
ppl_icd->pipeline->source_comp->direction;
ppl_icd->pipeline->sink_comp->direction_set = true;
}

if (ppl_icd->pipeline->source_comp->direction == SOF_IPC_STREAM_PLAYBACK)
host_id = ppl_icd->pipeline->source_comp->ipc_config.id;
else
Expand Down