buf: fixes for CONFIG_INCOHERENT=0 builds

there's no point with cache writeback/invalidate
for coherent architectures. Also the buffer may be set
as "shared" at any moment, not only at creation time

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
This commit is contained in:
Marcin Szkudlinski 2024-08-08 12:41:07 +02:00 committed by Kai Vehmanen
parent 19872fb5a5
commit 6c29ad3fb6
2 changed files with 8 additions and 1 deletions

View File

@ -249,14 +249,18 @@ bool buffer_params_match(struct comp_buffer *buffer,
static inline void buffer_stream_invalidate(struct comp_buffer *buffer, uint32_t bytes)
{
#if CONFIG_INCOHERENT
if (buffer->is_shared)
audio_stream_invalidate(&buffer->stream, bytes);
#endif
}
static inline void buffer_stream_writeback(struct comp_buffer *buffer, uint32_t bytes)
{
#if CONFIG_INCOHERENT
if (buffer->is_shared)
audio_stream_writeback(&buffer->stream, bytes);
#endif
}

View File

@ -184,9 +184,12 @@ int comp_buffer_connect(struct comp_dev *comp, uint32_t comp_core,
{
/* check if it's a connection between cores */
if (buffer->core != comp_core) {
#if CONFIG_INCOHERENT
/* buffer must be shared */
assert(buffer->is_shared);
#else
buffer->is_shared = true;
#endif
if (!comp->is_shared)
comp_make_shared(comp);
}