From b27354b10e10697afd1c7a31e1e726bd394200b2 Mon Sep 17 00:00:00 2001 From: Sharad Sangle Date: Thu, 18 Jun 2015 15:58:55 +0530 Subject: [PATCH] hal: compilation fix for extended feature flags - Fix compilation error for offload, Dolby, HDMI pass through, FLAC decoder, and hardware accelerated effects when extended feature flags are disabled. Change-Id: If64d5fa5d124b42d40d7e123b887db8e0a5d7426 --- hal/audio_extn/audio_extn.h | 7 +++++++ hal/audio_hw.c | 2 +- hal/msm8916/platform.c | 6 +++++- hal/msm8960/platform.c | 5 +++++ hal/msm8974/platform.c | 5 +++++ hal/platform_api.h | 1 + hal/voice.c | 1 + post_proc/Android.mk | 8 ++++++-- post_proc/bundle.c | 9 +++++++-- post_proc/bundle.h | 4 +++- post_proc/effect_api.c | 2 +- post_proc/effect_util.c | 1 + voice_processing/voice_processing.c | 1 + 13 files changed, 44 insertions(+), 8 deletions(-) diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h index 3e38d2ba..523a8759 100644 --- a/hal/audio_extn/audio_extn.h +++ b/hal/audio_extn/audio_extn.h @@ -46,6 +46,9 @@ #define AUDIO_FORMAT_PCM_24_BIT_OFFLOAD (AUDIO_FORMAT_PCM_OFFLOAD | AUDIO_FORMAT_PCM_SUB_8_24_BIT) #define AUDIO_OFFLOAD_CODEC_FORMAT "music_offload_codec_format" #define audio_is_offload_pcm(format) (0) +#define OFFLOAD_USE_SMALL_BUFFER false +#else +#define OFFLOAD_USE_SMALL_BUFFER (info->use_small_bufs) #endif #ifndef AFE_PROXY_ENABLED @@ -314,6 +317,9 @@ void audio_extn_check_and_set_dts_hpx_state(const struct audio_device *adev); void audio_extn_dolby_set_dmid(struct audio_device *adev); #else #define audio_extn_dolby_set_dmid(adev) (0) +#define AUDIO_CHANNEL_OUT_PENTA (AUDIO_CHANNEL_OUT_QUAD | AUDIO_CHANNEL_OUT_FRONT_CENTER) +#define AUDIO_CHANNEL_OUT_SURROUND (AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | \ + AUDIO_CHANNEL_OUT_FRONT_CENTER | AUDIO_CHANNEL_OUT_BACK_CENTER) #endif @@ -360,6 +366,7 @@ void audio_extn_dolby_send_ddp_endp_params(struct audio_device *adev); #define audio_extn_dolby_get_passt_buffer_size(info) (0) #define audio_extn_dolby_set_passt_volume(out, mute) (0) #define audio_extn_dolby_set_passt_latency(out, latency) (0) +#define AUDIO_OUTPUT_FLAG_COMPRESS_PASSTHROUGH 0x4000 #else int audio_extn_dolby_update_passt_formats(struct audio_device *adev, struct stream_out *out); diff --git a/hal/audio_hw.c b/hal/audio_hw.c index 435138df..7c3848b0 100644 --- a/hal/audio_hw.c +++ b/hal/audio_hw.c @@ -2903,7 +2903,7 @@ static int adev_open_output_stream(struct audio_hw_device *dev, if (flags & AUDIO_OUTPUT_FLAG_NON_BLOCKING) out->non_blocking = 1; - if (config->offload_info.use_small_bufs) { + if (platform_use_small_buffer(&config->offload_info)) { //this flag is set from framework only if its for PCM formats //no need to check for PCM format again out->non_blocking = 0; diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c index d12959de..765aea15 100644 --- a/hal/msm8916/platform.c +++ b/hal/msm8916/platform.c @@ -3345,7 +3345,7 @@ uint32_t platform_get_pcm_offload_buffer_size(audio_offload_info_t* info) bits_per_sample = 32; } - if (info->use_small_bufs) { + if (platform_use_small_buffer(info)) { pcm_offload_time = PCM_OFFLOAD_BUFFER_DURATION_FOR_SMALL_BUFFERS; } else { if (!info->has_video) { @@ -3609,6 +3609,10 @@ int platform_set_usecase_pcm_id(audio_usecase_t usecase, int32_t type, int32_t p done: return ret; } +bool platform_use_small_buffer(audio_offload_info_t* info) +{ + return OFFLOAD_USE_SMALL_BUFFER; +} void platform_get_device_to_be_id_map(int **device_to_be_id, int *length) { diff --git a/hal/msm8960/platform.c b/hal/msm8960/platform.c index 2065b54c..bceaf964 100644 --- a/hal/msm8960/platform.c +++ b/hal/msm8960/platform.c @@ -1107,6 +1107,11 @@ uint32_t platform_get_pcm_offload_buffer_size(audio_offload_info_t* info __unuse return 0; } +bool platform_use_small_buffer(audio_offload_info_t* info) +{ + return false; +} + int platform_get_edid_info(void *platform __unused) { return -ENOSYS; diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c index 4f908509..461c9a2f 100644 --- a/hal/msm8974/platform.c +++ b/hal/msm8974/platform.c @@ -3064,6 +3064,11 @@ uint32_t platform_get_pcm_offload_buffer_size(audio_offload_info_t* info) return fragment_size; } +bool platform_use_small_buffer(audio_offload_info_t* info) +{ + return OFFLOAD_USE_SMALL_BUFFER; +} + int platform_set_codec_backend_cfg(struct audio_device* adev, unsigned int bit_width, unsigned int sample_rate) { diff --git a/hal/platform_api.h b/hal/platform_api.h index 2f9af6cb..b2a0ccca 100644 --- a/hal/platform_api.h +++ b/hal/platform_api.h @@ -89,6 +89,7 @@ int platform_info_init(const char *filename); struct audio_offload_info_t; uint32_t platform_get_compress_offload_buffer_size(audio_offload_info_t* info); uint32_t platform_get_pcm_offload_buffer_size(audio_offload_info_t* info); +bool platform_use_small_buffer(audio_offload_info_t* info); uint32_t platform_get_compress_passthrough_buffer_size(audio_offload_info_t* info); bool platform_check_and_set_codec_backend_cfg(struct audio_device* adev, struct audio_usecase *usecase); diff --git a/hal/voice.c b/hal/voice.c index 9fc10815..c00df1ac 100644 --- a/hal/voice.c +++ b/hal/voice.c @@ -22,6 +22,7 @@ #define LOG_NDDEBUG 0 #include +#include #include #include #include diff --git a/post_proc/Android.mk b/post_proc/Android.mk index be70166a..ed46f17a 100644 --- a/post_proc/Android.mk +++ b/post_proc/Android.mk @@ -14,8 +14,12 @@ LOCAL_SRC_FILES:= \ virtualizer.c \ reverb.c \ effect_api.c \ - effect_util.c \ - hw_accelerator.c + effect_util.c + +ifeq ($(strip $(AUDIO_FEATURE_ENABLED_HW_ACCELERATED_EFFECTS)),true) + LOCAL_CFLAGS += -DHW_ACCELERATED_EFFECTS + LOCAL_SRC_FILES += hw_accelerator.c +endif LOCAL_CFLAGS+= -O2 -fvisibility=hidden diff --git a/post_proc/bundle.c b/post_proc/bundle.c index e38a41c8..c09d2adc 100644 --- a/post_proc/bundle.c +++ b/post_proc/bundle.c @@ -43,7 +43,7 @@ #include #include #include - +#include #include "bundle.h" #include "hw_accelerator.h" #include "equalizer.h" @@ -69,7 +69,9 @@ const effect_descriptor_t *descriptors[] = { &ins_env_reverb_descriptor, &aux_preset_reverb_descriptor, &ins_preset_reverb_descriptor, +#ifdef HW_ACCELERATED_EFFECTS &hw_accelerator_descriptor, +#endif NULL, }; @@ -604,6 +606,7 @@ int effect_lib_create(const effect_uuid_t *uuid, reverb_preset_init(reverb_ctxt); } reverb_ctxt->ctl = NULL; +#ifdef HW_ACCELERATED_EFFECTS } else if (memcmp(uuid, &hw_accelerator_descriptor.uuid, sizeof(effect_uuid_t)) == 0) { hw_accelerator_context_t *hw_acc_ctxt = (hw_accelerator_context_t *) @@ -625,6 +628,7 @@ int effect_lib_create(const effect_uuid_t *uuid, context->ops.process = hw_accelerator_process; context->desc = &hw_accelerator_descriptor; +#endif } else { return -EINVAL; } @@ -910,7 +914,7 @@ int effect_command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize, add_effect_to_output(out_ctxt, context); } break; - +#ifdef HW_ACCELERATED_EFFECTS case EFFECT_CMD_HW_ACC: { ALOGV("EFFECT_CMD_HW_ACC cmdSize %d pCmdData %p, *replySize %d, pReplyData %p", cmdSize, pCmdData, *replySize, pReplyData); @@ -925,6 +929,7 @@ int effect_command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize, context->hw_acc_enabled = (value > 0) ? true : false; break; } +#endif default: if (cmdCode >= EFFECT_CMD_FIRST_PROPRIETARY && context->ops.command) status = context->ops.command(context, cmdCode, cmdSize, diff --git a/post_proc/bundle.h b/post_proc/bundle.h index 06da991e..efe69eec 100644 --- a/post_proc/bundle.h +++ b/post_proc/bundle.h @@ -27,7 +27,9 @@ /* Retry for delay for mixer open */ #define RETRY_NUMBER 10 #define RETRY_US 500000 - +#ifdef HW_ACCELERATED_EFFECTS +#define EFFECT_CMD_HW_ACC 20 +#endif #define MIXER_CARD 0 #define SOUND_CARD 0 diff --git a/post_proc/effect_api.c b/post_proc/effect_api.c index 2fb79ed0..7aef9970 100644 --- a/post_proc/effect_api.c +++ b/post_proc/effect_api.c @@ -60,7 +60,7 @@ #include #include #include - +#include #include "effect_api.h" #ifdef DTS_EAGLE diff --git a/post_proc/effect_util.c b/post_proc/effect_util.c index 8f7a6049..b401f6ad 100644 --- a/post_proc/effect_util.c +++ b/post_proc/effect_util.c @@ -17,6 +17,7 @@ #include #include #include "effect_util.h" +#include #ifdef LOG_TAG #undef LOG_TAG diff --git a/voice_processing/voice_processing.c b/voice_processing/voice_processing.c index 1d18a3d2..bb9bf3bf 100644 --- a/voice_processing/voice_processing.c +++ b/voice_processing/voice_processing.c @@ -17,6 +17,7 @@ #define LOG_TAG "voice_processing" /*#define LOG_NDEBUG 0*/ #include +#include #include #include #include