All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, Vinod Koul <vinod.koul@linux.intel.com>,
	broonie@opensource.wolfsonmicro.com,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Subject: [PATCH v5 1/6] compress offload API documentation
Date: Fri, 23 Dec 2011 10:36:35 +0530	[thread overview]
Message-ID: <1324616800-19749-2-git-send-email-vinod.koul@linux.intel.com> (raw)
In-Reply-To: <1323070791-12620-1-git-send-email-vinod.koul@linux.intel.com>

From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

The patch adds the documentation file explaining the API

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
---
 Documentation/sound/alsa/compress_offload.txt |  188 +++++++++++++++++++++++++
 1 files changed, 188 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/sound/alsa/compress_offload.txt

diff --git a/Documentation/sound/alsa/compress_offload.txt b/Documentation/sound/alsa/compress_offload.txt
new file mode 100644
index 0000000..c83a835
--- /dev/null
+++ b/Documentation/sound/alsa/compress_offload.txt
@@ -0,0 +1,188 @@
+		compress_offload.txt
+		=====================
+	Pierre-Louis.Bossart <pierre-louis.bossart@linux.intel.com>
+		Vinod Koul <vinod.koul@linux.intel.com>
+
+Overview
+
+Since its early days, the ALSA API was defined with PCM support or
+constant bitrates payloads such as IEC61937 in mind. Arguments and
+returned values in frames are the norm, making it a challenge to
+extend the existing API to compressed data streams.
+
+In recent years, audio digital signal processors (DSP) were integrated
+in system-on-chip designs, and DSPs are also integrated in audio
+codecs. Processing compressed data on such DSPs results in a dramatic
+reduction of power consumption compared to host-based
+processing. Support for such hardware has not been very good in Linux,
+mostly because of a lack of a generic API available in the mainline
+kernel.
+
+Rather than requiring a compability break with an API change of the
+ALSA PCM interface, a new 'Compressed Data' API is introduced to
+provide a control and data-streaming interface for audio DSPs.
+
+The design of this API was inspired by the 2-year experience with the
+Intel Moorestown SOC, with many corrections required to upstream the
+API in the mainline kernel instead of the staging tree and make it
+usable by others.
+
+Requirements
+
+The main requirements are:
+
+- separation between byte counts and time. Compressed formats may have
+  a header per file, per frame, or no header at all. The payload size
+  may vary from frame-to-frame. As a result, it is not possible to
+  estimate reliably the duration of audio buffers when handling
+  compressed data. Dedicated mechanisms are required to allow for
+  reliable audio-video synchronization, which requires precise
+  reporting of the number of samples rendered at any given time.
+
+- Handling of multiple formats. PCM data only requires a specification
+  of the sampling rate, number of channels and bits per sample. In
+  contrast, compressed data comes in a variety of formats. Audio DSPs
+  may also provide support for a limited number of audio encoders and
+  decoders embedded in firmware, or may support more choices through
+  dynamic download of libraries.
+
+- Focus on main formats. This API provides support for the most
+  popular formats used for audio and video capture and playback. It is
+  likely that as audio compression technology advances, new formats
+  will be added.
+
+- Handling of multiple configurations. Even for a given format like
+  AAC, some implementations may support AAC multichannel but HE-AAC
+  stereo. Likewise WMA10 level M3 may require too much memory and cpu
+  cycles. The new API needs to provide a generic way of listing these
+  formats.
+
+- Rendering/Grabbing only. This API does not provide any means of
+  hardware acceleration, where PCM samples are provided back to
+  user-space for additional processing. This API focuses instead on
+  streaming compressed data to a DSP, with the assumption that the
+  decoded samples are routed to a physical output or logical back-end.
+
+ - Complexity hiding. Existing user-space multimedia frameworks all
+  have existing enums/structures for each compressed format. This new
+  API assumes the existence of a platform-specific compatibility layer
+  to expose, translate and make use of the capabilities of the audio
+  DSP, eg. Android HAL or PulseAudio sinks. By construction, regular
+  applications are not supposed to make use of this API.
+
+
+Design
+
+The new API shares a number of concepts with with the PCM API for flow
+control. Start, pause, resume, drain and stop commands have the same
+semantics no matter what the content is.
+
+The concept of memory ring buffer divided in a set of fragments is
+borrowed from the ALSA PCM API. However, only sizes in bytes can be
+specified.
+
+Seeks/trick modes are assumed to be handled by the host.
+
+The notion of rewinds/forwards is not supported. Data committed to the
+ring buffer cannot be invalidated, except when dropping all buffers.
+
+The Compressed Data API does not make any assumptions on how the data
+is transmitted to the audio DSP. DMA transfers from main memory to an
+embedded audio cluster or to a SPI interface for external DSPs are
+possible. As in the ALSA PCM case, a core set of routines is exposed;
+each driver implementer will have to write support for a set of
+mandatory routines and possibly make use of optional ones.
+
+The main additions are
+
+- get_caps
+This routine returns the list of audio formats supported. Querying the
+codecs on a capture stream will return encoders, decoders will be
+listed for playback streams.
+
+- get_codec_caps For each codec, this routine returns a list of
+capabilities. The intent is to make sure all the capabilities
+correspond to valid settings, and to minimize the risks of
+configuration failures. For example, for a complex codec such as AAC,
+the number of channels supported may depend on a specific profile. If
+the capabilities were exposed with a single descriptor, it may happen
+that a specific combination of profiles/channels/formats may not be
+supported. Likewise, embedded DSPs have limited memory and cpu cycles,
+it is likely that some implementations make the list of capabilities
+dynamic and dependent on existing workloads. In addition to codec
+settings, this routine returns the minimum buffer size handled by the
+implementation. This information can be a function of the DMA buffer
+sizes, the number of bytes required to synchronize, etc, and can be
+used by userspace to define how much needs to be written in the ring
+buffer before playback can start.
+
+- set_params
+This routine sets the configuration chosen for a specific codec. The
+most important field in the parameters is the codec type; in most
+cases decoders will ignore other fields, while encoders will strictly
+comply to the settings
+
+- get_params
+This routines returns the actual settings used by the DSP. Changes to
+the settings should remain the exception.
+
+- get_timestamp
+The timestamp becomes a multiple field structure. It lists the number
+of bytes transferred, the number of samples processed and the number
+of samples rendered/grabbed. All these values can be used to determine
+the avarage bitrate, figure out if the ring buffer needs to be
+refilled or the delay due to decoding/encoding/io on the DSP.
+
+Note that the list of codecs/profiles/modes was derived from the
+OpenMAX AL specification instead of reinventing the wheel.
+Modifications include:
+- Addition of FLAC and IEC formats
+- Merge of encoder/decoder capabilities
+- Profiles/modes listed as bitmasks to make descriptors more compact
+- Addition of set_params for decoders (missing in OpenMAX AL)
+- Addition of AMR/AMR-WB encoding modes (missing in OpenMAX AL)
+- Addition of format information for WMA
+- Addition of encoding options when required (derived from OpenMAX IL)
+- Addition of rateControlSupported (missing in OpenMAX AL)
+
+Not supported:
+
+- Support for VoIP/circuit-switched calls is not the target of this
+  API. Support for dynamic bit-rate changes would require a tight
+  coupling between the DSP and the host stack, limiting power savings.
+
+- Packet-loss concealment is not supported. This would require an
+  additional interface to let the decoder synthesize data when frames
+  are lost during transmission. This may be added in the future.
+
+- Volume control/routing is not handled by this API. Devices exposing a
+  compressed data interface will be considered as regular ALSA devices;
+  volume changes and routing information will be provided with regular
+  ALSA kcontrols.
+
+- Embedded audio effects. Such effects should be enabled in the same
+  manner, no matter if the input was PCM or compressed.
+
+- multichannel IEC encoding. Unclear if this is required.
+
+- Encoding/decoding acceleration is not supported as mentioned
+  above. It is possible to route the output of a decoder to a capture
+  stream, or even implement transcoding capabilities. This routing
+  would be enabled with ALSA kcontrols.
+
+- Audio policy/resource management. This API does not provide any
+  hooks to query the utilization of the audio DSP, nor any premption
+  mechanisms.
+
+- No notion of underun/overrun. Since the bytes written are compressed
+  in nature and data written/read doesn't translate directly to
+  rendered output in time, this does not deal with underrun/overun and
+  maybe dealt in user-library
+
+Credits:
+- Mark Brown and Liam Girdwood for discussions on the need for this API
+- Harsha Priya for her work on intel_sst compressed API
+- Rakesh Ughreja for valuable feedback
+- Sing Nallasellan, Sikkandar Madar and Prasanna Samaga for
+  demonstrating and quantifying the benefits of audio offload on a
+  real platform.
-- 
1.7.0.4

  parent reply	other threads:[~2011-12-23  5:06 UTC|newest]

Thread overview: 133+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-02  6:06 [RFC 0/5] compress: add compress data API to ALSA kernel Vinod Koul
2011-09-02  6:06 ` [RFC 1/5] compress API documentation Vinod Koul
2011-09-02  6:06 ` [RFC 2/5] compress: add compress parameter definations Vinod Koul
2011-09-02  6:49   ` Paul Menzel
2011-09-02 19:54     ` Pierre-Louis Bossart
2011-09-03  6:28       ` Mark Brown
2011-09-02 14:19   ` Mark Brown
2011-09-02 19:26     ` Pierre-Louis Bossart
2011-09-03  0:05       ` Mark Brown
2011-09-02  6:06 ` [RFC 3/5] compress: add API header and driver header files Vinod Koul
2011-09-02 13:36   ` Clemens Ladisch
2011-09-03  2:59     ` Vinod Koul
2011-09-02  6:06 ` [RFC 4/5] compress: add the core file Vinod Koul
2011-09-02 14:36   ` Mark Brown
2011-09-03  3:06     ` Vinod Koul
2011-09-05 17:43       ` Mark Brown
2011-09-05 21:21         ` Vinod Koul
2011-09-07 13:59   ` Dimitris Papastamos
2011-09-07 14:12     ` Dimitris Papastamos
2011-09-07 18:00       ` Vinod Koul
2011-09-07 15:20   ` Dimitris Papastamos
2011-09-07 18:05     ` Vinod Koul
2011-09-08 10:38   ` Dimitris Papastamos
2011-09-08 23:18     ` Vinod Koul
2011-09-22 13:01   ` Dimitris Papastamos
2011-09-23  5:41     ` Vinod Koul
2011-09-23 11:07       ` Vinod Koul
2011-09-02  6:06 ` [RFC 5/5] compress: add makefile and kconfig file Vinod Koul
2011-09-02 11:30 ` [RFC 0/5] compress: add compress data API to ALSA kernel Mark Brown
2011-09-02 14:04   ` Pierre-Louis Bossart
     [not found]   ` <000601cc6979$437b11c0$ca713540$@bossart@linux.intel.com>
2011-09-02 14:23     ` Mark Brown
2011-11-22  8:51 ` [PATCH 0/6] " Vinod Koul
2011-12-05  7:39   ` [PATCH v3 0/6] core: " Vinod Koul
2011-12-06  7:27     ` Jassi Brar
2011-12-06  8:07       ` Vinod Koul
2011-12-07 10:04     ` Vinod Koul
2011-12-07 16:15       ` Mark Brown
2011-12-13  9:02     ` [PATCH v4 " Vinod Koul
2011-12-13  9:02     ` [PATCH v4 1/6] compress API documentation Vinod Koul
2011-12-13  9:02     ` [PATCH v4 2/6] core: add support for compressed devices Vinod Koul
2011-12-22  7:34       ` Takashi Iwai
2011-12-22  8:15         ` Vinod Koul
2011-12-13  9:02     ` [PATCH v4 3/6] core: add compress parameter definations Vinod Koul
2011-12-22  7:35       ` Takashi Iwai
2011-12-22  8:16         ` Vinod Koul
2011-12-13  9:02     ` [PATCH v4 4/6] core: add API header and driver header files Vinod Koul
2011-12-13  9:02     ` [PATCH v4 5/6] core: add support for compress_offload Vinod Koul
2011-12-13 12:48       ` Nallasellan, Singaravelan
2011-12-13 14:12         ` Vinod Koul
2011-12-13 16:02           ` Nallasellan, Singaravelan
2011-12-13 17:53             ` Vinod Koul
2011-12-14  5:17               ` Nallasellan, Singaravelan
2011-12-20  9:26                 ` Vinod Koul
2011-12-22  7:55       ` Takashi Iwai
2011-12-22  8:19         ` Vinod Koul
2011-12-22  8:27           ` Takashi Iwai
2011-12-22  8:31             ` Vinod Koul
2011-12-22  8:44               ` Takashi Iwai
2011-12-22  8:48                 ` Vinod Koul
2011-12-22  8:51                   ` Takashi Iwai
2011-12-13  9:03     ` [PATCH v4 6/6] core: add makefile and kconfig file for compress Vinod Koul
2011-12-23  5:06     ` [PATCH v5 0/6] core: add compress data API to ALSA kernel Vinod Koul
2011-12-23  9:37       ` Takashi Iwai
2011-12-23 11:37         ` Vinod Koul
2011-12-23  5:06     ` Vinod Koul [this message]
2011-12-23  5:06     ` [PATCH v5 2/6] core: add support for compressed devices Vinod Koul
2011-12-23  5:06     ` [PATCH v5 3/6] core: add compress parameter definations Vinod Koul
2011-12-23  5:06     ` [PATCH v5 4/6] core: add API header and driver header files Vinod Koul
2011-12-23  5:06     ` [PATCH v5 5/6] core: add support for compress_offload Vinod Koul
2011-12-23  5:06     ` [PATCH v5 6/6] core: add makefile and kconfig file for compress Vinod Koul
2011-12-05  7:39   ` [PATCH v3 1/6] compress API documentation Vinod Koul
2011-12-05  7:39   ` [PATCH v3 2/6] core: add support for compressed devices Vinod Koul
2011-12-05  7:39   ` [PATCH v3 3/6] core: add compress parameter definations Vinod Koul
2011-12-05  7:39   ` [PATCH v3 4/6] core: add API header and driver header files Vinod Koul
2011-12-13  6:11     ` Mark Brown
2011-12-13  6:31       ` Vinod Koul
2011-12-13  7:03         ` Takashi Iwai
2011-12-13  7:50           ` Vinod Koul
2011-12-13  7:53             ` Mark Brown
2011-12-13  9:03               ` Vinod Koul
2011-12-05  7:39   ` [PATCH v3 5/6] core: add support for compress_offload Vinod Koul
2011-12-13  6:09     ` Mark Brown
2011-12-13  6:29       ` Vinod Koul
2011-12-05  7:39   ` [PATCH v3 6/6] core: add makefile and kconfig file for compress Vinod Koul
2011-11-22  8:51 ` [PATCH 1/6] compress API documentation Vinod Koul
2011-11-22  8:51 ` [PATCH 2/6] core: add support for compressed devices Vinod Koul
2011-11-23 11:30   ` Mark Brown
2011-11-22  8:51 ` [PATCH 3/6] compress: add compress parameter definations Vinod Koul
2011-11-23 16:32   ` Mark Brown
2011-11-22  8:51 ` [PATCH 4/6] compress: add API header and driver header files Vinod Koul
2011-11-22 11:18   ` Clemens Ladisch
2011-11-22 13:14     ` Vinod Koul
2011-12-02 15:39   ` Nallasellan, Singaravelan
2011-12-02 18:58     ` Pierre-Louis Bossart
     [not found]     ` <000301ccb124$72a53370$57ef9a50$@bossart@linux.intel.com>
2011-12-04  7:41       ` Nallasellan, Singaravelan
2011-12-05 14:14         ` Pierre-Louis Bossart
     [not found]         ` <000001ccb358$2b9e4b70$82dae250$@bossart@linux.intel.com>
2011-12-05 14:19           ` Mark Brown
2011-12-06  2:55             ` Nallasellan, Singaravelan
2011-11-22  8:51 ` [PATCH 5/6] compress: add the core file Vinod Koul
2011-11-23 16:02   ` Mark Brown
2011-11-23 16:16     ` Vinod Koul
2011-11-23 16:31       ` Mark Brown
2011-11-23 16:34         ` Vinod Koul
2011-11-23 17:03   ` Takashi Iwai
2011-11-24  3:45     ` Vinod Koul
2011-11-24  8:51       ` Takashi Iwai
2011-11-24  9:32         ` Vinod Koul
2011-11-28 21:36           ` Pierre-Louis Bossart
     [not found]           ` <001201ccae15$c24d8bf0$46e8a3d0$@bossart@linux.intel.com>
2011-11-29  7:21             ` Takashi Iwai
2011-11-29 21:15               ` Pierre-Louis Bossart
     [not found]               ` <003001ccaedb$f4e30010$dea90030$@bossart@linux.intel.com>
2011-11-30 10:30                 ` Mark Brown
2011-11-30 11:19                 ` Takashi Iwai
2011-11-30 11:29                   ` Vinod Koul
2011-11-30 11:41                     ` Takashi Iwai
2011-11-30 12:00                       ` Vinod Koul
2011-11-28 21:19     ` Pierre-Louis Bossart
     [not found]     ` <000f01ccae13$78fe38c0$6afaaa40$@bossart@linux.intel.com>
2011-11-29  7:31       ` Takashi Iwai
2011-12-01 13:28       ` Nallasellan, Singaravelan
2011-12-02  6:44         ` Vinod Koul
2011-12-02 10:17           ` Nallasellan, Singaravelan
2011-12-02 11:48             ` Vinod Koul
2011-12-02 16:24   ` Nallasellan, Singaravelan
2011-12-04  4:31     ` Vinod Koul
2011-12-04  8:14       ` Nallasellan, Singaravelan
2011-12-05 15:19         ` Pierre-Louis Bossart
     [not found]         ` <001501ccb361$3af49990$b0ddccb0$@bossart@linux.intel.com>
2011-12-06  3:00           ` Nallasellan, Singaravelan
2011-12-06  6:03             ` Vinod Koul
2011-12-06  8:07               ` Nallasellan, Singaravelan
2011-12-06 20:15             ` Pierre-Louis Bossart
     [not found]             ` <4ede780f.890bb50a.54a3.ffffcc4dSMTPIN_ADDED@mx.google.com>
     [not found]               ` <CAKg5Tpo6LgirbVVe9ZXNGN-xq7FTZvgAXNQ2HnXh=gwQHjn_Pw@mail.gmail.com>
2011-12-07 16:53                 ` Nallasellan, Singaravelan
2011-11-22  8:52 ` [PATCH 6/6] compress: add makefile and kconfig file Vinod Koul
2011-11-23 16:03   ` Mark Brown
2011-11-23 16:23     ` Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1324616800-19749-2-git-send-email-vinod.koul@linux.intel.com \
    --to=vinod.koul@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.