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

LLEXT: make src, asrc, volume, eq_fir and tdfb modular #9430

Merged
merged 7 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/boards/intel_adsp_ace15_mtpm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ CONFIG_METEORLAKE=y
CONFIG_IPC_MAJOR_4=y
CONFIG_IPC4_BASE_FW_INTEL=y

CONFIG_COMP_SRC=y
CONFIG_COMP_SRC_IPC4_FULL_MATRIX=y
CONFIG_COMP_SRC_LITE=y
CONFIG_COMP_DRC=m
Expand Down
1 change: 0 additions & 1 deletion app/boards/intel_adsp_ace20_lnl.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ CONFIG_LUNARLAKE=y
CONFIG_IPC_MAJOR_4=y
CONFIG_IPC4_BASE_FW_INTEL=y

CONFIG_COMP_SRC=y
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why remove this? Seems like a no-op now (given current default), but seems out of place in this commit.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@kv2019i yeah, well, it's all SRC... But if you don't want it there, can drop. It just makes it better prepared for an eventual default-M transition

CONFIG_COMP_SRC_IPC4_FULL_MATRIX=y
CONFIG_COMP_DRC=m

Expand Down
6 changes: 5 additions & 1 deletion app/configs/lnl/modules.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
CONFIG_SAMPLE_SMART_AMP=m
CONFIG_COMP_MIXIN_MIXOUT=m
CONFIG_COMP_FIR=m
CONFIG_COMP_IIR=m
CONFIG_SAMPLE_SMART_AMP=m
CONFIG_COMP_DRC=m
CONFIG_COMP_SRC=m
CONFIG_COMP_ASRC=m
CONFIG_COMP_VOLUME=m
4 changes: 4 additions & 0 deletions app/configs/mtl/modules.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
CONFIG_SAMPLE_SMART_AMP=m
CONFIG_COMP_MIXIN_MIXOUT=m
CONFIG_COMP_FIR=m
CONFIG_COMP_IIR=m
CONFIG_COMP_DRC=m
CONFIG_COMP_SRC=m
CONFIG_COMP_ASRC=m
CONFIG_COMP_VOLUME=m
5 changes: 3 additions & 2 deletions src/audio/asrc/Kconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# SPDX-License-Identifier: BSD-3-Clause

config COMP_ASRC
bool "ASRC component"
tristate "ASRC component"
default m if LIBRARY_DEFAULT_MODULAR
default y
help
Select for Asynchronous sample rate conversion (ASRC)
Expand All @@ -14,7 +15,7 @@ config COMP_ASRC
not have pre-computed filter coefficients for every
conversion fraction that SRC does.

if COMP_ASRC
if COMP_ASRC != n

rsource "Kconfig.simd"

Expand Down
23 changes: 20 additions & 3 deletions src/audio/asrc/asrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ static int asrc_free(struct processing_module *mod)
struct comp_data *cd = module_get_private_data(mod);
struct comp_dev *dev = mod->dev;

comp_info(dev, "asrc_free()");
comp_dbg(dev, "asrc_free()");

rfree(cd->buf);
asrc_release_buffers(cd->asrc_obj);
Expand Down Expand Up @@ -850,8 +850,7 @@ static int asrc_reset(struct processing_module *mod)
struct comp_dev *dev = mod->dev;
struct comp_data *cd = module_get_private_data(mod);

comp_info(dev, "asrc_reset(), skew_min=%d, skew_max=%d", cd->skew_min, cd->skew_max);

comp_dbg(dev, "asrc_reset(), skew_min=%d, skew_max=%d", cd->skew_min, cd->skew_max);

/* If any resources feasible to stop */
if (cd->track_drift)
Expand Down Expand Up @@ -879,3 +878,21 @@ static const struct module_interface asrc_interface = {

DECLARE_MODULE_ADAPTER(asrc_interface, ASRC_UUID, asrc_tr);
SOF_MODULE_INIT(asrc, sys_comp_module_asrc_interface_init);

#if CONFIG_COMP_ASRC_MODULE
/* modular: llext dynamic link */

#include <module/module/api_ver.h>
#include <module/module/llext.h>
#include <rimage/sof/user/manifest.h>

#define UUID_ASRC 0x2d, 0x40, 0xb4, 0x66, 0x68, 0xb4, 0xf2, 0x42, \
0x81, 0xa7, 0xb3, 0x71, 0x21, 0x86, 0x3d, 0xd4
SOF_LLEXT_MOD_ENTRY(asrc, &asrc_interface);

static const struct sof_man_module_manifest mod_manifest[] __section(".module") __used = {
SOF_LLEXT_MODULE_MANIFEST("ASRC", asrc_llext_entry, 1, UUID_ASRC, 2),
};

SOF_LLEXT_BUILDINFO;
#endif
6 changes: 5 additions & 1 deletion src/audio/asrc/asrc.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#ifndef LOAD_TYPE
#define LOAD_TYPE "0"
#endif

[[module.entry]]
name = "ASRC"
uuid = "66B4402D-B468-42F2-81A7-B37121863DD4"
affinity_mask = "0x3"
instance_count = "2"
domain_types = "0"

load_type = "0"
load_type = LOAD_TYPE
module_type = "9"
auto_start = "0"
sched_caps = [1, 0x00008000]
Expand Down
10 changes: 10 additions & 0 deletions src/audio/asrc/llext/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright (c) 2024 Intel Corporation.
# SPDX-License-Identifier: Apache-2.0

sof_llext_build("asrc"
SOURCES ../asrc.c
../asrc_farrow_hifi3.c
../asrc_farrow.c
../asrc_farrow_generic.c
../asrc_ipc4.c
)
6 changes: 6 additions & 0 deletions src/audio/asrc/llext/llext.toml.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <tools/rimage/config/platform.toml>
#define LOAD_TYPE "2"
#include "../asrc.toml"

[module]
count = __COUNTER__
1 change: 1 addition & 0 deletions src/audio/data_blob.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ void comp_data_blob_set_validator(struct comp_data_blob_handler *blob_handler,

blob_handler->validator = validator;
}
EXPORT_SYMBOL(comp_data_blob_set_validator);

void *comp_get_data_blob(struct comp_data_blob_handler *blob_handler,
size_t *size, uint32_t *crc)
Expand Down
3 changes: 2 additions & 1 deletion src/audio/eq_fir/Kconfig
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# SPDX-License-Identifier: BSD-3-Clause

config COMP_FIR
bool "FIR component"
tristate "FIR component"
select MATH_FIR
select COMP_BLOB
depends on COMP_MODULE_ADAPTER
default m if LIBRARY_DEFAULT_MODULAR
default y
help
Select for FIR component. FIR performance can differ between DSP
Expand Down
23 changes: 21 additions & 2 deletions src/audio/eq_fir/eq_fir.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ static int eq_fir_free(struct processing_module *mod)
{
struct comp_data *cd = module_get_private_data(mod);

comp_info(mod->dev, "eq_fir_free()");
comp_dbg(mod->dev, "eq_fir_free()");

eq_fir_free_delaylines(cd);
comp_data_blob_handler_free(cd->model_handler);
Expand Down Expand Up @@ -456,7 +456,7 @@ static int eq_fir_reset(struct processing_module *mod)
int i;
struct comp_data *cd = module_get_private_data(mod);

comp_info(mod->dev, "eq_fir_reset()");
comp_dbg(mod->dev, "eq_fir_reset()");

comp_data_blob_set_validator(cd->model_handler, NULL);

Expand All @@ -481,3 +481,22 @@ static const struct module_interface eq_fir_interface = {

DECLARE_MODULE_ADAPTER(eq_fir_interface, eq_fir_uuid, eq_fir_tr);
SOF_MODULE_INIT(eq_fir, sys_comp_module_eq_fir_interface_init);

#if CONFIG_COMP_FIR_MODULE
/* modular: llext dynamic link */

#include <module/module/api_ver.h>
#include <module/module/llext.h>
#include <rimage/sof/user/manifest.h>

#define UUID_EQFIR 0xe7, 0x0c, 0xa9, 0x43, 0xa5, 0xf3, 0xdf, 0x41, \
0xac, 0x06, 0xba, 0x98, 0x65, 0x1a, 0xe6, 0xa3

SOF_LLEXT_MOD_ENTRY(eq_fir, &eq_fir_interface);

static const struct sof_man_module_manifest mod_manifest __section(".module") __used =
SOF_LLEXT_MODULE_MANIFEST("EQFIR", eq_fir_llext_entry, 1, UUID_EQFIR, 40);

SOF_LLEXT_BUILDINFO;

#endif
9 changes: 7 additions & 2 deletions src/audio/eq_fir/eq_fir.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#ifndef LOAD_TYPE
#define LOAD_TYPE "0"
#endif

REM # eq fir module config
[[module.entry]]
name = "EQFIR"
uuid = "43A90CE7-f3A5-41Df-AC06-BA98651AE6A3"
uuid = "43A90CE7-F3A5-41DF-AC06-BA98651AE6A3"
affinity_mask = "0x1"
instance_count = "40"
domain_types = "0"
load_type = "0"
load_type = LOAD_TYPE
module_type = "9"
auto_start = "0"
sched_caps = [1, 0x00008000]
Expand All @@ -15,6 +19,7 @@
1, 0, 0xfeef, 0xf, 0xf, 0x1ff]

REM # mod_cfg [PAR_0 PAR_1 PAR_2 PAR_3 IS_BYTES CPS IBS OBS MOD_FLAGS CPC OBLS]
REM # identical for MTL and LNL
mod_cfg = [0, 0, 0, 0, 4096, 1000000, 128, 128, 0, 0, 0]

index = __COUNTER__
10 changes: 10 additions & 0 deletions src/audio/eq_fir/llext/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright (c) 2024 Intel Corporation.
# SPDX-License-Identifier: Apache-2.0

sof_llext_build("eq_fir"
SOURCES ../eq_fir_hifi3.c
../eq_fir_hifi2ep.c
../eq_fir_generic.c
../eq_fir.c
../eq_fir_ipc4.c
)
6 changes: 6 additions & 0 deletions src/audio/eq_fir/llext/llext.toml.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <tools/rimage/config/platform.toml>
#define LOAD_TYPE "2"
#include "../eq_fir.toml"

[module]
count = __COUNTER__
1 change: 1 addition & 0 deletions src/audio/module_adapter/module/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ int module_set_configuration(struct processing_module *mod,

return ret;
}
EXPORT_SYMBOL(module_set_configuration);

int module_bind(struct processing_module *mod, void *data)
{
Expand Down
2 changes: 2 additions & 0 deletions src/audio/sink_source_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <sof/common.h>
#include <rtos/panic.h>
#include <rtos/string.h>
#include <rtos/symbol.h>
#include <sof/math/numbers.h>
#include <limits.h>

Expand Down Expand Up @@ -71,3 +72,4 @@ int source_to_sink_copy(struct sof_source *source,
sink_commit_buffer(sink, INT_MAX);
return 0;
}
EXPORT_SYMBOL(source_to_sink_copy);
3 changes: 3 additions & 0 deletions src/audio/source_api_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright(c) 2023 Intel Corporation. All rights reserved.
*/

#include <rtos/symbol.h>

#include <sof/audio/sink_api.h>
#include <sof/audio/source_api.h>
#include <sof/audio/audio_stream.h>
Expand Down Expand Up @@ -97,6 +99,7 @@ int source_set_alignment_constants(struct sof_source *source,
return source->ops->set_alignment_constants(source, byte_align, frame_align_req);
return 0;
}
EXPORT_SYMBOL(source_set_alignment_constants);

void source_set_min_available(struct sof_source *source, size_t min_available)
{
Expand Down
1 change: 1 addition & 0 deletions src/audio/src/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

config COMP_SRC
tristate "SRC component"
default m if LIBRARY_DEFAULT_MODULAR
default y
help
Select for SRC component
Expand Down
25 changes: 25 additions & 0 deletions src/audio/src/llext/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (c) 2024 Intel Corporation.
Copy link
Member

Choose a reason for hiding this comment

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

Btw, any reason why this is not mart of the src makefile ?

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 which one? If you mean https://github.com/thesofproject/sof/blob/main/src/audio/src/CMakeLists.txt then it isn't used in Zephyr builds, (most) audio sources are still built from https://github.com/thesofproject/sof/blob/main/zephyr/CMakeLists.txt Once we change that to use per-component cmake scripts, then yes, I think it should be possible to keep both monolithic and modular instructions in the same file. But I'd have to try to know for sure

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 need to circle back to this later when ready.

# SPDX-License-Identifier: Apache-2.0

if(CONFIG_COMP_SRC_LITE)
sof_llext_build("src"
SOURCES ../src_hifi2ep.c
../src_generic.c
../src_hifi3.c
../src_hifi4.c
../src.c
../src_common.c
../src_ipc4.c
../src_lite.c
)
else()
sof_llext_build("src"
SOURCES ../src_hifi2ep.c
../src_generic.c
../src_hifi3.c
../src_hifi4.c
../src.c
../src_common.c
../src_ipc4.c
)
endif()
6 changes: 6 additions & 0 deletions src/audio/src/llext/llext.toml.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <tools/rimage/config/platform.toml>
#define LOAD_TYPE "2"
#include "../src.toml"

[module]
count = __COUNTER__
28 changes: 28 additions & 0 deletions src/audio/src/src.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,31 @@ static const struct module_interface src_interface = {

DECLARE_MODULE_ADAPTER(src_interface, SRC_UUID, src_tr);
SOF_MODULE_INIT(src, sys_comp_module_src_interface_init);

#if CONFIG_COMP_SRC_MODULE
/* modular: llext dynamic link */

#include <module/module/api_ver.h>
#include <module/module/llext.h>
#include <rimage/sof/user/manifest.h>

#define UUID_SRC 0x8D, 0xB2, 0x1B, 0xE6, 0x9A, 0x14, 0x1F, 0x4C, \
0xB7, 0x09, 0x46, 0x82, 0x3E, 0xF5, 0xF5, 0xAE
SOF_LLEXT_MOD_ENTRY(src, &src_interface);

#if CONFIG_COMP_SRC_LITE
#define UUID_SRC_LITE 0x51, 0x10, 0x44, 0x33, 0xCD, 0x44, 0x6A, 0x46, \
0x83, 0xA3, 0x17, 0x84, 0x78, 0x70, 0x8A, 0xEA
extern const struct module_interface src_lite_interface;
SOF_LLEXT_MOD_ENTRY(src_lite, &src_lite_interface);
#endif

static const struct sof_man_module_manifest mod_manifest[] __section(".module") __used = {
SOF_LLEXT_MODULE_MANIFEST("SRC", src_llext_entry, 1, UUID_SRC, 1),
#if CONFIG_COMP_SRC_LITE
SOF_LLEXT_MODULE_MANIFEST("SRC_LITE", src_lite_llext_entry, 1, UUID_SRC_LITE, 1),
#endif
};

SOF_LLEXT_BUILDINFO;
#endif
8 changes: 6 additions & 2 deletions src/audio/src/src.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#ifndef LOAD_TYPE
#define LOAD_TYPE "0"
#endif

[[module.entry]]
name = "SRC"
uuid = "E61BB28D-149A-4C1F-B709-46823EF5F5AE"
affinity_mask = "0x1"
REM #instance_count = "10"
domain_types = "0"
load_type = "0"
load_type = LOAD_TYPE
module_type = "7"
auto_start = "0"
sched_caps = [1, 0x00008000]
Expand Down Expand Up @@ -77,7 +81,7 @@
affinity_mask = "0x1"
REM #instance_count = "10"
domain_types = "0"
load_type = "0"
load_type = LOAD_TYPE
module_type = "0x1F"
auto_start = "0"
sched_caps = [1, 0x00008000]
Expand Down
2 changes: 1 addition & 1 deletion src/audio/src/src_lite.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static int src_lite_prepare(struct processing_module *mod,
return src_prepare_general(mod, sources[0], sinks[0]);
}

static const struct module_interface src_lite_interface = {
const struct module_interface src_lite_interface = {
.init = src_init,
.prepare = src_lite_prepare,
.process = src_process,
Expand Down
Loading
Loading