Skip to content

Commit

Permalink
Revert "Revert "ipc4: handler: Use separate loops for pipeline state …
Browse files Browse the repository at this point in the history
…phases""

This reverts commit 0dba9cc.
  • Loading branch information
abonislawski committed Jan 11, 2024
1 parent ae5361c commit 308d5a8
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 15 deletions.
1 change: 0 additions & 1 deletion src/include/sof/ipc/topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ int ipc4_trigger_chain_dma(struct ipc *ipc, struct ipc4_chain_dma *cdma, bool *d
int ipc4_process_on_core(uint32_t core, bool blocking);
int ipc4_pipeline_complete(struct ipc *ipc, uint32_t comp_id, uint32_t cmd);
int ipc4_find_dma_config(struct ipc_config_dai *dai, uint8_t *data_buffer, uint32_t size);
int set_pipeline_state(struct ipc_comp_dev *ppl_icd, uint32_t cmd, bool *delayed);
int ipc4_pipeline_prepare(struct ipc_comp_dev *ppl_icd, uint32_t cmd);
int ipc4_pipeline_trigger(struct ipc_comp_dev *ppl_icd, uint32_t cmd, bool *delayed);

Expand Down
49 changes: 35 additions & 14 deletions src/ipc/ipc4/handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,18 +469,6 @@ int ipc4_pipeline_trigger(struct ipc_comp_dev *ppl_icd, uint32_t cmd, bool *dela
return ret;
}

int set_pipeline_state(struct ipc_comp_dev *ppl_icd, uint32_t cmd,
bool *delayed)
{
int ret;

ret = ipc4_pipeline_prepare(ppl_icd, cmd);
if (ret)
return ret;

return ipc4_pipeline_trigger(ppl_icd, cmd, delayed);
}

static void ipc_compound_pre_start(int msg_id)
{
/* ipc thread will wait for all scheduled tasks to be complete
Expand Down Expand Up @@ -587,6 +575,39 @@ static int ipc4_set_pipeline_state(struct ipc4_message_request *ipc4)
}
}

/* Run the prepare phase on the pipelines */
for (i = 0; i < ppl_count; i++) {
ppl_icd = ipc_get_comp_by_ppl_id(ipc, COMP_TYPE_PIPELINE,
ppl_id[i], IPC_COMP_IGNORE_REMOTE);
if (!ppl_icd) {
ipc_cmd_err(&ipc_tr, "ipc: comp %d not found", ppl_id[i]);
return IPC4_INVALID_RESOURCE_ID;
}

/* Pass IPC to target core
* or use idc if more than one core used
*/
if (!cpu_is_me(ppl_icd->core)) {
if (use_idc) {
struct idc_msg msg = { IDC_MSG_PPL_STATE,
IDC_MSG_PPL_STATE_EXT(ppl_id[i],
IDC_PPL_STATE_PHASE_PREPARE),
ppl_icd->core,
sizeof(cmd), &cmd, };

ret = idc_send_msg(&msg, IDC_BLOCKING);
} else {
return ipc4_process_on_core(ppl_icd->core, false);
}
} else {
ret = ipc4_pipeline_prepare(ppl_icd, cmd);
}

if (ret != 0)
return ret;
}

/* Run the trigger phase on the pipelines */
for (i = 0; i < ppl_count; i++) {
bool delayed = false;

Expand All @@ -604,7 +625,7 @@ static int ipc4_set_pipeline_state(struct ipc4_message_request *ipc4)
if (use_idc) {
struct idc_msg msg = { IDC_MSG_PPL_STATE,
IDC_MSG_PPL_STATE_EXT(ppl_id[i],
IDC_PPL_STATE_PHASE_ONESHOT),
IDC_PPL_STATE_PHASE_TRIGGER),
ppl_icd->core,
sizeof(cmd), &cmd, };

Expand All @@ -614,7 +635,7 @@ static int ipc4_set_pipeline_state(struct ipc4_message_request *ipc4)
}
} else {
ipc_compound_pre_start(state.primary.r.type);
ret = set_pipeline_state(ppl_icd, cmd, &delayed);
ret = ipc4_pipeline_trigger(ppl_icd, cmd, &delayed);
ipc_compound_post_start(state.primary.r.type, ret, delayed);
}

Expand Down

0 comments on commit 308d5a8

Please sign in to comment.