Repository navigation
Conversation
… topology export - Parse ALSA .tplg manifest headers and SOF ABI version bytes (IPC4 <3H> and IPC3 <3B>) in tplg_ipc4.py and tplg_binary.py. - Discover local topology2 checkouts by ABI version and fall back to read-only git archive snapshots cached under ~/.cache/sof-builder/versioned-sources/. - Identify matching .conf source / CMake targets with structural & parameter diffing, or decompile binary pipelines/widgets/routes/controls/PCMs directly into an editable GraphViewModel. - Preserve decoded binary SOF ABI bytes in compiler.py and serialize multi-pipeline topologies to compilable .conf in serializer.py. - Add banner switching, binary/source open flows, and CLI .tplg loading in window.py. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
…enu support in text editor - Add monospace font family dropdown, point-size SpinButton, Wrap toggle, and Ctrl++/Ctrl+-/Ctrl+0/Ctrl+Scroll zoom synced across tabs and persisted in ui_state.json. - Attach a DrawingArea left line-number gutter synchronized with scroll and font metrics, plus current-line and matching bracket highlights preserved across syntax re-colorization. - Add collapsible Find/Replace bar (Ctrl+F, Ctrl+H, F3/Shift+F3, regex/case toggles, atomic Replace All) and Go-to-Line bar (Ctrl+G). - Add auto-indent on Return, multi-line Tab/Shift+Tab indent/outdent, Ctrl+/ line comment toggling, Ctrl+D duplicate line, Ctrl+Shift+K delete line, smart Home, and pair editing. - Route Edit menu Undo/Redo/Select All/Cut/Copy/Paste/Delete and Find/Go-to-Line/Zoom actions to the active TopologyTextEditor in text mode. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Member
Author
|
first commit is missing SOB and commit message. |
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical defects can silently drop or alter topology data during export, compile stale graphs after rejected edits, and overwrite cached historical sources.
15 open issues
Isolate class objects during pipeline inheritance resolution · New Prefer decoded private bytes over default parameter includes · New Recognize parser-generated PCM keys during export · New Preserve manifest and binary provenance through text round-trips · New Include DAI links and configurations in full-topology exports · New Invalidate cached search matches immediately after edits · New Protect snapshots from saves that overwrite cached source files · New Compare full audio formats before declaring graphs an exact match · New Require matching structural sets for exact graph matches · New Restore decoded component parameters when reconstructing widgets · New Restore source tabs from their original binary topology · New Abort export when committing text edits fails · New Traverse conditional pattern blocks without entering class templates · New Expand regex replacements using matches from the full buffer · New Treat undecoded SOF ABI versions as unknown · New
What changed in this PR
Adds binary .tplg opening and export to sof-builder, with ABI-aware source discovery and editable graph reconstruction. It also improves platform topology parsing and the integrated text editor.
Changes:
- Decode binary topology metadata, locate matching sources, and support full-topology export.
- Expand conditional configuration parsing and handle file-local topology classes.
- Add editor search/replace, navigation, editing shortcuts, highlighting, and synchronized font controls.
| File | Description |
|---|---|
sof-builder/sof_builder/window.py |
Integrates binary tabs, export actions, and editor controls. |
sof-builder/sof_builder/tplg_ipc4.py |
Decodes ABI metadata and additional topology fields. |
sof-builder/sof_builder/tplg_binary.py |
Resolves versioned sources and reconstructs binary graphs. |
sof-builder/sof_builder/text_editor.py |
Adds editing, search, navigation, and display features. |
sof-builder/sof_builder/serializer.py |
Adds full-topology configuration serialization. |
sof-builder/sof_builder/parser.py |
Expands conditional includes and file-local classes. |
sof-builder/sof_builder/model.py |
Tracks binary provenance and discovers ABI-aware workspaces. |
sof-builder/sof_builder/compiler.py |
Supports binary ABI preservation and explicit export paths. |
Review effort: Balanced
Comment on lines
+1556
to
+1558
| saved_pipelines = dict(self.pipeline_classes) | ||
| saved_modules = dict(self.processing_modules) | ||
| saved_bases = dict(self.base_classes) |
Comment on lines
+969
to
+974
| if pfile: | ||
| lines.append(f"{pad}\t<{pfile}>\n") | ||
| else: | ||
| bhex = str(ctrl_cfg.get_scalar("bytes_hex", "")).strip() | ||
| if bhex: | ||
| lines.append(f'{pad}\tObject.Base.data."1" {{\n{pad}\t\tbytes\t"{bhex}"\n{pad}\t}}\n') |
| # PCMs | ||
| pcm_blocks: List[str] = [] | ||
| for ch in vm.root_config.children: | ||
| if ch.key.startswith("Object.PCM.pcm."): |
| pcm_section = f"\nObject.PCM.pcm [\n" + "\n".join(pcm_blocks) + "\n]\n" if pcm_blocks else "" | ||
| route_section = f"\nObject.Base.route [\n" + "\n".join(route_lines) + "\n]\n" if route_lines else "" | ||
|
|
||
| conf_text = f"""<searchdir:include> |
| \t"nvl"\t"platform/intel/ptl.conf" | ||
| }}{pipe_container_cls}{inline_cls_txt} | ||
|
|
||
| """ + pipelines_section + route_section + pcm_section |
Comment on lines
+2210
to
+2212
| fpath = primary_id if (primary_id and os.path.isfile(primary_id)) else source_file | ||
| if fpath and os.path.isfile(fpath): | ||
| tab = self.open_tplg_file_in_tab(fpath, force_mode="binary") |
Comment on lines
+3256
to
+3257
| if active.text_editor.is_modified_in_text: | ||
| active.text_editor.commit_to_diagram() |
| for st in stmts: | ||
| if st.key.startswith("Object."): | ||
| return True | ||
| if st.stmt_type == "block" and (st.key == "{}" or st.key.startswith("IncludeByKey.")): |
Comment on lines
+1009
to
+1014
| cur_slice = self.get_text()[s_off:e_off] | ||
| if self.regex_btn.get_active(): | ||
| try: | ||
| replacement = pat.sub(rep_raw, cur_slice, count=1) | ||
| except re.error: | ||
| return False |
| """Extract protocol, SOF ABI version, and ALSA manifest version from a parsed .tplg.""" | ||
| return TplgBinaryVersionInfo( | ||
| ipc_protocol=str(getattr(tplg, "ipc_protocol", "") or ""), | ||
| sof_abi_major=getattr(tplg, "sof_abi_major", None), |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.


Summary
This draft PR adds binary
.tplgopening/editing with ABI-matched source discovery and upgrades the Topology2 text editor insof-builder:Platform feature
.confparsing &IncludeByKeyexpansion (parser.py,model.py,window.py)dmic-wov-multi.confinstead of empty pipeline containers.Binary
.tplgopening, ABI version matching & full topology export (tplg_ipc4.py,tplg_binary.py,compiler.py,serializer.py,model.py,window.py).tplgmanifest headers andSOF ABIpayloads (IPC4<3H>and IPC3<3B>).topology2checkouts bykernel/abi.hversion and extracts read-only historicalgit archivesnapshots under~/.cache/sof-builder/versioned-sources/when an exact local match is unavailable..conf/ CMake targets with structural & parameter diffs, or decompiles binary pipelines, widgets, routes, kcontrols, and PCMs into an editable graph while preserving decodedsof_abi_byteson recompile.TopologyTextEditor core editing & font controls (
text_editor.py,window.py)SpinButton,Wraptoggle, andCtrl++/Ctrl+-/Ctrl+0/Ctrl+Scrollzoom synced across tabs and persisted inui_state.json.DrawingArealeft line-number gutter, active-line background, and matching/mismatched bracket highlights preserved across syntax re-colorization.Ctrl+F,Ctrl+H,F3/Shift+F3, case/regex toggles, atomicReplace All) and Go-to-Line (Ctrl+G) bars.Tab/Shift+Tab,Ctrl+/line comment toggling,Ctrl+Dduplicate line,Ctrl+Shift+Kdelete line, smartHome, pair typing/backspace, and context-aware Edit menu routing (Undo,Redo,Select All,Cut,Copy,Paste,Delete).Testing
py_compileacross all modified Python modules.3.29.1) & IPC3 (3.22.1) binary version decoding, read-only git-snapshot resolution (3.28.0), andalsatplground-trip recompilation preserving binary ABI bytes.TopologyTextEditorunit checks and headless GTK4Topology2MainWindowintegration tests.