module_adapter : audio : fix DTS support on MTL#8379
module_adapter : audio : fix DTS support on MTL#8379cujomalainey merged 7 commits intothesofproject:mainfrom
Conversation
| @@ -169,7 +169,8 @@ check_optimization(fma -mfma -ftree-vectorize -DOPS_FMA) | |||
| check_optimization(hifi2ep -mhifi2ep "" -DOPS_HIFI2EP) | |||
There was a problem hiding this comment.
Please split this into multiple patches. One patch per logical change.
There was a problem hiding this comment.
I've tried to split the patches. Please let me know if it's okay or not. Thanks.
kv2019i
left a comment
There was a problem hiding this comment.
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 | |||
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
So the Kconfig can set a dependecy, we could use depends in Kconfig to state this relationship between DTS and IIR.
@singalsu fyi.
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>
554e988 to
de8db87
Compare
@kv2019i I've tried to split the patches and adjusted the order of commits. Please let me know if it's okay. Thanks. |
This is super helpful. Thanks @marc-hb! |
lgirdwood
left a comment
There was a problem hiding this comment.
Looks good, I think only some minor opens from me.
src/include/sof/audio/component.h
Outdated
| void sys_comp_module_tdfb_interface_init(void); | ||
| void sys_comp_module_volume_interface_init(void); | ||
|
|
||
| void sys_comp_module_dts_interface_init(void); |
There was a problem hiding this comment.
nitpick: this should be in line above, next to the others.
There was a problem hiding this comment.
not in alphabetical order
| @@ -0,0 +1,3 @@ | |||
| CONFIG_COMP_IIR=y | |||
There was a problem hiding this comment.
So the Kconfig can set a dependecy, we could use depends in Kconfig to state this relationship between DTS and IIR.
@singalsu fyi.
btian1
left a comment
There was a problem hiding this comment.
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.
de8db87 to
694aeb6
Compare
kv2019i
left a comment
There was a problem hiding this comment.
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?
src/audio/Kconfig
Outdated
| select COMP_BLOB | ||
| default y | ||
| depends on COMP_MODULE_ADAPTER | ||
| depends on COMP_MODULE_ADAPTER || DTS_CODEC |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
I also think this is not a good place, IIR can't depend on DTS, it is a standalone feature.
There was a problem hiding this comment.
@joechengxperi I agree, I am not sure why the config is defined this way, you should select the IIR component from the DTS component.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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"
There was a problem hiding this comment.
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
There was a problem hiding this comment.
@marc-hb I removed that commit which added the wrong dependency and restored the original solution in overlay yesterday.
btian1
left a comment
There was a problem hiding this comment.
@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?
src/audio/Kconfig
Outdated
| select COMP_BLOB | ||
| default y | ||
| depends on COMP_MODULE_ADAPTER | ||
| depends on COMP_MODULE_ADAPTER || DTS_CODEC |
There was a problem hiding this comment.
I also think this is not a good place, IIR can't depend on DTS, it is a standalone feature.
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; | ||
| } |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
yes, both braces must be in the same commit to avoid breaking bisection
There was a problem hiding this comment.
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>
694aeb6 to
47822aa
Compare
src/include/sof/audio/component.h
Outdated
| void sys_comp_module_tdfb_interface_init(void); | ||
| void sys_comp_module_volume_interface_init(void); | ||
|
|
||
| void sys_comp_module_dts_interface_init(void); |
There was a problem hiding this comment.
not in alphabetical order
src/audio/Kconfig
Outdated
| select COMP_BLOB | ||
| default y | ||
| depends on COMP_MODULE_ADAPTER | ||
| depends on COMP_MODULE_ADAPTER || DTS_CODEC |
There was a problem hiding this comment.
@joechengxperi I agree, I am not sure why the config is defined this way, you should select the IIR component from the DTS component.
47822aa to
f41e4fb
Compare
src/audio/Kconfig
Outdated
| select COMP_BLOB | ||
| default y | ||
| depends on COMP_MODULE_ADAPTER | ||
| depends on COMP_MODULE_ADAPTER || DTS_CODEC |
There was a problem hiding this comment.
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"
src/audio/CMakeLists.txt
Outdated
|
|
||
| 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) |
There was a problem hiding this comment.
May I know why is this commit required?
If yes, may it be moved to src/audio/module_adapter/CMakeLists.txt?
There was a problem hiding this comment.
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>
f41e4fb to
1ef2f59
Compare
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. |
kv2019i
left a comment
There was a problem hiding this comment.
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).
|
@lgirdwood For this PR, may I know if there is still anything I have to do for merge? Thanks. |
|
@joechengxperi wrote:
@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. |
cujomalainey
left a comment
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
This broke the stub build. Please fix
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>
1ef2f59 to
ac2f487
Compare
Thank you @lgirdwood @kv2019i. Yes, I think those are all aligned now. |
|
On device test failure is unrelated to this change, merging |
Add the commits to support DTS processing on MTL.