Skip to content

agm: improve configuration flexibility and usability - #139

Open
svutukur20 wants to merge 795 commits into
AudioReach:masterfrom
svutukur20:sync-agm-sep2026
Open

svutukur20 wants to merge 795 commits into
AudioReach:masterfrom
svutukur20:sync-agm-sep2026

Conversation

@svutukur20

Copy link
Copy Markdown

No description provided.

quic-rohit and others added 30 commits November 13, 2022 23:53
…_PROXY

Slimbus slave and master configuration using BTFM Proxy is done during
pcm_prepare. Call device_prepare before graph_start so that master is
configured on time.

Change-Id: If893d587bcb1368ad7501196339e52ffbceb395d
Change-Id: I0d7f0af5ec241d4e8efe44f22ba405b5f0a6735c
Add size limit check before parsing GKV ,CKV and properties metadata
to avoid memory read overflow.

Change-Id: Ia2b99c7641166ef042b22e5a5581d264e0aa8eea
Add a max limit check for number of GKV and CKV.

Change-Id: Iedb5f4a5521abcf09cd1c3a071cced8717ac8418
Print debug metadata only when AGM_DEBUG_METADATA is
enabled. This helps to avoid printing unnecessary debug log.

Change-Id: I75c18d3fdc44041a6f3b4c8413216336334cb6c8
Change-Id: I838293073c3fe83ae03bdb1bce31e515683546e0
- Add support for PCM formats in backend_conf.xml so that backend can be
  configured based on format present in backend_conf.xml. This adds support
  for different formats like S24_LE and S24_3LE for which bitwidth is same but
  bits per sample is different.
- If format is present in backend_conf, update dev bitwidth based on format.
- Sample backend_conf.xml to show how to add format.

Change-Id: Ifbdb87d1da81bc7c5f08f48b16ee341688bbe996
…tion.

Add cmdline param is_24_LE support to distinguish between S24_LE
and S32_LE when bps for clip being played or clip being recorded is 32.

Change-Id: Id539ce1278a2a16aebc5ce8da7b9188104bdd56c
In scenarios where agm is waiting for early eos callback and AHAL issues flush
before callback is received, ADSP will only send eos callback and thread waiting
for early eos callback will remain blocked.

This change unblocks the call waiting for early eos callback after flush is
successful.

Change-Id: Id4bf0e1e92a51d7378f2b02827ecec04d37d51fb
Add proper copyright markings in the agmtest app files.

Change-Id: Ie762d57200812a08bdc3e3e6bab4dd65c04e1ff1
Update errno in amp_pcm_get_param_get to avoid false update of SSR down
in agm clients. When sound card is up after SSR, and this API is called,
and it fails because of some other error, errno is still -ENETRESET due
to some other APIs failure during SSR resulting in false report of SSR
down in agm clients.

Change-Id: If3b73a3b2a06c12108b8ec1456ad34fd28b1abc9
Fix out of bounds issues by increasing
buffer length

Change-Id: I868b5780d787129ce8faa8e4f54e213477899712
…r module

Configure the AAC encoder module only after configuring
the placeholder module. Although, configuration order
shouldn't matter because ADSP can cache the encoder
configuration and apply it when the placeholder is
configured. However, ADSP in other products need not
cache it.

Change-Id: I4b001d1a51fc7922437f554bcd6dbad7d7472d4c
Add NULL check in snd_card_def_get_card() before free the snd_card_name
to avoid segmentation fault.

Change-Id: Ic4c1ca873d5575cb918bced56d462e654ab3d4c9
early_eos callback to compress plugin was not going due to break in the loop
after calling the first callback from cb_pool.

cb_pool has callbacks registered from mixer_plugin as well as compress_plugin.
We do not have any way to know which callback is from mixer/compress plugin.
We will send EARLY_EOS callback to all the registered callbacks and rely on
their handling of whether callback is processed or ignored.

Change-Id: I3e664e6cabeca30da94afb66d111b10e8b4ff64f
Resetting val in function amp_create_pcm_info_from_card and
amp_get_pcm_info during PCM info propagation to fix an issue
when a PCM device doesn't have all its properties configured
in card-defs.xml. It can result a PCM device's direction to
be treated mistakenly, which could cause duplicated session
callbacks to be registered and duplicated event callbacks.

Change-Id: I2a3813c19210120183e2b962554a94491aa435ba
Print session_id along with aif_id while printing session aif
metadata for better debugging. Also, move metadata_print in
graph_change to top.

Change-Id: I80c2a02da83b0bc687601dd5d1edfc25cd41911a
In the compress capture, client may want to have
customized global cut-off frequency for the overall
encoding session. Thus, introduce the optional
configuration for AAC encoder.

Change-Id: I603f87b14cc04fea83a5732f31d8488d4c21d3e7
Add relevant AAC encoder types and exclusive
compress capture session mode in the HIDL
interface. Hence, update types interface hash.

Change-Id: I21795f761d84b1bb574eb37f652d2fd62f335e4b
qti-sbojja and others added 27 commits April 21, 2026 22:17
The async DBus write path could copy more data than the allocated
buffer size, corrupting heap metadata and triggering glibc aborts
such as "malloc(): unaligned tcache chunk detected".

Allocate/reallocate the buffer during session_set_config when the
requested size changes, and release it on session_close. This
prevents buffer overflow/double-free scenarios that corrupt the heap.

Change-Id: Id1985a06b5d1948158d4686d8e7408261f8a078f
Signed-off-by: Sairamreddy Bojja <sbojja@qti.qualcomm.com>
Replace ATOMIC_VAR_INIT(false) with direct init.
ATOMIC_VAR_INIT depends on C11 stdatomic support and
may cause build failures when C11 is not fully enabled.
This issue was exposed when the related change was
upstreamed to GitHub. Initializing atomic_bool with
false improves build compatibility across different
toolchains.

Change-Id: Ibd91b8e0e2ec0289627e44867de83cbe167123de
Add nullptr checks for capture interface name, playback interface
name to exit the test app if any of these are null in agmhostless
test app.
Add nullptr check before freeing payloadInfo in agmmixer test app.

Change-Id: Ia37913de5d1e8cbbf61e5657ec36e2462f8c89ec
- Replaced "Qualcomm Innovation Center, Inc." with
  "Qualcomm Technologies, Inc. and/or its subsidiaries"
  across multiple source files.
- Update SPDX identifier from BSD-3-Clause-Clear to BSD-3-Clause

Change-Id: I2b13983d09c9e7a4f0bac97180992fb7321e0ae0
Signed-off-by: Radhika Garg <radhgarg@qti.qualcomm.com>
Validate filename for invalid path traversal for fopen
in agmplay, agmcap, agmcompressplay and add restriction
for filename to be present in /data directory.

Change-Id: Iaaaac1890a9b05bcecef0678c4aaf077484c206b
Remove extra %s from usage() in agmplay, agmcap and
agmhostless files.

Change-Id: I6b26ff17a963c4c355cc2a6ca0e128fa99020ea1
agm_pcm_plugin_update_hw_ptr floors the DSP write position to the
nearest period boundary (position % period_size == 0), causing up to
(period_size - 1) frames of valid audio to be silently lost on every
ForceRecognition call in HIST_CAP batch mode.

Add is_hist_cap flag to agm_pcm_priv, set via SNDRV_PCM_IOCTL_RESET
arg from PAL. Use pos = circ_buf_pos directly for HIST_CAP streams
to return the exact DSP write position. Original floor behaviour is
preserved for all other stream types.

Change-Id: I2099660ec855de1e684dcb3d6ebfac96fa38aaa6
1. Add CODEC_DMA intf_idx support for indices 8-14 in
   populate_hw_ep_intf_idx() to fix parse failures for
   CODEC_DMA-QAIF-RX-{8,9,10,11,12,14} backends.

2. Fix parse_virtual_snd_card() to not call
   populate_device_hw_ep_info() for virtual/frontend devices.
   Change default value of is_backend from 1 to 0 so that
   only nodes explicitly marked with backend=1 in card-defs.xml
   are treated as hardware backends.

Change-Id: I4df5d9399b05bb0b0556df587957e98be73d9e14
This reverts commit be1642b.

Reason for revert: VoiceUI regressions

Change-Id: Ic7e791d280115da880bfae1013800691768daba3
The tinyalsa AGM plugin closes data and position buffer fds during
pcm close handling. After the recent framework path updates, those
fds are managed by AGM service side ownership and can be reused or
released there.

Keeping local close() calls in the plugin can cause double close
issues once AGM cleanup runs. Remove explicit close() of data and
position buffer fds while retaining existing unmap and memory free
behavior.

Change-Id: Id8c3cbf73e5cf49f9a048eeb9842b5a4f530ef4b
agm_pcm_plugin_update_hw_ptr floors the DSP write position to the
nearest period boundary ((circ_buf_pos / period_size) * period_size),
causing up to (period_size - 1) frames of valid audio to be silently
discarded on every hw_ptr update.

Use pos = circ_buf_pos directly to return the exact DSP write position
instead of the floored period boundary.

Change-Id: Iab05140b2d263b173a30390c4ad3c2285611ce20
Initialize num_aif_info to 0 in ipc_agm_get_aif_info_list() to prevent
passing uninitialized/garbage values to the AGM API.

Change-Id: I04f3e25a351513d55f929d47e394da81be507f74
Signed-off-by: Sairamreddy Bojja <sbojja@qti.qualcomm.com>
Lower period_bytes.min from 96 to 16 bytes to support ULL
MMAP capture rates down to 8 kHz and avoid incorrectly
clamping sub-48 kHz streams.
The 96-byte floor forced a period mismatch between the DSP
producer and client consumer, causing previously delivered
PCM data to be re-presented and resulting in duplicated
capture audio.
The actual period size is still derived from the HAL buffer
configuration, so existing 48 kHz and other working use
cases remain unaffected.

Change-Id: Iadc879ea44ce5452378509adbe6ce4e5dbc35879
Update the build configuration, including the use
of USE_GLIB and USE_G_STR_FUNC to control glib
usage, USE_SYSLOG for syslog, and CUTILS_SUPPORTED
for cutils.

Add support for configuring period_size and n_periods
parameters in agmplay.

Change-Id: I6ea66e4863bff1e1a18417325a46e20ac284b4df
registerCallback linked to death with the ClientInfo* itself as
cookie. Since one client can have multiple death links sharing
that cookie, a second/duplicate obituary could dereference the
cookie after the first one already freed the object via
removeClient, causing a use-after-free crash.

Encode the client's pid instead of the ClientInfo* as the death
recipient cookie. onDeath decodes the pid and calls the already
idempotent removeClient(pid), so it never touches memory that a
prior obituary may have freed.

Change-Id: Iebb591d6c7d66c9c288ed1ead33d413d5aee7811
graph_get_tckv_data_from_acdb() builds param_list as a list of 32-bit
words [module_instance_id, num_params, param_id] that is handed to
gsl_get/set_*_data_from_acdb(). The GCC 14.2 typecast cleanup
(Change-Id I5af6858005c8a148a76a47677dc32a837e55031b, "agm: service:
fix typecasting issues for GCC 14.2") changed its declaration from
uint32_t* to uint8_t*, which truncates each 32-bit field to its low
byte. The ACDB query is then built with a corrupt module_instance_id
(e.g. 0x0026016e instead of 0x416e), ACDB reports "module instance not
found", and the call fails with -68.

This breaks GEF (Generic Effects Framework) effect reads over the ACDB
tunnel: the catf equalizer test aborts with an uncaught
HALTestSUTException (pal_gef_rw_param failed, returned -68).

Restore param_list to uint32_t* so the fields are written full-width.
The (uint8_t *)param_list casts already present at the gsl_*_from_acdb
call sites keep the GCC 14.2 typecast fix intact.

Tested on hamoa_la (COMPUTE.LA.1.0): the CATF QAL test
pcm_playback_pcm_offload_equalizer_acdb_on_2ch_16bit_48khz_on_spkr.xml
now returns Result=pass; previously it crashed with SIGABRT.

Compilation verified with GCC 14.2 via the upstream AudioReach PR for
the same change (GitHub CI build matrix green):
AudioReach#129

CRs-Fixed: 4637358
Change-Id: I6faabf0e9af549b1daa4318cc5a43bf67f9e2849
Update the build configuration, including the use
of USE_GLIB and USE_G_STR_FUNC to control glib
usage, USE_SYSLOG for syslog, and CUTILS_SUPPORTED
for cutils.

Add support for configuring period_size and n_periods
parameters in agmplay.

Signed-off-by: svutukur <svutukur@qti.qualcomm.com>
@svutukur20
svutukur20 requested review from a team September 12, 2026 06:05
Signed-off-by: svutukur20 <svutukur@qti.qualcomm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.