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

Tools: Testbench: Add to IPC4 version UUID based components load, apply initial byte control, etc. #9542

Merged

Conversation

singalsu
Copy link
Collaborator

@singalsu singalsu commented Oct 3, 2024

To build and run IPC4 topologies, this needs PRs #9551 (already merged #9536, #9538). #9501 is needed if the topology is not containing blobs for byte controls (usually they do).

@@ -52,6 +55,27 @@ struct tb_config {
int channels;
unsigned long format;
};

struct tb_ctl {
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 include the ABI header rather than duplicate ? I guess this comes from ALSA asoc.h ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure, this struct is a direct copy from SOF plugin. If we change, we should change both to be able to merge the sources later to a common library like tplg_parser. What do you think @ranj063 ?

Copy link
Member

Choose a reason for hiding this comment

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

ok, so we can do this in parallel with plugin when we ship it.


/* src component private data */
struct ipc4_config_src {
struct ipc4_base_module_cfg base;
Copy link
Member

Choose a reason for hiding this comment

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

Should we have size at the start ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is not the struct for config blobs. I only moved this structure to be separate from large src_common.h that caused a build problem.

Copy link
Member

Choose a reason for hiding this comment

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

ok, but this is an IPC header, so this should be for host/module configuration.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's not clear to me what you are suggesting to do. Should these IPC headers be somewhere else or use some more consistent directory locations and naming?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@lgirdwood Ping, can you help me fix this. I don't think this PR has any other opens left.

Copy link
Member

Choose a reason for hiding this comment

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

ok, we can address this later as I see this structure is used as header for module data in other modules.


/* src component private data */
struct ipc4_config_src {
struct ipc4_base_module_cfg base;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is not the struct for config blobs. I only moved this structure to be separate from large src_common.h that caused a build problem.

@@ -52,6 +55,27 @@ struct tb_config {
int channels;
unsigned long format;
};

struct tb_ctl {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure, this struct is a direct copy from SOF plugin. If we change, we should change both to be able to merge the sources later to a common library like tplg_parser. What do you think @ranj063 ?

VOLUME_FWL);

return linear_gain;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ranj063 These volume tables math functions would be a good start for a common utils library. Maybe there could be a place in tplg_parser?

@singalsu singalsu force-pushed the testbench_ipc4_uuid_bytecontrol branch from afdf2fa to 7cd25e1 Compare October 8, 2024 08:21
@singalsu
Copy link
Collaborator Author

singalsu commented Oct 8, 2024

I added to controls parsing commit capability to split a long bytes control blob to several IPC messages if it is large. It's useful for FIR and TDFB blobs.

@singalsu singalsu force-pushed the testbench_ipc4_uuid_bytecontrol branch from 7cd25e1 to 40280c9 Compare October 9, 2024 16:51
* sof_ipc4_prepare_process_module().
*/
memcpy(&pin_format->audio_fmt, &base_cfg->audio_fmt,
sizeof(pin_format->audio_fmt));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note: After talking with @ranj063 I now understand resolving this properly need another prepare() pipelines walk step that does not yet exist in testbench and plugin. I'm proposing to keep this as-is for now and wait for development in plugin where things are more constrained by multiple processes. This workaround works for most components where first pin format for input and output is the same.

@singalsu
Copy link
Collaborator Author

SOFCI TEST

@@ -68,6 +68,13 @@ static const struct sof_topology_token ipc4_out_audio_format_tokens[] = {
offsetof(struct sof_ipc4_pin_format, buffer_size)},
};

static const struct sof_topology_token ipc4_comp_pin_tokens[] = {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ranj063 Should I keep this patch here or make a separate PR if you need it? It might take long to get this testbench PR approved.

Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

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

A handful of style/readability improvements (see inline), but really nothing to stop merging.

@@ -643,18 +646,19 @@ int tb_new_dai_in_out(struct testbench_prm *tp, int dir)
struct tplg_context *ctx = &tp->tplg;
struct tplg_comp_info *comp_info = ctx->current_comp_info;
struct ipc4_file_module_cfg *file;
struct sof_uuid file_uuid = {.a = 0xbfc7488c, .b = 0x75aa, .c = 0x4ce8,
.d = { 0x9d, 0xbe, 0xd8, 0xda, 0x08, 0xa6, 0x98, 0xc2 }};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Given this doesn't look super nice and is repeated many times in testbench code, would be nice to at least define this in one place.

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, moved to file.h.

int i, j;
int pin_format_offset = 0;

if (pin_type == 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I find these make it harder to read, can you add a enum for 0/1?

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, done!

base_cfg_ext->nb_input_pins = pins->num_input_pins;
base_cfg_ext->nb_output_pins = pins->num_output_pins;
tb_set_pin_formats(comp_info, base_cfg, base_cfg_ext, 0);
tb_set_pin_formats(comp_info, base_cfg, base_cfg_ext, 1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here readable enum/defines for 0/1 would help to understand what this code does easier.

@singalsu singalsu force-pushed the testbench_ipc4_uuid_bytecontrol branch from 40280c9 to aa9bc6c Compare October 10, 2024 16:33
This patch copies similar change from SOF plugin. The load
of host copier, DAI copier, PGA, and process components are
updated to use UUID that is appended to end of IPC4 base module
configuration and other component specific init IPC.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This adds parse of controls and set of byte control to components
after initialize. Control types mixer, switch, enum are parsed
but not yet applied to components.

The code is copied and adapted from SOF plugin. As addition the
bytes control is split to several messages if the IPC message
size limit is reached.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
If kept in src_common.h the inclusion to tplg_parser would
create need to include even more headers from SOF. The simple
src_ipc.h contains the only needed SRC IPC4 definition.

The __SOF_AUDIO_SRC_SRC_H__ is updated to match header name
and the ending #endif is moved file end where it should be.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This replaces for IPC4 testbench the previous non-working version
that was a copy of IPC3 version.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This replaces for IPC4 testbench the previous non-working version
that was a copy of IPC3 version.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The examples need to convert the testbench out.raw to wav
format, not the converted input for testbench.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch adds to the parser the capability to parse the tokens
and place the found values to pins_info member in tplg_comp_info
struct.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The input and output pins count and format for each pin is
added into the "struct ipc4_base_module_cfg_ext" that is placed
after "struct ipc4_base_module_cfg" and before test bench and
plugin specific UUID.

This allows to load components those use the extended
configuration. Since there is no harm to apply it to every
process type component it done simply for all.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
@singalsu singalsu force-pushed the testbench_ipc4_uuid_bytecontrol branch from aa9bc6c to cb5946e Compare October 15, 2024 11:01
@singalsu
Copy link
Collaborator Author

I updated commit "Tools: Testbench: Add support for parsing controls from topology " to fix xt-testbench build by moving all struct definitions in tb_kcontrol_cb_new() to begin of function.

@@ -52,6 +55,27 @@ struct tb_config {
int channels;
unsigned long format;
};

struct tb_ctl {
Copy link
Member

Choose a reason for hiding this comment

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

ok, so we can do this in parallel with plugin when we ship it.


/* src component private data */
struct ipc4_config_src {
struct ipc4_base_module_cfg base;
Copy link
Member

Choose a reason for hiding this comment

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

ok, we can address this later as I see this structure is used as header for module data in other modules.

@lgirdwood
Copy link
Member

@wszypelt @lrudyX good to merge ? Not expecting this is tested yet by Internal CI ?

@wszypelt
Copy link

@lgirdwood good to merge

@lgirdwood lgirdwood merged commit 89c0d2b into thesofproject:main Oct 15, 2024
42 of 47 checks passed
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.

4 participants