ipc4: copier: update source format if needed

used only for rare cases where two pipelines are connected by a shared
buffer and 2 copiers, this will set source format only for shared buffers
for a short time when the second pipeline already started
and the first one is not ready yet along with sink buffers params

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
This commit is contained in:
Adrian Bonislawski 2021-12-22 17:17:54 +01:00 committed by Liam Girdwood
parent 8e8d1060f5
commit ea85ccf25f
1 changed files with 33 additions and 0 deletions

View File

@ -698,7 +698,9 @@ static int copier_params(struct comp_dev *dev, struct sof_ipc_stream_params *par
struct copier_data *cd = comp_get_drvdata(dev); struct copier_data *cd = comp_get_drvdata(dev);
union ipc4_connector_node_id node_id; union ipc4_connector_node_id node_id;
struct comp_buffer *sink; struct comp_buffer *sink;
struct comp_buffer *source;
struct list_item *sink_list; struct list_item *sink_list;
struct list_item *src_list;
int ret = 0; int ret = 0;
comp_dbg(dev, "copier_params()"); comp_dbg(dev, "copier_params()");
@ -734,6 +736,37 @@ static int copier_params(struct comp_dev *dev, struct sof_ipc_stream_params *par
for (i = 0; i < SOF_IPC_MAX_CHANNELS; i++) for (i = 0; i < SOF_IPC_MAX_CHANNELS; i++)
sink->chmap[i] = (cd->out_fmt[j].ch_map >> i * 4) & 0xf; sink->chmap[i] = (cd->out_fmt[j].ch_map >> i * 4) & 0xf;
sink->hw_params_configured = true;
}
/* update each source format
* used only for rare cases where two pipelines are connected by a shared
* buffer and 2 copiers, this will set source format only for shared buffers
* for a short time when the second pipeline already started
* and the first one is not ready yet along with sink buffers params
*/
list_for_item(src_list, &dev->bsource_list) {
int i, j;
source = container_of(src_list, struct comp_buffer, sink_list);
if (source->hw_params_configured == false) {
j = IPC4_SRC_QUEUE_ID(source->id);
source->stream.channels = cd->out_fmt[j].channels_count;
source->stream.rate = cd->out_fmt[j].sampling_frequency;
audio_stream_fmt_conversion(cd->out_fmt[j].depth,
cd->out_fmt[j].valid_bit_depth,
&source->stream.frame_fmt,
&source->stream.valid_sample_fmt,
cd->out_fmt[j].s_type);
source->buffer_fmt = cd->out_fmt[j].interleaving_style;
for (i = 0; i < SOF_IPC_MAX_CHANNELS; i++)
source->chmap[i] = (cd->out_fmt[j].ch_map >> i * 4) & 0xf;
source->hw_params_configured = true;
}
} }
if (cd->endpoint) { if (cd->endpoint) {