Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# Top-level Makefile for sof-utils:
# - sof-builder : GTK4 Topology2 Visual Graph Editor & Testbench Studio
# - sof-ucm : GTK4 End-to-End Pipeline Visualizer & ALSA UCM2 Editor
# - sof-top : GTK4 Live DSP Resource, Memory (SRAM + DRAM) & Task Monitor
# - sof-remote-server : C TCP Telemetry & Control Daemon (sof_remote_server) + CLI (sof-remote)
# - sof-testbench : Multi-Core LL/DP Host Simulator (sof-testbench4) + CLI (sof-tb-ctl)
Expand Down Expand Up @@ -60,14 +61,14 @@ DEB_STAGE := $(BUILD_DIR)/deb-stage/$(PACKAGE)_$(VERSION)-$(RELEASE)_$(DEB_AR
DEB_FILE := $(DIST_DIR)/$(PACKAGE)_$(VERSION)-$(RELEASE)_$(DEB_ARCH).deb
RPM_TOPDIR := $(abspath $(BUILD_DIR)/rpmbuild)

.PHONY: all build remote-server builder top testbench \
.PHONY: all build remote-server builder ucm top testbench \
android android-push \
install uninstall check test ctest \
deb rpm package packages clean distclean help

all: build

build: remote-server builder top testbench
build: remote-server builder ucm top testbench

remote-server:
$(MAKE) -C sof-remote-server WORK_DIR="$(WORK_DIR)" all
Expand All @@ -81,6 +82,9 @@ android-push:
builder:
$(MAKE) -C sof-builder PYTHON="$(PYTHON)" all

ucm:
$(MAKE) -C sof-ucm PYTHON="$(PYTHON)" all

top:
$(MAKE) -C sof-top PYTHON="$(PYTHON)" all

Expand All @@ -107,6 +111,7 @@ endif
install: build
$(MAKE) -C sof-remote-server DESTDIR="$(DESTDIR)" PREFIX="$(PREFIX)" BINDIR="$(BINDIR)" WORK_DIR="$(WORK_DIR)" install
$(MAKE) -C sof-builder DESTDIR="$(DESTDIR)" PREFIX="$(PREFIX)" BINDIR="$(BINDIR)" DATADIR="$(DATADIR)" install
$(MAKE) -C sof-ucm DESTDIR="$(DESTDIR)" PREFIX="$(PREFIX)" BINDIR="$(BINDIR)" DATADIR="$(DATADIR)" install
$(MAKE) -C sof-top DESTDIR="$(DESTDIR)" PREFIX="$(PREFIX)" BINDIR="$(BINDIR)" DATADIR="$(DATADIR)" install
$(INSTALL) -d "$(DESTDIR)$(DOCDIR)"
$(INSTALL) -m 0644 README.md LICENSE "$(DESTDIR)$(DOCDIR)/"
Expand All @@ -132,6 +137,7 @@ install: build
uninstall:
$(MAKE) -C sof-remote-server DESTDIR="$(DESTDIR)" PREFIX="$(PREFIX)" BINDIR="$(BINDIR)" uninstall
$(MAKE) -C sof-builder DESTDIR="$(DESTDIR)" PREFIX="$(PREFIX)" BINDIR="$(BINDIR)" DATADIR="$(DATADIR)" uninstall
$(MAKE) -C sof-ucm DESTDIR="$(DESTDIR)" PREFIX="$(PREFIX)" BINDIR="$(BINDIR)" DATADIR="$(DATADIR)" uninstall
$(MAKE) -C sof-top DESTDIR="$(DESTDIR)" PREFIX="$(PREFIX)" BINDIR="$(BINDIR)" DATADIR="$(DATADIR)" uninstall
rm -f "$(DESTDIR)$(BINDIR)/sof-testbench4" \
"$(DESTDIR)$(BINDIR)/sof-testbench3" \
Expand All @@ -142,6 +148,7 @@ uninstall:

check:
$(MAKE) -C sof-builder PYTHON="$(PYTHON)" check
$(MAKE) -C sof-ucm PYTHON="$(PYTHON)" check
$(MAKE) -C sof-top PYTHON="$(PYTHON)" check

test: check
Expand Down Expand Up @@ -172,6 +179,7 @@ deb: build
echo " Developer utilities, visual GTK4 applications, and host/DUT tools for the"; \
echo " Sound Open Firmware (SOF) ecosystem:"; \
echo " * sof-builder: GTK4 Topology2 Visual Graph Editor, IPC4 Compiler & Testbench Studio"; \
echo " * sof-ucm: GTK4 End-to-End Audio Pipeline Visualizer & ALSA UCM2 Editor"; \
echo " * sof-top: GTK4 Live DSP Resource, Memory (SRAM + DRAM) & Task Monitor"; \
echo " * sof_remote_server & sof-remote: TCP Telemetry & Control Daemon and CLI for DUTs"; \
echo " * sof-testbench4 & sof-tb-ctl: Multi-core LL/DP Host DSP Simulator & Control CLI"; \
Expand Down Expand Up @@ -226,6 +234,7 @@ package packages: deb rpm
clean:
$(MAKE) -C sof-remote-server clean
$(MAKE) -C sof-builder clean
$(MAKE) -C sof-ucm clean
$(MAKE) -C sof-top clean
rm -rf "$(BUILD_DIR)"

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Developer utilities, visual tools, and host applications for the [Sound Open Fir
| **[`sof-top`](sof-top/sof-top)** | [`sof-top/`](sof-top/) | GTK4 Live DSP Resource Monitor — Moving Core Utilization Graph, Moving Memory Utilization Graph (HPSRAM, LPSRAM, DRAM L3/IMR, Heaps), and Unified DSP Task List |
| **[`sof-remote-server`](sof-remote-server/)** | [`sof-remote-server/`](sof-remote-server/) | Lightweight C TCP Telemetry & Control Daemon (Port `9998`) for DUTs via `/dev/sof-dsp0` or direct PCIe BAR4 MMIO + DebugFS/SysFS fallback |
| **[`sof-builder`](sof-builder/)** | [`sof-builder/`](sof-builder/) | GTK4 Topology2 Visual Graph Editor, IPC4 `.tplg` Compiler & Real-Time `sof-testbench4` Simulation / Telemetry Studio |
| **[`sof-ucm`](sof-ucm/sof-ucm)** | [`sof-ucm/`](sof-ucm/) | GTK4 End-to-End Audio Pipeline Visualizer (PCM → DSP → Codec → HW Endpoints) & ALSA UCM2 Editor/Generator (Local + SSH) |
| **[`sof-testbench`](sof-testbench/)** | [`sof-testbench/`](sof-testbench/) | Multi-Core LL/DP `sof-testbench4` Simulator, `sof-tb-ctl` TCP Control CLI, Host Platform Runtime (`platform/library`), and 70-Test Suite |
| **[`sof-tplg-parser`](sof-tplg-parser/)** | [`sof-tplg-parser/`](sof-tplg-parser/) | ALSA Topology (`.tplg`) IPC3/IPC4 Parser Library (`libsof_tplg_parser.a`) |

Expand Down
3 changes: 3 additions & 0 deletions packaging/rpm/sof-utils.spec
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Requires: alsa-utils
Developer utilities, visual GTK4 applications, and host/DUT tools for the
Sound Open Firmware (SOF) ecosystem:
- sof-builder: GTK4 Topology2 Visual Graph Editor, IPC4 Compiler & Testbench Studio
- sof-ucm: GTK4 End-to-End Audio Pipeline Visualizer & ALSA UCM2 Editor
- sof-top: GTK4 Live DSP Resource, Memory (SRAM + DRAM) & Task Monitor
- sof-remote-server & sof-remote: TCP Telemetry & Control Daemon and CLI for DUTs
- sof-testbench4 & sof-tb-ctl: Multi-core LL/DP Host DSP Simulator & Control CLI
Expand All @@ -48,13 +49,15 @@ rm -rf %{buildroot}
%files
%license LICENSE
%{_bindir}/sof-builder
%{_bindir}/sof-ucm
%{_bindir}/sof-top
%{_bindir}/sof-top-cli
%{_bindir}/sof_remote_server
%{_bindir}/sof-remote-server
%{_bindir}/sof-remote
%{_datadir}/sof-utils/
%{_datadir}/applications/org.thesofproject.SofBuilder.desktop
%{_datadir}/applications/org.thesofproject.SofUcm.desktop
%{_datadir}/applications/org.thesofproject.SofTop.desktop
%{_datadir}/doc/sof-utils/
%if 0%{?with_testbench}
Expand Down
37 changes: 37 additions & 0 deletions sof-ucm/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# SPDX-License-Identifier: BSD-3-Clause
PYTHON ?= python3
INSTALL ?= install
PREFIX ?= /usr
BINDIR ?= $(PREFIX)/bin
DATADIR ?= $(PREFIX)/share
APPDIR ?= $(DATADIR)/sof-utils/sof-ucm
DESKDIR ?= $(DATADIR)/applications
DESTDIR ?=

PY_SRCS := $(wildcard sof_ucm/*.py)

.PHONY: all check install uninstall clean

all: check

check:
$(PYTHON) -B -m py_compile sof-ucm $(PY_SRCS) $(wildcard tests/*.py)
$(PYTHON) -B -m unittest discover -s tests

Comment on lines +17 to +20

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Run the tests/ suite here too (takes ~0.6s) so top-level make check / make test validates sof-ucm/tests as well as syntax:

Suggested change
check:
$(PYTHON) -B -m py_compile sof-ucm $(PY_SRCS)
check:
$(PYTHON) -B -m py_compile sof-ucm $(PY_SRCS) $(wildcard tests/*.py)
$(PYTHON) -B -m unittest discover -s tests

install:
$(INSTALL) -d "$(DESTDIR)$(BINDIR)"
$(INSTALL) -d "$(DESTDIR)$(APPDIR)/sof_ucm"
$(INSTALL) -d "$(DESTDIR)$(DESKDIR)"
$(INSTALL) -m 0755 sof-ucm "$(DESTDIR)$(APPDIR)/sof-ucm"
$(INSTALL) -m 0644 $(PY_SRCS) "$(DESTDIR)$(APPDIR)/sof_ucm/"
$(INSTALL) -m 0644 pyproject.toml requirements.txt README.md "$(DESTDIR)$(APPDIR)/"
$(INSTALL) -m 0644 desktop/org.thesofproject.SofUcm.desktop "$(DESTDIR)$(DESKDIR)/org.thesofproject.SofUcm.desktop"
ln -sf "$(APPDIR)/sof-ucm" "$(DESTDIR)$(BINDIR)/sof-ucm"

uninstall:
rm -f "$(DESTDIR)$(BINDIR)/sof-ucm"
rm -f "$(DESTDIR)$(DESKDIR)/org.thesofproject.SofUcm.desktop"
rm -rf "$(DESTDIR)$(APPDIR)"

clean:
rm -rf sof_ucm/__pycache__ tests/__pycache__ __pycache__ build dist *.egg-info
46 changes: 46 additions & 0 deletions sof-ucm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# SOF UCM (`sof-ucm`)

**SOF UCM** is a GTK4 end-to-end audio pipeline visualizer and ALSA UCM2 profile editor/generator for Sound Open Firmware (SOF) systems — supporting both the **local machine** and **remote DUTs via SSH**.

---

## Features

- **Full Audio Stack Discovery (Local or Remote SSH)**:
- Enumerates ALSA sound cards (`/proc/asound/cards`, `/sys/class/sound`, DMI) and PCM/Compress streams.
- Auto-detects and parses the active binary topology (`.tplg`) including DSP pipelines, modules, pin formats, routes, and widget-owned kcontrols.
- Reads all ALSA kcontrols (`amixer -c N contents`: volumes, switches, enums, bytes, TLV dB scales, jacks).
- Reads live ASoC DAPM widgets, routes, bias levels, and DPCM FE→BE states from `/sys/kernel/debug/asoc` (with automatic synthesis fallback when debugfs is unprivileged).
- **GTK4 + `Gtk.Snapshot` + Cairo End-to-End Graph**:
- Renders each pipeline from **ALSA PCM → Host Copier → DSP Modules/Mixers/Gains → DAI Copier → Codec DAPM → Hardware Endpoint** in the visual style of `sof-builder`.
- Interactive vertical `VOL` faders, `SW` toggles, and `ENUM` popovers anchored beneath their owning DSP/Codec/Endpoint nodes.
- **ALSA UCM2 Visualization, Editing & Creation**:
- Parses and evaluates UCM2 profiles (`Syntax 4..7`, `SectionUseCase`, `SectionVerb`, `SectionDevice`, `SectionModifier`, `BootSequence`, `If`/`Condition`, `Include`).
- Highlights the exact PCM, DSP modules, kcontrols, and hardware endpoints claimed by checked UCM devices.
- **New UCM Wizard**: Auto-generates a UCM2 profile by tracing PCM-to-endpoint paths in the live graph.
- **Record → UCM**: Dragging sliders/toggles on the canvas records `cset` steps into the selected device's `EnableSequence`.
- **Validate & Test (`alsaucm`)**: Stages edits in a temporary `ALSA_CONFIG_UCM2` directory and tests them live without overwriting system files.

---

## Usage

```bash
# Inspect local machine:
./sof-ucm

# Inspect a specific local card or explicit .tplg:
./sof-ucm --card 2 --tplg /lib/firmware/intel/sof-ipc4-tplg/sof-hda-generic.tplg

# Inspect & configure a remote DUT via SSH:
./sof-ucm --ssh root@dut-host

# Headless offscreen PNG export:
./sof-ucm --card 2 --render-png pipeline.png
```

---

## License

SPDX-License-Identifier: `BSD-3-Clause`
11 changes: 11 additions & 0 deletions sof-ucm/desktop/org.thesofproject.SofUcm.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Desktop Entry]
Type=Application
Name=SOF UCM
GenericName=SOF End-to-End Pipeline Visualizer & ALSA UCM2 Editor
Comment=Visualize PCM-to-Hardware Audio Pipelines and Edit/Create ALSA UCM2 Profiles
Exec=sof-ucm
Icon=audio-card
Terminal=false
Categories=Development;AudioVideo;Audio;
Keywords=SOF;ALSA;UCM;UCM2;DAPM;Topology;DSP;GTK4;
StartupWMClass=org.thesofproject.SofUcm
47 changes: 47 additions & 0 deletions sof-ucm/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# SPDX-License-Identifier: BSD-3-Clause

[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "sof-ucm"
version = "0.1.0"
description = "SOF UCM — GTK4 End-to-End Audio Pipeline Visualizer & ALSA UCM2 Editor"
readme = "README.md"
license = { text = "BSD-3-Clause" }
requires-python = ">=3.10"
authors = [
{ name = "Liam Girdwood", email = "liam.r.girdwood@intel.com" },
]
keywords = ["sof", "sound-open-firmware", "alsa", "ucm", "ucm2", "dapm", "topology", "gtk4"]
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: X11 Applications :: GTK",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Multimedia :: Sound/Audio",
]
dependencies = [
"PyGObject>=3.42.0",
"pycairo>=1.20.0",
]

[project.urls]
Homepage = "https://github.com/thesofproject/sof-utils"
Repository = "https://github.com/thesofproject/sof-utils"
Issues = "https://github.com/thesofproject/sof-utils/issues"

[project.scripts]
sof-ucm = "sof_ucm.main:main"

[tool.setuptools.packages.find]
where = ["."]
include = ["sof_ucm*"]
2 changes: 2 additions & 0 deletions sof-ucm/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PyGObject>=3.42.0
pycairo>=1.20.0
13 changes: 13 additions & 0 deletions sof-ucm/sof-ucm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: BSD-3-Clause
"""Launcher script for SOF UCM — GTK4 End-to-End Audio Pipeline Visualizer & UCM2 Editor."""

import os
import sys

sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)))

from sof_ucm.main import main

if __name__ == "__main__":
raise SystemExit(main())
4 changes: 4 additions & 0 deletions sof-ucm/sof_ucm/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# SPDX-License-Identifier: BSD-3-Clause
"""SOF UCM — GTK4 End-to-End Audio Pipeline Visualizer & ALSA UCM2 Editor."""

__version__ = "0.1.0"
Loading