Skip to content

Commit b76d285

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 9784f95 commit b76d285

11 files changed

Lines changed: 2128 additions & 41 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: 4 additions & 2 deletions
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)
@@ -42,7 +44,7 @@ if (supports_implicit_fallthrough)
4244
set(implicit_fallthrough -Wimplicit-fallthrough)
4345
endif()
4446

45-
target_compile_options(testbench PRIVATE -g -O3 -Wall -Werror -Wmissing-prototypes
47+
target_compile_options(testbench PRIVATE -g -Wall -Werror -Wmissing-prototypes
4648
${implicit_fallthrough} -DCONFIG_LIBRARY -DCONFIG_LIBRARY_STATIC -imacros${config_h})
4749

4850
target_link_libraries(testbench PRIVATE -lm)

tools/testbench/common_test.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ int tb_find_file_components(struct testbench_prm *tp)
7171
fprintf(stderr, "error: null module.\n");
7272
return -EINVAL;
7373
}
74-
fcd = module_get_private_data(mod);
74+
fcd = get_file_comp_data(module_get_private_data(mod));
7575
tp->fr[i].state = &fcd->fs;
7676
}
7777

@@ -98,7 +98,7 @@ int tb_find_file_components(struct testbench_prm *tp)
9898
return -EINVAL;
9999
}
100100

101-
fcd = module_get_private_data(mod);
101+
fcd = get_file_comp_data(module_get_private_data(mod));
102102
tp->fw[i].state = &fcd->fs;
103103
}
104104

@@ -113,15 +113,16 @@ static bool tb_is_file_component_at_eof(struct testbench_prm *tp)
113113
if (!tp->fr[i].state)
114114
continue;
115115

116-
if (tp->fr[i].state->reached_eof)
116+
if (tp->fr[i].state->reached_eof || tp->fr[i].state->copy_timeout)
117117
return true;
118118
}
119119

120120
for (i = 0; i < tp->output_file_num; i++) {
121121
if (!tp->fw[i].state)
122122
continue;
123123

124-
if (tp->fw[i].state->reached_eof || tp->fw[i].state->write_failed)
124+
if (tp->fw[i].state->reached_eof || tp->fw[i].state->copy_timeout ||
125+
tp->fw[i].state->write_failed)
125126
return true;
126127
}
127128

@@ -146,7 +147,7 @@ void tb_show_file_stats(struct testbench_prm *tp, int pipeline_id)
146147

147148
dev = icd->cd;
148149
mod = comp_mod(dev);
149-
fcd = module_get_private_data(mod);
150+
fcd = get_file_comp_data(module_get_private_data(mod));
150151
printf("file %s: id %d: type %d: samples %d copies %d\n",
151152
fcd->fs.fn, dev->ipc_config.id, dev->drv->type, fcd->fs.n,
152153
fcd->fs.copy_count);
@@ -162,7 +163,7 @@ void tb_show_file_stats(struct testbench_prm *tp, int pipeline_id)
162163

163164
dev = icd->cd;
164165
mod = comp_mod(dev);
165-
fcd = module_get_private_data(mod);
166+
fcd = get_file_comp_data(module_get_private_data(mod));
166167
printf("file %s: id %d: type %d: samples %d copies %d\n",
167168
fcd->fs.fn, dev->ipc_config.id, dev->drv->type, fcd->fs.n,
168169
fcd->fs.copy_count);

0 commit comments

Comments
 (0)