Repository navigation
audio: ffmpeg_dec: split decoders, encoders, and filters into standalone per-codec LLEXTs #11519
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
Open
lgirdwood
wants to merge
11
commits into
thesofproject:main
Choose a base branch
from
lgirdwood:topic/ffmpeg-llext-split
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
2a9f086
lib_manager: llext_manager: detach cold partitions before mapping shdr
lrgirdwo 7dbfc72
zephyr: vregion: flush interim heap metadata for SMP coherency
lrgirdwo d0d36ca
ipc4: base_fw: replace hardcoded codec info with static runtime regis…
lrgirdwo 0728dce
lib_manager: llext_manager: support LLEXT codec discovery and safe li…
lrgirdwo 8d7cde0
audio: codecs: advertise per-module codec capabilities at init and in…
lrgirdwo a899ba9
zephyr, llext: support shared-slot and top-down LLEXT placement
lrgirdwo c998a66
audio: ffmpeg_dec: split decoders, encoders, and filters into standal…
lrgirdwo 6e3bca8
topology2: wire compressed FFmpeg pipelines to standalone module UUIDs
lrgirdwo e9dc085
lib_manager: llext_manager: fix LLEXT unload, vpage release, and deta…
lrgirdwo 2721296
ipc4, lib_manager: use Zephyr LOG_* APIs and log failures with LOG_ERR
lrgirdwo 623533a
zephyr, llext: use SOF module root for scripts and rm module_size on …
lrgirdwo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,10 @@ def parse_args(): | |
| help='.text section address') | ||
| parser.add_argument("-s", "--size-file", required=True, type=str, | ||
| help='File with stored accumulated size') | ||
| parser.add_argument("-e", "--end-addr", required=False, type=str, | ||
| help='Optional exclusive region end address for top-down placement') | ||
| parser.add_argument("-r", "--reset", action="store_true", | ||
| help='Ignore any existing size file and start at text-addr') | ||
|
|
||
| args = parser.parse_args() | ||
|
|
||
|
|
@@ -211,11 +215,14 @@ def main(): | |
| # Get the size of the previous module, if this isn't the first one. | ||
| # It is used to automatically calculate starting address of the current | ||
| # module. | ||
| try: | ||
| with open(args.size_file, 'r') as f_size: | ||
| size = int(f_size.read().strip(), base = 0) | ||
| except OSError: | ||
| if args.reset: | ||
| size = 0 | ||
| else: | ||
| try: | ||
| with open(args.size_file, 'r') as f_size: | ||
| size = int(f_size.read().strip(), base = 0) | ||
| except OSError: | ||
| size = 0 | ||
|
|
||
| text_addr = int(args.text_addr, 0) + size | ||
| text_size = 0 | ||
|
|
@@ -297,6 +304,36 @@ def main(): | |
| if not text_found: | ||
| raise RuntimeError('No .text section found in the object file') | ||
|
|
||
| if args.end_addr: | ||
| end_addr = int(args.end_addr, 0) | ||
| text_align = next(s.header['sh_addralign'] | ||
| for s in elf.iter_sections() | ||
| if s.name == '.text' and (s.header['sh_flags'] & SH_FLAGS.SHF_ALLOC)) | ||
| max_align = max([0x1000, text_align] + | ||
| [s.header['sh_addralign'] for s in readonly + writable]) | ||
|
|
||
| def _compute_end(base): | ||
| t_addr = max_alignment(base, 0x1000, text_align) | ||
| cur = align_up(t_addr + text_size, 0x1000) | ||
| for sec in readonly: | ||
| cur = align_up(cur, sec.header['sh_addralign']) + sec.header['sh_size'] | ||
| cur = align_up(cur, 0x1000) | ||
| for sec in writable: | ||
| cur = align_up(cur, sec.header['sh_addralign']) + sec.header['sh_size'] | ||
| return align_up(cur, 0x1000) | ||
|
Comment on lines
+315
to
+323
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not following why we need to compute start/end addresses at build time. All modules can be independently loaded and unloaded in any free memory region at runtime llext load. |
||
|
|
||
| span = _compute_end(text_addr) - text_addr | ||
| top_base = (end_addr - span) & ~(max_align - 1) | ||
| top_end = _compute_end(top_base) | ||
| if top_end > end_addr: | ||
| top_base -= align_up(top_end - end_addr, max_align) | ||
| if top_base < text_addr: | ||
| print(f'llext_link_helper.py: WARNING: {module} top-down base 0x{top_base:x} ' | ||
| f'overlaps modules ending at 0x{text_addr:x}', file=sys.stderr) | ||
| text_addr = max_alignment(top_base, 0x1000, text_align) | ||
| command = [c for c in command if not c.startswith('-Wl,-Ttext=')] | ||
| command.append(f'-Wl,-Ttext=0x{text_addr:x}') | ||
|
|
||
| # The original LLEXT support in SOF linked all LLEXT modules with pre- | ||
| # calculated addresses. Such modules can only be used at those exact | ||
| # addresses, so we map memory buffers for such modules to those | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
this should come from the vregion topology heap size