Skip to content

Commit d5a0785

Browse files
....
1 parent 135ea06 commit d5a0785

4 files changed

Lines changed: 16 additions & 31 deletions

File tree

src/audio/module_adapter/module_adapter.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -621,17 +621,14 @@ static void module_adapter_process_output(struct comp_dev *dev)
621621

622622
/* copy from all output local buffers to sink buffers */
623623
i = 0;
624-
list_for_item(blist, &dev->bsink_list) { //msz tutaj do nowych
625-
struct list_item *_blist;
624+
comp_dev_for_each_consumer(dev, sink) {
626625
int j = 0;
627626

628-
list_for_item(_blist, &mod->raw_data_buffers_list) {
627+
list_for_item(blist, &mod->raw_data_buffers_list) {
629628
if (i == j) {
630629
struct comp_buffer *source;
631630

632-
sink = container_of(blist, struct comp_buffer, Xsource_list); //tu
633-
source = container_of(_blist, struct comp_buffer, Xsink_list); //i tu
634-
631+
source = container_of(blist, struct comp_buffer, buffers_list);
635632
module_copy_samples(dev, source, sink,
636633
mod->output_buffers[i].size);
637634

@@ -1011,12 +1008,10 @@ static int module_adapter_raw_data_type_copy(struct comp_dev *dev)
10111008
}
10121009

10131010
/* copy source samples into input buffer */
1014-
list_for_item(blist, &dev->bsource_list) {
1011+
comp_dev_for_each_producer(dev, source) {
10151012
uint32_t bytes_to_process;
10161013
int frames, source_frame_bytes;
10171014

1018-
source = container_of(blist, struct comp_buffer, Xsink_list);
1019-
10201015
/* check if the source dev is in the same state as the dev */
10211016
if (comp_buffer_get_source_state(source) != dev->state)
10221017
continue;
@@ -1051,10 +1046,7 @@ static int module_adapter_raw_data_type_copy(struct comp_dev *dev)
10511046

10521047
i = 0;
10531048
/* consume from all input buffers */
1054-
list_for_item(blist, &dev->bsource_list) {
1055-
1056-
source = container_of(blist, struct comp_buffer, Xsink_list);
1057-
1049+
comp_dev_for_each_producer(dev, source) {
10581050
comp_update_buffer_consume(source, mod->input_buffers[i].consumed);
10591051

10601052
bzero((__sparse_force void *)mod->input_buffers[i].data, size);

src/audio/module_adapter/module_adapter_ipc3.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,24 +133,20 @@ void module_adapter_set_params(struct processing_module *mod, struct sof_ipc_str
133133

134134
static int module_source_state_count(struct comp_dev *dev, uint32_t state)
135135
{
136-
struct list_item *blist;
137136
int count = 0;
137+
struct comp_buffer *source;
138138

139139
/* count source with state == status */
140-
list_for_item(blist, &dev->bsource_list) {
140+
comp_dev_for_each_producer(dev, source)
141141
/*
142142
* FIXME: this is racy, state can be changed by another core.
143143
* This is implicitly protected by serialised IPCs. Even when
144144
* IPCs are processed in the pipeline thread, the next IPC will
145145
* not be sent until the thread has processed and replied to the
146146
* current one.
147147
*/
148-
struct comp_buffer *source = container_of(blist, struct comp_buffer,
149-
Xsink_list);
150-
151148
if (comp_buffer_get_source_state(source) == state)
152149
count++;
153-
}
154150

155151
return count;
156152
}

src/ipc/ipc-helper.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ int comp_verify_params(struct comp_dev *dev, uint32_t flag,
127127
comp_err(dev, "comp_verify_params(): !params");
128128
return -EINVAL;
129129
}
130-
130+
//tu jest magiA
131131
source_list = comp_buffer_list(dev, PPL_DIR_UPSTREAM);
132132
sink_list = comp_buffer_list(dev, PPL_DIR_DOWNSTREAM);
133133

@@ -138,11 +138,11 @@ int comp_verify_params(struct comp_dev *dev, uint32_t flag,
138138
if (list_is_empty(sink_list))
139139
buf = list_first_item(source_list,
140140
struct comp_buffer,
141-
Xsink_list);
141+
Xsink_list); //tu jest magiA
142142
else
143143
buf = list_first_item(sink_list,
144144
struct comp_buffer,
145-
Xsource_list);
145+
Xsource_list); //tu jest magiA
146146

147147
/* update specific pcm parameter with buffer parameter if
148148
* specific flag is set.
@@ -307,9 +307,9 @@ int ipc_comp_free(struct ipc *ipc, uint32_t comp_id)
307307
while(buffer) {
308308
struct comp_buffer *next_buffer = comp_dev_get_next_data_producer(icd->cd, buffer);
309309

310-
buffer->sinkX = NULL; //api
310+
comp_buffer_set_sink_component(buffer, NULL);
311311
/* This breaks the list, but we anyway delete all buffers */
312-
list_init(&buffer->Xsink_list);
312+
list_init(&buffer->Xsink_list); //TU tez magia
313313

314314
buffer = next_buffer;
315315
}
@@ -318,9 +318,9 @@ int ipc_comp_free(struct ipc *ipc, uint32_t comp_id)
318318
while(buffer) {
319319
struct comp_buffer *next_buffer = comp_dev_get_next_data_consumer(icd->cd, buffer);
320320

321-
buffer->sourceX = NULL; //api
321+
comp_buffer_set_source_component(buffer, NULL);
322322
/* This breaks the list, but we anyway delete all buffers */
323-
list_init(&buffer->Xsource_list);
323+
list_init(&buffer->Xsource_list); //TU tez magia
324324

325325
buffer = next_buffer;
326326
}

src/ipc/ipc3/handler.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,18 +167,15 @@ static bool is_hostless_downstream(struct comp_dev *current)
167167
static bool is_hostless_upstream(struct comp_dev *current)
168168
{
169169
struct list_item *clist;
170+
struct comp_buffer *buffer;
170171

171172
/* check if current is a HOST comp */
172173
if (current->ipc_config.type == SOF_COMP_HOST ||
173174
current->ipc_config.type == SOF_COMP_SG_HOST)
174175
return false;
175176

176177
/* check if the pipeline has a HOST comp upstream */
177-
list_for_item(clist, &current->bsource_list) { //msz
178-
struct comp_buffer *buffer;
179-
180-
buffer = container_of(clist, struct comp_buffer, Xsink_list);
181-
178+
comp_dev_for_each_producer(current, buffer) {
182179
/* don't go upstream if this component is not connected */
183180
if (!comp_buffer_get_source_component(buffer))
184181
continue;

0 commit comments

Comments
 (0)