From 0ecfb69fbcaf46547ba7d5a0c761c63f0383b314 Mon Sep 17 00:00:00 2001 From: Tomasz Lauda Date: Wed, 26 Jun 2019 11:44:39 +0200 Subject: [PATCH] pipeline: change preload conditions Changes pipeline's preload conditions to take into consideration the situation, where we don't always want to do playback preload, because the sink part of pipeline is already running e.g. mixer topology. However the host component still needs to perform preload on its own, so for now we make the decision based on stream's direction. Signed-off-by: Tomasz Lauda --- src/audio/host.c | 3 ++- src/audio/pipeline.c | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/audio/host.c b/src/audio/host.c index adaff9419dd1..f2312ec6ffa1 100644 --- a/src/audio/host.c +++ b/src/audio/host.c @@ -669,7 +669,8 @@ static int host_copy(struct comp_dev *dev) /* here only do preload, further copies happen * in host_buffer_cb() */ - if (pipeline_is_preload(dev->pipeline) && !dev->position) { + if (dev->params.direction == SOF_IPC_STREAM_PLAYBACK && + !dev->position) { ret = dma_copy(hd->dma, hd->chan, hd->dma_buffer->size, DMA_COPY_PRELOAD); if (ret < 0) { diff --git a/src/audio/pipeline.c b/src/audio/pipeline.c index d91d15f0cc7f..9976c5a8b5b7 100644 --- a/src/audio/pipeline.c +++ b/src/audio/pipeline.c @@ -388,8 +388,11 @@ int pipeline_prepare(struct pipeline *p, struct comp_dev *dev) goto out; } - /* pipeline preload needed only for playback streams */ - p->preload = dev->params.direction == SOF_IPC_STREAM_PLAYBACK; + /* pipeline preload needed only for playback streams without active + * sink component (it can be active for e.g. mixer pipelines) + */ + p->preload = dev->params.direction == SOF_IPC_STREAM_PLAYBACK && + p->sink_comp->state != COMP_STATE_ACTIVE; p->status = COMP_STATE_PREPARE; out: