Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP][Do no review] Tools: Testbech: Add IPC4 support #9025

Closed
wants to merge 10 commits into from

Conversation

singalsu
Copy link
Collaborator

@singalsu singalsu commented Apr 10, 2024

First somewhat cleaned up version that runs, but needs still more work. Usage e.g.

cd sof/tools/test/audio
../../testbench/build_testbench/install/bin/testbench -r 48000 -R 48000 -c 2 -n 2 -b S32_LE \
-t ../../build_tools/topology/topology2/development/sof-hda-benchmark-dcblock32.tplg \
-p 1,2 -i i1.raw,i1.raw,i2.raw,i3.raw,i4.raw -o o1.raw,o2.raw,o3.raw,o4.raw,o5.raw 

To-do:

  • Bytes control is not passed
  • Only one processing component is possible, now hard-coded to dcblock, need kind of rimage uuid to index to uuid and fw uuid based component initialize mechanism
  • Need still to solve IPC3 testbench build
  • Simplify command line interface to run a simple playback test, no "-p 1,2 -i i1.raw,i1.raw,i2.raw,i3.raw,i4.raw -o o1.raw,o2.raw,o3.raw,o4.raw,o5.raw" but just "-i in.raw -o out.raw".
  • Fix memory leaks (valgrind)
  • Fix code branch based on uninitialized (valgrind)
  • Trace on/off (broken in main too)

This commit will be deleted when the Testbench IPC4 work
is non-draft.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This fixes build issues

In file included from tools/testbench/common_test.c:5:
src/platform/library/include/platform/lib/ll_schedule.h:22:51:
error: ‘enum task_state’ declared inside parameter list will not
be visible outside of this definition or declaration [-Werror]

In file included from tools/testbench/common_test.c:16:
tools/testbench/build_testbench/sof_ep/install/include/sof/
schedule/ll_schedule.h:40:5:
error: conflicting types for ‘schedule_task_init_ll’

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This fixes testbench build.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This prevents the IPC4_FAILURE since there is no parallel
execution in scheduler and pipelines with this IPC request
and respond step.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The file module does not provide a dai_get_init_delay_ms()
operation so it is skipped for CONFIG_LIBRARY testbench build.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The crossover_init_output_pins() function is changed to static.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This is done as preparation for testbench IPC4 support. The
update to IPC4 is simpler for a module adapter component.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch copies many similar changes as has been done for
SOF plugin since split and developed further from testbench. The
changes include:

    - Move tplg_ctx to under testbench_prm struct for better
      compatibility with plugin and topology parser.
    - Similarly as plugin ad to testbench_prm widget list, route list,
      pcm list and pipeline list.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Header dai-legacy.h modify to make other functions in SOF happy
is a bit suspicious.

Other changes are "normal" maintenance.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
@lgirdwood lgirdwood added this to the v2.11 milestone Sep 2, 2024
Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, looks like most of the small fix patches are merge ready (you may want to put them in another PR), whilst some rebase/squash is needed on others.
@ranj063 pls review

@@ -18,7 +18,7 @@ if (supports_implicit_fallthrough)
endif()

# C & ASM flags
target_compile_options(sof_options INTERFACE -g -O3 -fPIC -DPIC -std=c99 -std=gnu99 -fgnu89-inline
target_compile_options(sof_options INTERFACE -g -fPIC -DPIC -std=c99 -std=gnu99 -fgnu89-inline
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

long term we can inherit the optimization level from Kconfig

@@ -534,6 +534,9 @@ static void ipc_compound_msg_done(uint32_t msg_id, int error)

static int ipc_wait_for_compound_msg(void)
{
#if CONFIG_LIBRARY
atomic_set(&msg_data.delayed_reply, 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, where do we clear this in DSP mode ? i.e. does this need to be executed on all targets ?

@@ -486,6 +486,7 @@ static int pipeline_comp_trigger(struct comp_dev *current,
* Initialization delay is only used with SSP, where we
* don't use more than one DAI per copier
*/
#if !CONFIG_LIBRARY
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we provide this API in the file module instead, even if it returns 0 today.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I started to separate file component module adapter changes into a separate PR. It was quite simple to get dai_get_init_delay_ms() to pass without duplicating much of DAI data structures.

Comment on lines 387 to 398
file_uuid = (struct sof_uuid *)((uint8_t *)fileread + sizeof(struct sof_ipc_comp_file));
file_uuid->a = 0xbfc7488c;
file_uuid->b = 0x75aa;
file_uuid->c = 0x4ce8;
file_uuid->d[0] = 0x9d;
file_uuid->d[1] = 0xbe;
file_uuid->d[2] = 0xd8;
file_uuid->d[3] = 0xda;
file_uuid->d[4] = 0x08;
file_uuid->d[5] = 0xa6;
file_uuid->d[6] = 0x98;
file_uuid->d[7] = 0xc2;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a macro that will pack this for you now. @kv2019i @lyakh ?

@singalsu
Copy link
Collaborator Author

singalsu commented Sep 3, 2024

Ok, looks like most of the small fix patches are merge ready (you may want to put them in another PR), whilst some rebase/squash is needed on others. @ranj063 pls review

I will next try to separate this IPC4 related work from existing IPC3 testbench that would remain mostly unchanged except file component that changes to module adapter. So, there would be two executables: testbench and testbench-ipc4. When I started this I was thinking IPC4/3 choice would be run-time but such is not possible due to other SOF parts.

@lgirdwood
Copy link
Member

@singalsu see also this for Cmake fixes for testbench
#8892

@singalsu
Copy link
Collaborator Author

@singalsu see also this for Cmake fixes for testbench #8892

Thanks I didn't know -- I wonder if it could help to build with some scripts/rebuild-testbech.sh a desired IPC version. Or somehow build both to different executable paths. There's now new testbench PR version in: #9483. I will close this one later.

@singalsu singalsu closed this Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants