Skip to content

Commit

Permalink
Tools: Testbench: Add IPC4 support
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
singalsu committed Sep 18, 2024
1 parent 10bf923 commit e84305a
Show file tree
Hide file tree
Showing 11 changed files with 2,127 additions and 40 deletions.
1 change: 1 addition & 0 deletions src/arch/host/configs/library_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ CONFIG_COMP_VOLUME_LINEAR_RAMP=y
CONFIG_COMP_VOLUME_WINDOWS_FADE=y
CONFIG_DEBUG_MEMORY_USAGE_SCAN=n
CONFIG_IPC_MAJOR_3=y
CONFIG_IPC_MAJOR_4=n
CONFIG_LIBRARY=y
CONFIG_LIBRARY_STATIC=y
CONFIG_MATH_IIR_DF2T=y
Expand Down
4 changes: 3 additions & 1 deletion tools/testbench/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ set(default_asoc_h "/usr/include/alsa/sound/uapi/asoc.h")

add_executable(testbench
testbench.c
file.c
common_test.c
common_test_ipc3.c
file.c
common_test_ipc4.c
topology_ipc3.c
topology_ipc4.c
)

sof_append_relative_path_definitions(testbench)
Expand Down
13 changes: 7 additions & 6 deletions tools/testbench/common_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ int tb_find_file_components(struct testbench_prm *tp)
fprintf(stderr, "error: null module.\n");
return -EINVAL;
}
fcd = module_get_private_data(mod);
fcd = get_file_comp_data(module_get_private_data(mod));
tp->fr[i].state = &fcd->fs;
}

Expand All @@ -98,7 +98,7 @@ int tb_find_file_components(struct testbench_prm *tp)
return -EINVAL;
}

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

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

if (tp->fr[i].state->reached_eof)
if (tp->fr[i].state->reached_eof || tp->fr[i].state->copy_timeout)
return true;
}

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

if (tp->fw[i].state->reached_eof || tp->fw[i].state->write_failed)
if (tp->fw[i].state->reached_eof || tp->fw[i].state->copy_timeout ||
tp->fw[i].state->write_failed)
return true;
}

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

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

dev = icd->cd;
mod = comp_mod(dev);
fcd = module_get_private_data(mod);
fcd = get_file_comp_data(module_get_private_data(mod));
printf("file %s: id %d: type %d: samples %d copies %d\n",
fcd->fs.fn, dev->ipc_config.id, dev->drv->type, fcd->fs.n,
fcd->fs.copy_count);
Expand Down
Loading

0 comments on commit e84305a

Please sign in to comment.