Skip to content

module_adapter : audio : fix DTS support on MTL#8379

Merged
cujomalainey merged 7 commits intothesofproject:mainfrom
joechengxperi:main-dts-mtl-merge-2
Nov 14, 2023
Merged

module_adapter : audio : fix DTS support on MTL#8379
cujomalainey merged 7 commits intothesofproject:mainfrom
joechengxperi:main-dts-mtl-merge-2

Conversation

@joechengxperi
Copy link
Contributor

Add the commits to support DTS processing on MTL.

@@ -169,7 +169,8 @@ check_optimization(fma -mfma -ftree-vectorize -DOPS_FMA)
check_optimization(hifi2ep -mhifi2ep "" -DOPS_HIFI2EP)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please split this into multiple patches. One patch per logical change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've tried to split the patches. Please let me know if it's okay or not. Thanks.

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.

Thanks @joechengxperi ! Code looks good, but like @dbaluta noted, it would be good to split the series. This is bit of a special case as DTS is only enabled if the overlay is selected, but in principle fixes should come first and the code enable for IPC4 as the last commit.

@@ -0,0 +1,3 @@
CONFIG_COMP_IIR=y
Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed this may be followed from:
./src/arch/xtensa/configs/override/mt8195_chrome_dts.config:4:CONFIG_DTS_CODEC=y
./src/arch/xtensa/configs/override/renoir_chrome_dts.config:3:CONFIG_DTS_CODEC=y
./src/arch/xtensa/configs/override/mt8186_chrome_dts.config:3:CONFIG_DTS_CODEC=y

my question is: is IIR must follow with DTS codec? they should have no relation from module perspecitve.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We use EQ IIR + DTS to support customer project. For different platforms, EQ IIR might be default enabled or disabled. So we add it to make sure IIR is enabled. On MTL, IIR is default enabled. I could remove it if you think it's better.

Copy link
Member

Choose a reason for hiding this comment

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

So the Kconfig can set a dependecy, we could use depends in Kconfig to state this relationship between DTS and IIR.
@singalsu fyi.

@marc-hb
Copy link
Collaborator

marc-hb commented Oct 25, 2023

It would build fail without LOG_MODULE_REGISTER.

Co-developed-by: Mac Chiang <mac.chiang@intel.com>
Signed-off-by: Mac Chiang <mac.chiang@intel.com>
Signed-off-by: Joe Cheng <joe.cheng@xperi.com>
@joechengxperi
Copy link
Contributor Author

Thanks @joechengxperi ! Code looks good, but like @dbaluta noted, it would be good to split the series. This is bit of a special case as DTS is only enabled if the overlay is selected, but in principle fixes should come first and the code enable for IPC4 as the last commit.

@kv2019i I've tried to split the patches and adjusted the order of commits. Please let me know if it's okay. Thanks.

@joechengxperi
Copy link
Contributor Author

This is a good page

https://docs.zephyrproject.org/latest/contribute/contributor_expectations.html#defining-smaller-prs

This is super helpful. Thanks @marc-hb!

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.

Looks good, I think only some minor opens from me.

void sys_comp_module_tdfb_interface_init(void);
void sys_comp_module_volume_interface_init(void);

void sys_comp_module_dts_interface_init(void);
Copy link
Member

Choose a reason for hiding this comment

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

nitpick: this should be in line above, next to the others.

Copy link
Contributor

Choose a reason for hiding this comment

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

not in alphabetical order

@@ -0,0 +1,3 @@
CONFIG_COMP_IIR=y
Copy link
Member

Choose a reason for hiding this comment

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

So the Kconfig can set a dependecy, we could use depends in Kconfig to state this relationship between DTS and IIR.
@singalsu fyi.

Copy link
Contributor

@btian1 btian1 left a comment

Choose a reason for hiding this comment

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

one suggestion: I suggest create a new folder under src/audio with codec/dts, and move out dts related into this folder.
Reason: now, most of modules are module interface, modules does not need put it under:
src/audio/module_adapter/module directory, it should have a standalone folder to cover.

ideally, all modules will be under src/audio with integrated all its source code in future.

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.

Excellent, thanks @joechengxperi , looks very good. Only issue with the last patch and I know you are addressing to feedback, so @lgirdwood @btian1 I'd propose we drop the last patch... ok?

select COMP_BLOB
default y
depends on COMP_MODULE_ADAPTER
depends on COMP_MODULE_ADAPTER || DTS_CODEC
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is the wrong way. I'd be happy with your original solution and just have this in the overlay as this is not a strict dependency at code level, but a requirement at the topologoy level, so I think the overlay is a better place.

Copy link
Contributor

Choose a reason for hiding this comment

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

I also think this is not a good place, IIR can't depend on DTS, it is a standalone feature.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lgirdwood May I know your feedback?

Copy link
Contributor

Choose a reason for hiding this comment

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

@joechengxperi I agree, I am not sure why the config is defined this way, you should select the IIR component from the DTS component.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @cujomalainey. It looks better using select as you mentioned in this case. But after thinking about this a few days, I prefer to move it back to overlay rather than config. As @kv2019i said, it's not a strict dependency. Also, this dependency may probably change in the future, depends on customer requirement or platform. It seems using overlay and topology is more flexible.

Copy link
Contributor

Choose a reason for hiding this comment

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

They should not depend on each other.
Besides I don't think this meets your intention "make sure IIR is enabled on different platforms when DTS_CODEC is enabled", which is "if DTS=y; set IIR=y". If so, you should state "config DTS select IIR"

Copy link
Collaborator

Choose a reason for hiding this comment

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

Quoting another thread:

We use EQ IIR + DTS to support customer project.

Overlays is where you define that, not in Kconfig files (and overlays don't have to be in this git repo, they can come from anywhere).

The purpose of Kconfig is to make sure the code compiles and does not crash and nothing else (and managing these basic dependencies is difficult and error-prone enough already, random Kconfig problem of the day: #8425). Kconfig is only for "hard science" and universal dependencies that affect everyone using the code base, never for "preferences" and even less for "personal" preferences.

While Kconfig came from the Linux kernel, Zephyr has IMHO better Kconfig documentation:

https://docs.zephyrproject.org/latest/build/kconfig/index.html
https://www.kernel.org/doc/html/latest/kbuild/kconfig-language.html

They should be bug-for-bug compatible so both documentations should apply.

I see the current version does not seem to change Kconfig
https://github.com/thesofproject/sof/commits/1ef2f59db0a

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@marc-hb I removed that commit which added the wrong dependency and restored the original solution in overlay yesterday.

Copy link
Contributor

@btian1 btian1 left a comment

Choose a reason for hiding this comment

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

@kv2019i @joechengxperi , please check my another comments, I am suggesting move out dts to src/audio/codec/dts, please let me know what do you think about this?

select COMP_BLOB
default y
depends on COMP_MODULE_ADAPTER
depends on COMP_MODULE_ADAPTER || DTS_CODEC
Copy link
Contributor

Choose a reason for hiding this comment

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

I also think this is not a good place, IIR can't depend on DTS, it is a standalone feature.

@joechengxperi
Copy link
Contributor Author

one suggestion: I suggest create a new folder under src/audio with codec/dts, and move out dts related into this folder. Reason: now, most of modules are module interface, modules does not need put it under: src/audio/module_adapter/module directory, it should have a standalone folder to cover.

ideally, all modules will be under src/audio with integrated all its source code in future.

It sounds a reasonable move to me. If it will be the target to do, I'll work on it in another PR.

fragment_size, response, response_size);
if (ret < 0)
return ret;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this removed in a later commit again?

ret = module_set_configuration(mod, config_id, pos, data_offset_size, fragment,
fragment_size, response, response_size);
if (ret < 0)
if (ret < 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

yes, both braces must be in the same commit to avoid breaking bisection

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Put them in the same commit now.

md->state is set in IPC3, not in IPC4.

set_configuration() would fail on MTL because md->state is not set.

Add macro CONFIG_IPC_MAJOR_3 to avoid this problem.

Co-developed-by: Mac Chiang <mac.chiang@intel.com>
Signed-off-by: Mac Chiang <mac.chiang@intel.com>
Signed-off-by: Joe Cheng <joe.cheng@xperi.com>
Add more error logs to identify potential problem in set_configuration()

Co-developed-by: Mac Chiang <mac.chiang@intel.com>
Signed-off-by: Mac Chiang <mac.chiang@intel.com>
Signed-off-by: Joe Cheng <joe.cheng@xperi.com>
MTL support is added in DTS V1.1.3.

Signed-off-by: Joe Cheng <joe.cheng@xperi.com>
void sys_comp_module_tdfb_interface_init(void);
void sys_comp_module_volume_interface_init(void);

void sys_comp_module_dts_interface_init(void);
Copy link
Contributor

Choose a reason for hiding this comment

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

not in alphabetical order

select COMP_BLOB
default y
depends on COMP_MODULE_ADAPTER
depends on COMP_MODULE_ADAPTER || DTS_CODEC
Copy link
Contributor

Choose a reason for hiding this comment

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

@joechengxperi I agree, I am not sure why the config is defined this way, you should select the IIR component from the DTS component.

select COMP_BLOB
default y
depends on COMP_MODULE_ADAPTER
depends on COMP_MODULE_ADAPTER || DTS_CODEC
Copy link
Contributor

Choose a reason for hiding this comment

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

They should not depend on each other.
Besides I don't think this meets your intention "make sure IIR is enabled on different platforms when DTS_CODEC is enabled", which is "if DTS=y; set IIR=y". If so, you should state "config DTS select IIR"


set(sof_audio_modules mixer volume src asrc eq-fir eq-iir dcblock crossover tdfb drc multiband_drc mfcc mux)
set(sof_audio_modules mixer volume src asrc eq-fir eq-iir dcblock crossover
tdfb drc multiband_drc mfcc mux dts)
Copy link
Contributor

Choose a reason for hiding this comment

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

May I know why is this commit required?
If yes, may it be moved to src/audio/module_adapter/CMakeLists.txt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it could be removed now as it's already handled in src/audio/module_adapter/CMakeLists.txt.

Add DTS init function

Signed-off-by: Joe Cheng <joe.cheng@xperi.com>
@marc-hb marc-hb requested a review from andyross November 1, 2023 17:07
@btian1
Copy link
Contributor

btian1 commented Nov 3, 2023

Excellent, thanks @joechengxperi , looks very good. Only issue with the last patch and I know you are addressing to feedback, so @lgirdwood @btian1 I'd propose we drop the last patch... ok?

This PR purpose is enable DTS on MTL, if drop last one, then DTS will not be enabled on MTL, my opinion is we can go for now, this feature does not have too much relation with sof other modules, we can go with this and fix new issue if have in future.

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.

This is fine to me. The location of the DTS source files should be moved to a better place, but I'm ok to do that in a follow-up PR (as we are anyways moving files around during SOF2.8 cycles that is now ongoing).

@joechengxperi
Copy link
Contributor Author

@lgirdwood For this PR, may I know if there is still anything I have to do for merge? Thanks.

@kv2019i
Copy link
Collaborator

kv2019i commented Nov 10, 2023

@joechengxperi wrote:

@lgirdwood For this PR, may I know if there is still anything I have to do for merge? Thanks.

@cujomalainey has a -1 on this, that's blocking the merge now. Otherwise looks good to go.

@lgirdwood lgirdwood added this to the v2.8 milestone Nov 13, 2023
@lgirdwood
Copy link
Member

@joechengxperi wrote:

@lgirdwood For this PR, may I know if there is still anything I have to do for merge? Thanks.

@cujomalainey has a -1 on this, that's blocking the merge now. Otherwise looks good to go.

@joechengxperi I assume all of @cujomalainey comments are aligned/closed now ? if so, he should be able to re-review.

Copy link
Contributor

@cujomalainey cujomalainey left a comment

Choose a reason for hiding this comment

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

sorry spotted one more thing

zephyr_library_sources_ifdef(CONFIG_DTS_CODEC
${SOF_AUDIO_PATH}/module_adapter/module/dts/dts.c
)
if (CONFIG_DTS_CODEC)
Copy link
Contributor

Choose a reason for hiding this comment

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

This broke the stub build. Please fix

Copy link
Collaborator

Choose a reason for hiding this comment

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

This broke the stub build. Please fix

@joechengxperi it is the responsibility of the submitter to look at failures, not the reviewers. Ask for help if you don't understand some failures (or worse: if you don't have access to some)

https://github.com/thesofproject/sof/actions/runs/6718130608/job/18257259780?pr=8379

The last error messages can be misleading. Always scroll up and look at the first errors first. Parallel builds may require scrolling quite a way up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Apologize that I did not notice that build error.

Importing DTS library here to ensure DTS library is built into SOF
firmware as a static library.

Signed-off-by: Joe Cheng <joe.cheng@xperi.com>
This patch adds DTS_CODEC for IPC4 Intel platform builds.

Since EQ IIR + DTS is the combination we use to support customer, adding
EQ IIR here to ensure it's enabled.

Signed-off-by: Joe Cheng <joe.cheng@xperi.com>
@joechengxperi
Copy link
Contributor Author

@joechengxperi wrote:

@lgirdwood For this PR, may I know if there is still anything I have to do for merge? Thanks.

@cujomalainey has a -1 on this, that's blocking the merge now. Otherwise looks good to go.

@joechengxperi I assume all of @cujomalainey comments are aligned/closed now ? if so, he should be able to re-review.

Thank you @lgirdwood @kv2019i. Yes, I think those are all aligned now.

@cujomalainey
Copy link
Contributor

On device test failure is unrelated to this change, merging

@cujomalainey cujomalainey merged commit a8db157 into thesofproject:main Nov 14, 2023
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.

10 participants