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 1 commit
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
3 changes: 2 additions & 1 deletion app/configs/lnl/modules.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
CONFIG_SAMPLE_SMART_AMP=m
CONFIG_COMP_MIXIN_MIXOUT=m
CONFIG_COMP_IIR=m
CONFIG_SAMPLE_SMART_AMP=m
CONFIG_COMP_DRC=m
CONFIG_COMP_SRC=m
1 change: 1 addition & 0 deletions app/configs/mtl/modules.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ CONFIG_SAMPLE_SMART_AMP=m
CONFIG_COMP_MIXIN_MIXOUT=m
CONFIG_COMP_IIR=m
CONFIG_COMP_DRC=m
CONFIG_COMP_SRC=m
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
31 changes: 19 additions & 12 deletions zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -746,19 +746,26 @@ zephyr_library_sources_ifdef(CONFIG_COMP_CHAIN_DMA
${SOF_AUDIO_PATH}/chain_dma.c
)

zephyr_library_sources_ifdef(CONFIG_COMP_SRC
${SOF_AUDIO_PATH}/src/src_hifi2ep.c
${SOF_AUDIO_PATH}/src/src_generic.c
${SOF_AUDIO_PATH}/src/src_hifi3.c
${SOF_AUDIO_PATH}/src/src_hifi4.c
${SOF_AUDIO_PATH}/src/src_common.c
${SOF_AUDIO_PATH}/src/src.c
${SOF_AUDIO_PATH}/src/src_${ipc_suffix}.c
)
if(CONFIG_COMP_SRC STREQUAL "m")
add_subdirectory(${SOF_AUDIO_PATH}/src/llext
${PROJECT_BINARY_DIR}/src_llext)
add_dependencies(app src)
elseif(CONFIG_COMP_SRC)
zephyr_library_sources_ifdef(CONFIG_COMP_SRC
${SOF_AUDIO_PATH}/src/src_hifi2ep.c
${SOF_AUDIO_PATH}/src/src_generic.c
${SOF_AUDIO_PATH}/src/src_hifi3.c
${SOF_AUDIO_PATH}/src/src_hifi4.c
${SOF_AUDIO_PATH}/src/src_common.c
${SOF_AUDIO_PATH}/src/src.c
${SOF_AUDIO_PATH}/src/src_${ipc_suffix}.c
)

zephyr_library_sources_ifdef(CONFIG_COMP_SRC_LITE
${SOF_AUDIO_PATH}/src/src_lite.c
)
endif()

zephyr_library_sources_ifdef(CONFIG_COMP_SRC_LITE
${SOF_AUDIO_PATH}/src/src_lite.c
)
zephyr_library_sources_ifdef(CONFIG_COMP_BASEFW_IPC4
${SOF_AUDIO_PATH}/base_fw.c
)
Expand Down