From 935799d63f0d654f350a640001077616572a4b63 Mon Sep 17 00:00:00 2001 From: jpadmana Date: Tue, 25 Jun 2013 14:48:49 +0530 Subject: [PATCH] Addition of EFFECT_CMD_OFFLOAD for effects offload Added EFFECT_CMD_OFFLOAD command to audio effect control interface. It is used by the framework to indicate if the playback thread the effect is attached to is offloaded of not. Added effect flag EFFECT_FLAG_OFFLOAD_SUPPORTED indicating if the effect implementation supports offloading to a DSP. Change-Id: I26553576657d3aa9cd0cdcd5785c813b02f48136 Signed-off-by: jpadmana Signed-off-by: Eric Laurent --- include/hardware/audio_effect.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/include/hardware/audio_effect.h b/include/hardware/audio_effect.h index 2940b1af..b49d02d6 100644 --- a/include/hardware/audio_effect.h +++ b/include/hardware/audio_effect.h @@ -147,6 +147,9 @@ typedef struct effect_descriptor_s { // | | | 1 requires audio source updates // | | | 2..3 reserved // +---------------------------+-----------+----------------------------------- +// | Effect offload supported | 22 | 0 The effect cannot be offloaded to an audio DSP +// | | | 1 The effect can be offloaded to an audio DSP +// +---------------------------+-----------+----------------------------------- // Insert mode #define EFFECT_FLAG_TYPE_SHIFT 0 @@ -229,6 +232,14 @@ typedef struct effect_descriptor_s { #define EFFECT_FLAG_AUDIO_SOURCE_IND (1 << EFFECT_FLAG_AUDIO_SOURCE_SHIFT) #define EFFECT_FLAG_AUDIO_SOURCE_NONE (0 << EFFECT_FLAG_AUDIO_SOURCE_SHIFT) +// Effect offload indication +#define EFFECT_FLAG_OFFLOAD_SHIFT (EFFECT_FLAG_AUDIO_SOURCE_SHIFT + \ + EFFECT_FLAG_AUDIO_SOURCE_SIZE) +#define EFFECT_FLAG_OFFLOAD_SIZE 1 +#define EFFECT_FLAG_OFFLOAD_MASK (((1 << EFFECT_FLAG_OFFLOAD_SIZE) -1) \ + << EFFECT_FLAG_OFFLOAD_SHIFT) +#define EFFECT_FLAG_OFFLOAD_SUPPORTED (1 << EFFECT_FLAG_OFFLOAD_SHIFT) + #define EFFECT_MAKE_API_VERSION(M, m) (((M)<<16) | ((m) & 0xFFFF)) #define EFFECT_API_VERSION_MAJOR(v) ((v)>>16) #define EFFECT_API_VERSION_MINOR(v) ((m) & 0xFFFF) @@ -426,6 +437,8 @@ enum effect_command_e { EFFECT_CMD_GET_FEATURE_CONFIG, // get current feature configuration EFFECT_CMD_SET_FEATURE_CONFIG, // set current feature configuration EFFECT_CMD_SET_AUDIO_SOURCE, // set the audio source (see audio.h, audio_source_t) + EFFECT_CMD_OFFLOAD, // set if effect thread is an offload one, + // send the ioHandle of the effect thread EFFECT_CMD_FIRST_PROPRIETARY = 0x10000 // first proprietary command code }; @@ -732,6 +745,20 @@ enum effect_command_e { // size: 0 // data: N/A //================================================================================================== +// command: EFFECT_CMD_OFFLOAD +//-------------------------------------------------------------------------------------------------- +// description: +// 1.indicate if the playback thread the effect is attached to is offloaded or not +// 2.update the io handle of the playback thread the effect is attached to +//-------------------------------------------------------------------------------------------------- +// command format: +// size: sizeof(effect_offload_param_t) +// data: effect_offload_param_t +//-------------------------------------------------------------------------------------------------- +// reply format: +// size: sizeof(uint32_t) +// data: uint32_t +//-------------------------------------------------------------------------------------------------- // command: EFFECT_CMD_FIRST_PROPRIETARY //-------------------------------------------------------------------------------------------------- // description: @@ -868,6 +895,11 @@ typedef struct effect_param_s { char data[]; // Start of Parameter + Value data } effect_param_t; +// structure used by EFFECT_CMD_OFFLOAD command +typedef struct effect_offload_param_s { + bool isOffload; // true if the playback thread the effect is attached to is offloaded + int ioHandle; // io handle of the playback thread the effect is attached to +} effect_offload_param_t; /////////////////////////////////////////////////