[Sound-open-firmware] [PATCH 1/3] heap: byt: balance heap block size map
Balance the heap block map size out to better fit real world usage by reducing small blocks to create extra larger blocks.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/platform/baytrail/include/platform/memory.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/platform/baytrail/include/platform/memory.h b/src/platform/baytrail/include/platform/memory.h index 6bd0e78..c6a1301 100644 --- a/src/platform/baytrail/include/platform/memory.h +++ b/src/platform/baytrail/include/platform/memory.h @@ -100,11 +100,11 @@
/* Heap section sizes for module pool */ #define HEAP_RT_COUNT8 0 -#define HEAP_RT_COUNT16 256 -#define HEAP_RT_COUNT32 128 +#define HEAP_RT_COUNT16 64 +#define HEAP_RT_COUNT32 64 #define HEAP_RT_COUNT64 64 -#define HEAP_RT_COUNT128 32 -#define HEAP_RT_COUNT256 16 +#define HEAP_RT_COUNT128 64 +#define HEAP_RT_COUNT256 64 #define HEAP_RT_COUNT512 8 #define HEAP_RT_COUNT1024 4
Make sure we validate all config and params variables and complain if there are omissions or errors.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/audio/src.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-)
diff --git a/src/audio/src.c b/src/audio/src.c index 5dd8345..0344bed 100644 --- a/src/audio/src.c +++ b/src/audio/src.c @@ -256,6 +256,12 @@ static struct comp_dev *src_new(struct sof_ipc_comp *comp)
trace_src("new");
+ /* validate init data - either SRC sink or source rate must be set */ + if (ipc_src->source_rate == 0 && ipc_src->sink_rate == 0) { + trace_src_error("sn1"); + return NULL; + } + dev = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, COMP_SIZE(struct sof_ipc_comp_src)); if (dev == NULL) @@ -305,13 +311,15 @@ static int src_params(struct comp_dev *dev) size_t delay_lines_size; uint32_t source_rate, sink_rate; int32_t *buffer_start; - int n = 0, i; + int n = 0, i, err;
trace_src("par");
/* SRC supports only S32_LE PCM format */ - if (config->frame_fmt != SOF_IPC_FRAME_S32_LE) + if (config->frame_fmt != SOF_IPC_FRAME_S32_LE) { + trace_src_error("sr0"); return -EINVAL; + }
/* Calculate source and sink rates, one rate will come from IPC new * and the other from params. */ @@ -330,14 +338,31 @@ static int src_params(struct comp_dev *dev) }
/* Allocate needed memory for delay lines */ - src_buffer_lengths(&need, source_rate, sink_rate, params->channels); + err = src_buffer_lengths(&need, source_rate, sink_rate, params->channels); + if (err < 0) { + trace_src_error("sr1"); + trace_value(source_rate); + trace_value(sink_rate); + trace_value(params->channels); + return err; + } + delay_lines_size = sizeof(int32_t) * need.total; + if (delay_lines_size == 0) { + trace_src_error("sr2"); + return -EINVAL; + } + + /* free any existing dalay lines. TODO reuse if same size */ if (cd->delay_lines != NULL) rfree(cd->delay_lines);
cd->delay_lines = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, delay_lines_size); - if (cd->delay_lines == NULL) + if (cd->delay_lines == NULL) { + trace_src_error("sr3"); + trace_value(delay_lines_size); return -EINVAL; + }
/* Clear all delay lines here */ memset(cd->delay_lines, 0, delay_lines_size);
delay lines are typically several kB in size so use buffer allocator.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/audio/src.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/audio/src.c b/src/audio/src.c index 0344bed..c11ef3f 100644 --- a/src/audio/src.c +++ b/src/audio/src.c @@ -357,7 +357,7 @@ static int src_params(struct comp_dev *dev) if (cd->delay_lines != NULL) rfree(cd->delay_lines);
- cd->delay_lines = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, delay_lines_size); + cd->delay_lines = rballoc(RZONE_RUNTIME, RFLAGS_NONE, delay_lines_size); if (cd->delay_lines == NULL) { trace_src_error("sr3"); trace_value(delay_lines_size);
participants (1)
-
Liam Girdwood