Skip to content

Commit 41bee84

Browse files
committed
Tools: Testbench: Add IPC4 support
This patch adds topology parsing and common functions versions for IPC4. Due to dai_get_init_delay_ms() implementation in IPC4 build the file component is changed internally to copier to provide the DAI data struct. The change is common for both IPC3 and IPC4 though copier is not usually used with IPC3 systems. Since it works the same solution is used. The file state retrieve is changed because the file component data is placed deeper into the structures. Due to IPC4 scheduling of pipelines the file component is added a timeout. A file component sets timeout status if there has been three copy operations with no data to process. The timeout and EOF are used to end cleanly the test run. The library_defconfig still has CONFIG_IPC_MAJOR_4=n. The add of build type select to scripts/rebuild-testbench.sh is further work. Also the IPC4 testbench in this state is not well usable with only one component supported as process component and without byte control set up algorithms. Test run with DC blocker is possible this way: tools/testbench/build_testbench/install/bin/testbench -r 48000 -R 48000 -c 2 -n 2 -b S32_LE -p 1,2 -t tools/build_tools/topology/topology2/development/ sof-hda-benchmark-dcblock32.tplg -i in.raw -o out.raw Also sof-hda-benchmark-gain32.tplg can be run. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent 13e8226 commit 41bee84

11 files changed

Lines changed: 2109 additions & 39 deletions

File tree

src/arch/host/configs/library_defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ CONFIG_COMP_VOLUME_LINEAR_RAMP=y
2222
CONFIG_COMP_VOLUME_WINDOWS_FADE=y
2323
CONFIG_DEBUG_MEMORY_USAGE_SCAN=n
2424
CONFIG_IPC_MAJOR_3=y
25+
CONFIG_IPC_MAJOR_4=n
2526
CONFIG_LIBRARY=y
2627
CONFIG_LIBRARY_STATIC=y
2728
CONFIG_MATH_IIR_DF2T=y

tools/testbench/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ set(default_asoc_h "/usr/include/alsa/sound/uapi/asoc.h")
1111

1212
add_executable(testbench
1313
testbench.c
14+
file.c
1415
common_test.c
1516
common_test_ipc3.c
16-
file.c
17+
common_test_ipc4.c
1718
topology_ipc3.c
19+
topology_ipc4.c
1820
)
1921

2022
sof_append_relative_path_definitions(testbench)

tools/testbench/common_test.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ static int tb_find_file_helper(struct testbench_prm *tp, struct file_comp_lookup
7272
fprintf(stderr, "error: null module.\n");
7373
return -EINVAL;
7474
}
75-
fcd = module_get_private_data(mod);
75+
fcd = get_file_comp_data(module_get_private_data(mod));
7676
fcl[i].state = &fcd->fs;
7777
}
7878

@@ -101,15 +101,16 @@ static bool tb_is_file_component_at_eof(struct testbench_prm *tp)
101101
if (!tp->fr[i].state)
102102
continue;
103103

104-
if (tp->fr[i].state->reached_eof)
104+
if (tp->fr[i].state->reached_eof || tp->fr[i].state->copy_timeout)
105105
return true;
106106
}
107107

108108
for (i = 0; i < tp->output_file_num; i++) {
109109
if (!tp->fw[i].state)
110110
continue;
111111

112-
if (tp->fw[i].state->reached_eof || tp->fw[i].state->write_failed)
112+
if (tp->fw[i].state->reached_eof || tp->fw[i].state->copy_timeout ||
113+
tp->fw[i].state->write_failed)
113114
return true;
114115
}
115116

@@ -134,7 +135,7 @@ void tb_show_file_stats(struct testbench_prm *tp, int pipeline_id)
134135

135136
dev = icd->cd;
136137
mod = comp_mod(dev);
137-
fcd = module_get_private_data(mod);
138+
fcd = get_file_comp_data(module_get_private_data(mod));
138139
printf("file %s: id %d: type %d: samples %d copies %d\n",
139140
fcd->fs.fn, dev->ipc_config.id, dev->drv->type, fcd->fs.n,
140141
fcd->fs.copy_count);
@@ -150,7 +151,7 @@ void tb_show_file_stats(struct testbench_prm *tp, int pipeline_id)
150151

151152
dev = icd->cd;
152153
mod = comp_mod(dev);
153-
fcd = module_get_private_data(mod);
154+
fcd = get_file_comp_data(module_get_private_data(mod));
154155
printf("file %s: id %d: type %d: samples %d copies %d\n",
155156
fcd->fs.fn, dev->ipc_config.id, dev->drv->type, fcd->fs.n,
156157
fcd->fs.copy_count);

0 commit comments

Comments
 (0)