-
Notifications
You must be signed in to change notification settings - Fork 321
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
Loadable up down mixer #7939
Loadable up down mixer #7939
Conversation
@pjdobrowolski the change looks OK but do we have the copy/move the existing source code to convert it into a loadable module? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Copyright(c) 2021 Intel Corporation. All rights reserved.
header year are all not updated, suggest all update to 2023 althrough it copied and not changed inside.
@ranj063 I've made a few experiments with creating independent loadable modules and that approach with coping only headers gave me clean binary without any extra zephyr or xtos dependencies. I've cleanup these headers to not include things not required but I think that it is possible to create in sof location with portable independent headers only for loadable modules which could be safely used in loadable modules. Firstly I would narrow how many of them is really required. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, let's not copy all the headers over. (1) They will run out of sync with the originals. It took me significant time to debug exactly such an issue - the original header turned out to be newer, it contained an additional field, so the main firmware and the module didn't work together. (2) You also need Zephyr headers and you need the automatically generated autoconf.h with configuration macros. Building modules should be done using a complete SOF + Zephyr installation, built for the target configuration, then you can build your module against that. This is also what the Linux kernel does for external modules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cant dupicate existing code or headers.
We need to
- Update lmdk Cmake to use global system header directories.
- Update lmdk Cmake to invoke src/audio Cmake to build module archives and link to those archives to link with lmdk modules. We have lost of src/audio/module_hifi.c code that can be linked to.
@@ -0,0 +1,108 @@ | |||
// SPDX-License-Identifier: BSD-3-Clause |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to set up our cmake to include from the global include directories to avoid the duplication
#include <stdint.h> | ||
#include <stdbool.h> | ||
|
||
void upmix32bit_1_to_5_1(struct up_down_mixer_data *cd, const uint8_t * const in_data, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should reuse existing hifi3 up/down mixer code and link as an archive. i.e. we link lmdk up_down_mixer.c with src/audio/up_down_mixer.a
It is not copying, it is extracting avoiding xtos and zephyr dependencies. |
If we need to remove RTOS deps then we should move the rtos logic out of the headers. This may need some headers being splitt up. What problems are the RTOS headers giving here ? |
Yest that is one of an idea to be independent from RTOS and SOF changes. For customer it is convenient to work in fixed environment without risk that some unexpected changes will affect working theirs closed source module. Splitting up headers is one of solutions and I think that it is goal to create portable include files which stay untouchable. That is how in legacy fw is done. |
It would be a lot easier to change the deployment model for 3rd party module SDK going forward since all infrastructure is open today. i.e. we should be providing a simple (for user) wrapper around west that
At this point developer is ready to go and we dont need to create a seperate SDK environment for loadable modules. Its saves everyone effort. |
It might be true if changes in sof or zephyr wouldn't be so dynamical. For client it is unnecessary hassle to keep up with changes and remember each time to do west update. We must put ourself in clients shoes and think more product wise. However, I agree with @lgirdwood and @lyakh that using zephyr/sof dependencies is more convenient and we can do 2 versions of loadable modules, ones with separate SDK and another more advance with build in west building etc. |
@pjdobrowolski the biggest problem I see with an SDK is the need for stable APIs. If we create an SDK we have to guarantee to our users that the exported APIs don't change "too often" and when they do change, we provide a reasonable update path. Doing that would (1) create too much maintenance overhead on us when updating APIs and (2) make development more difficult. |
dd48553
to
d311845
Compare
@pjdobrowolski I am not able to compile it with latest main, can you make sure this patch compiles with main?
|
A branch is the simpler and better answer to this problem. That's why version control branches exist: to avoid unwanted changes and keep them under control. Copy/paste is a much older and more dangerous way to achieve the same thing. If using git is too demanding for some customers then (a subset of) headers can be released from a branch. No copy/paste required.
Yes: a branch is only the beginning. Then you need a lot of work to maintain it. That's true with any solution. |
Headers represent only data structures which are neccessary for proper working pipelines
Up to date module adapter and system services
All files required for building up_down_mixer
d311845
to
ee17d3f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pjdobrowolski whats the plan for reusing existing headers ? Do you have an ETA ?
enum mem_zone { | ||
SOF_MEM_ZONE_SYS = 0, /**< System zone */ | ||
SOF_MEM_ZONE_SYS_RUNTIME, /**< System-runtime zone */ | ||
SOF_MEM_ZONE_RUNTIME, /**< Runtime zone */ | ||
SOF_MEM_ZONE_BUFFER, /**< Buffer zone */ | ||
SOF_MEM_ZONE_RUNTIME_SHARED, /**< Runtime shared zone */ | ||
SOF_MEM_ZONE_SYS_SHARED, /**< System shared zone */ | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to get these from the header.
cd->downmix_coefficients = k_scaled_lo_ro_downmix32bit; | ||
break; | ||
default: | ||
// comp_err(dev, "set_downmix_coefficients(): invalid channel config."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make it easier to use the Zephyr native LOG() API here ?
lmdk provide methods for building modules out of sof and zephyr environment with minimum data delivered. Purpose of that PR is to show how to port modules on up down mixer example.
To build that module it is required to follow steps:
cd $home/$repoDir/sof/lmdk/libraries/module_example
cmake -B build -G Ninja -DRIMAGE_COMMAND=$rimageDir -DSIGNING_KEY=$privKey
cmake --build build
Different approach but same loadable modules:
#7867
#7861