hal: Enable direct playback support for AUDIO_FORMAT_PCM_FLOAT
-Add changes to support PCM_FLOAT format using direct track.
-For targets supporting true 32 bit, convert FLOAT pcm data
to 32 bit.
-Targets which dont support true 32 bit, convert FLOAT or
32 bit input to 24 bit Packed in HAL.
Change-Id: I8052c8b878bbd4d70c0453df054953d494773b0a
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 9070478..c66fd38 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -75,15 +75,6 @@
#define MIN_COMPRESS_OFFLOAD_FRAGMENT_SIZE (2 * 1024)
#define COMPRESS_OFFLOAD_FRAGMENT_SIZE_FOR_AV_STREAMING (2 * 1024)
#define COMPRESS_OFFLOAD_FRAGMENT_SIZE (32 * 1024)
-/* Used in calculating fragment size for pcm offload */
-#define PCM_OFFLOAD_BUFFER_DURATION 40 /* 40 millisecs */
-
-/* MAX PCM fragment size cannot be increased further due
- * to flinger's cblk size of 1mb,and it has to be a multiple of
- * 24 - lcm of channels supported by DSP
- */
-#define MAX_PCM_OFFLOAD_FRAGMENT_SIZE (240 * 1024)
-#define MIN_PCM_OFFLOAD_FRAGMENT_SIZE 512
/*
* Offload buffer size for compress passthrough
@@ -91,8 +82,6 @@
#define MIN_COMPRESS_PASSTHROUGH_FRAGMENT_SIZE (2 * 1024)
#define MAX_COMPRESS_PASSTHROUGH_FRAGMENT_SIZE (8 * 1024)
-#define DIV_ROUND_UP(x, y) (((x) + (y) - 1)/(y))
-#define ALIGN(x, y) ((y) * DIV_ROUND_UP((x), (y)))
/*
* This file will have a maximum of 38 bytes:
*
@@ -208,6 +197,7 @@
} codec_backend_cfg_t;
static native_audio_prop na_props = {0, 0, 0};
+static bool supports_true_32_bit = false;
struct platform_data {
struct audio_device *adev;
@@ -2382,6 +2372,28 @@
return ret;
}
+static void true_32_bit_set_params(struct str_parms *parms,
+ char *value, int len)
+{
+ int ret = 0;
+
+ ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_TRUE_32_BIT,
+ value,len);
+ if (ret >= 0) {
+ if (value && !strncmp(value, "true", sizeof("src")))
+ supports_true_32_bit = true;
+ else
+ supports_true_32_bit = false;
+ str_parms_del(parms, AUDIO_PARAMETER_KEY_TRUE_32_BIT);
+ }
+
+}
+
+bool platform_supports_true_32bit()
+{
+ return supports_true_32_bit;
+}
+
int check_hdset_combo_device(snd_device_t snd_device)
{
int ret = false;
@@ -3610,6 +3622,7 @@
native_audio_set_params(platform, parms, value, sizeof(value));
audio_extn_spkr_prot_set_parameters(parms, value, len);
+ true_32_bit_set_params(parms, value, len);
ALOGV("%s: exit with code(%d)", __func__, ret);
return ret;
}
@@ -3984,33 +3997,6 @@
return fragment_size;
}
-uint32_t platform_get_pcm_offload_buffer_size(audio_offload_info_t* info)
-{
- uint32_t fragment_size = 0;
- uint32_t bytes_per_sample;
- uint32_t pcm_offload_time = PCM_OFFLOAD_BUFFER_DURATION;
-
- bytes_per_sample = audio_bytes_per_sample(info->format);
-
- //duration is set to 40 ms worth of stereo data at 48Khz
- //with 16 bit per sample, modify this when the channel
- //configuration is different
- fragment_size = (pcm_offload_time
- * info->sample_rate
- * bytes_per_sample
- * popcount(info->channel_mask))/1000;
- if(fragment_size < MIN_PCM_OFFLOAD_FRAGMENT_SIZE)
- fragment_size = MIN_PCM_OFFLOAD_FRAGMENT_SIZE;
- else if(fragment_size > MAX_PCM_OFFLOAD_FRAGMENT_SIZE)
- fragment_size = MAX_PCM_OFFLOAD_FRAGMENT_SIZE;
- // To have same PCM samples for all channels, the buffer size requires to
- // be multiple of (number of channels * bytes per sample)
- // For writes to succeed, the buffer must be written at address which is multiple of 32
- fragment_size = ALIGN(fragment_size, (bytes_per_sample * popcount(info->channel_mask) * 32));
-
- ALOGI("PCM offload Fragment size to %d bytes", fragment_size);
- return fragment_size;
-}
/*
* configures afe with bit width and Sample Rate