audio: iadk: support API 4.5.2 loadable detector modules#11032
audio: iadk: support API 4.5.2 loadable detector modules#11032TsaiGaggery wants to merge 4 commits into
Conversation
Accept IADK module API 4.5.2 in addition to 4.5.0. Extend the detector and system-agent vtables and append the versioned system-service lookup slot without changing earlier slots. This only establishes the 4.5.2 ABI. Services unavailable in the base firmware return an error and clear the interface pointer. Signed-off-by: Gaggery Tsai <gaggery.tsai@intel.com>
The current loadable-module entry point calls the system agent with a null placeholder. Creating the module at that address corrupts memory before its adapter can register. Resolve a null placeholder to the instance BSS already allocated by the library manager. Also propagate factory errors and reject a module that did not register an adapter. Signed-off-by: Gaggery Tsai <gaggery.tsai@intel.com>
The system agent called Init() as soon as the module loaded. The module adapter called it again from framework-owned module_init(). That could allocate detector state and register services twice. Remove the early call and keep module_init() as the single owner. Its return value is propagated through iadk_wrapper_init(). Signed-off-by: Gaggery Tsai <gaggery.tsai@intel.com>
Detector endpoints can consume input without a connected audio sink. Their process callback was skipped, prepare rejected the graph, and DP period calculation left the deadline at UINT_MAX. Allow sink/source modules without a sink, derive their DP period from the source IBS, and pass at most one IBS to each process call. A module without a sink still needs at least one connected source. Signed-off-by: Gaggery Tsai <gaggery.tsai@intel.com>
|
Can one of the admins verify this patch?
|
There was a problem hiding this comment.
Pull request overview
This PR updates the SOF IADK module adapter and related library-manager plumbing to load and run detector modules built against IADK module API 4.5.2 while preserving compatibility for existing 4.5.0 binaries, including support for “sinkless” (input-only) detector endpoints.
Changes:
- Accept both IADK module API 4.5.2 (current) and 4.5.0 at load time, while updating headers for the extended 4.5.2 interfaces and tables.
- Make system-service interface lookup explicitly fail/NULL for unavailable services, and add a versioned lookup entrypoint.
- Enable sinkless IADK modules by deriving DP period from an input source and ensuring the IADK process path can run with no connected sink.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/library_manager/lib_manager.c | Accepts IADK API 4.5.0 in addition to the current (4.5.2) version when classifying loadable modules. |
| src/include/sof/audio/module_adapter/library/native_system_service.h | Declares a versioned system-service interface lookup API. |
| src/include/sof/audio/module_adapter/iadk/system_agent.h | Updates SystemAgent to the newer interface version and adds detector check-in / BSS base APIs. |
| src/include/sof/audio/module_adapter/iadk/system_agent_interface.h | Introduces SystemAgentInterface3 with GetBssBase() for 4.5.2. |
| src/include/sof/audio/module_adapter/iadk/processing_module_interface.h | Extends detector interface with WritePattern() for 4.5.2. |
| src/include/sof/audio/module_adapter/iadk/api_version.h | Bumps current IADK API minor version to 4.5.2 and defines an explicit 4.5.0 compatibility constant. |
| src/include/module/module/system_service.h | Adds timestamping service ID and appends get_interface_versioned() to the system_service ABI. |
| src/audio/module_adapter/README.md | Documents DP period derivation for sinkless DP modules. |
| src/audio/module_adapter/module_adapter.c | Computes DP period from an input when sinkless; allows sinkless prepare for sink/source mode; enforces at least one connected source for sinkless. |
| src/audio/module_adapter/library/native_system_service.c | Implements versioned interface lookup and changes legacy lookup to fail and clear the returned pointer. |
| src/audio/module_adapter/iadk/system_agent.cpp | Resolves NULL module placeholder to per-instance BSS, propagates factory failures, removes early Init(), and wires versioned service lookup. |
| src/audio/module_adapter/iadk/README.md | Documents 4.5.2 interface/table extensions and sinkless processing behavior for detectors. |
| src/audio/module_adapter/iadk/iadk_module_adapter.cpp | Allows processing with sources but no sinks; caps per-call input to one IBS (min_available). |
| return NULL; | ||
|
|
||
| lib_manager_get_instance_bss_address(instance_id, mod, &base, size); | ||
| return reinterpret_cast<void *>(base); |
| if (id < 0 || !iface) | ||
| return ADSP_INVALID_PARAMETERS; | ||
| return ADSP_NO_ERROR; | ||
|
|
||
| *iface = NULL; | ||
| return ADSP_INVALID_PARAMETERS; |
|
test this please |
|
@TsaiGaggery thanks, pls do respond to copilot comments as we need these resolved prior to merge. |
| period = 1000000ULL * source_get_min_available(mod->sources[0]) / | ||
| (frame_bytes * rate); | ||
| else | ||
| period = 0; |
There was a problem hiding this comment.
previously in this case dev->period would be set to UINT32_MAX. Is this change deliberate? What's its purpose? This seems to be an error case anyway, right?
| */ | ||
| sink = comp_dev_get_first_data_consumer(dev); | ||
| if (!sink) { | ||
| if (!sink && !IS_PROCESSING_MODE_SINK_SOURCE(mod)) { |
There was a problem hiding this comment.
are sinkless modules only allowed in DP mode or in LL too?
Four-commit series enabling IADK detector modules built against module
API 4.5.2 to load and run:
audio: iadk: accept module API 4.5.2— append the 4.5.2 detector,system-agent, and system-service entries while keeping the 4.5.0
prefix ABI unchanged. Legacy
get_interface()now reportsunavailable services with an error and a cleared pointer instead of
success with the pointer left unset.
audio: iadk: resolve missing module placeholders— the loadableentry point may pass a null placeholder by design; resolve it to the
library-manager instance BSS (size-checked) instead of constructing
the module at address zero, and propagate factory/check-in failures.
audio: iadk: initialize loadable modules once— drop the earlyInit()call; the framework-owned adapter path is the singleinitialization owner.
audio: module_adapter: support sinkless IADK modules— input-onlydetector endpoints process without a connected sink, derive their DP
period from the source IBS, and receive at most one IBS per process
call. A module without a sink still requires at least one source.
The series is append-only for existing 4.5.0 modules and changes no
behavior for modules with connected sinks.
Context: developed and exercised bringing up a from-source keyphrase
detector module on ACE 3.0 hardware, where a loadable 4.5.2 detector is
the always-on wake-word engine. Complements the multi-KPB WoV arbiter
direction in #11022 by letting real IADK detector modules act as the
detectors.