Skip to content

Commit

Permalink
kconfig: add PIPELINE_2_0 flag
Browse files Browse the repository at this point in the history
This flag enables changes to new pipeline structure,
known as pipeline2_0
It is required for certain new features, like DP_SCHEDULER.
The changes are incremental and at the moment pipeline 2.0
is fully backward compatible with legacy platforms, however
it generates some overhead in data and code, so it is useful to
turn if off if not needed

Signed-off-by: Marcin Szkudlinski <[email protected]>

# Conflicts:
#	src/include/sof/audio/audio_stream.h
#	src/ipc/ipc4/helper.c
  • Loading branch information
marcinszkudlinski committed Jul 3, 2024
1 parent feb91d8 commit 6cdf717
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 15 deletions.
1 change: 1 addition & 0 deletions app/boards/intel_adsp_ace15_mtpm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ CONFIG_DAI_INTEL_DMIC_NHLT=y
CONFIG_DAI_DMIC_HAS_OWNERSHIP=y
CONFIG_DAI_DMIC_HAS_MULTIPLE_LINE_SYNC=y
CONFIG_DAI_INTEL_SSP=y
CONFIG_PIPELINE_2_0=y
CONFIG_ZEPHYR_DP_SCHEDULER=y
CONFIG_DMA=y
CONFIG_DMA_INTEL_ADSP_GPDMA=y
Expand Down
1 change: 1 addition & 0 deletions app/boards/intel_adsp_ace20_lnl.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ CONFIG_DAI_INTEL_DMIC_NHLT=y
CONFIG_DAI_DMIC_HAS_OWNERSHIP=n
CONFIG_DAI_DMIC_HAS_MULTIPLE_LINE_SYNC=y
CONFIG_DAI_INTEL_SSP=y
CONFIG_PIPELINE_2_0=y
CONFIG_ZEPHYR_DP_SCHEDULER=y
CONFIG_DMA=y
CONFIG_DMA_INTEL_ADSP_GPDMA=n
Expand Down
1 change: 1 addition & 0 deletions app/boards/intel_adsp_ace30_ptl.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ CONFIG_DAI_INTEL_DMIC_NHLT=y
CONFIG_DAI_DMIC_HAS_OWNERSHIP=n
CONFIG_DAI_DMIC_HAS_MULTIPLE_LINE_SYNC=y
CONFIG_DAI_INTEL_SSP=y
CONFIG_PIPELINE_2_0=y
CONFIG_ZEPHYR_DP_SCHEDULER=y
CONFIG_DMA=y
CONFIG_DMA_INTEL_ADSP_GPDMA=n
Expand Down
6 changes: 3 additions & 3 deletions src/audio/audio_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ void audio_stream_init(struct audio_stream *audio_stream, void *buff_addr, uint3
}

/* get a handler to source API */
#if CONFIG_ZEPHYR_DP_SCHEDULER
#if CONFIG_PIPELINE_2_0
struct sof_source *audio_stream_get_source(struct audio_stream *audio_stream)
{
return audio_stream->secondary_buffer_source ?
Expand All @@ -222,7 +222,7 @@ struct sof_sink *audio_stream_get_sink(struct audio_stream *audio_stream)
&audio_stream->_sink_api;
}

#else /* CONFIG_ZEPHYR_DP_SCHEDULER */
#else /* CONFIG_PIPELINE_2_0 */

struct sof_source *audio_stream_get_source(struct audio_stream *audio_stream)
{
Expand All @@ -233,4 +233,4 @@ struct sof_sink *audio_stream_get_sink(struct audio_stream *audio_stream)
{
return &audio_stream->_sink_api;
}
#endif /* CONFIG_ZEPHYR_DP_SCHEDULER */
#endif /* CONFIG_PIPELINE_2_0 */
8 changes: 4 additions & 4 deletions src/audio/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ struct comp_buffer *buffer_alloc(uint32_t size, uint32_t caps, uint32_t flags, u
return buffer;
}

#if CONFIG_ZEPHYR_DP_SCHEDULER
#if CONFIG_PIPELINE_2_0
int buffer_attach_secondary_buffer(struct comp_buffer *buffer, bool at_input,
struct sof_audio_buffer *secondary_buffer)
{
Expand Down Expand Up @@ -140,7 +140,7 @@ int buffer_sync_secondary_buffer(struct comp_buffer *buffer, size_t limit)
err = source_to_sink_copy(data_src, data_dst, true, to_copy);
return err;
}
#endif /* CONFIG_ZEPHYR_DP_SCHEDULER */
#endif /* CONFIG_PIPELINE_2_0 */

void buffer_zero(struct comp_buffer *buffer)
{
Expand Down Expand Up @@ -264,10 +264,10 @@ void buffer_free(struct comp_buffer *buffer)

/* In case some listeners didn't unregister from buffer's callbacks */
notifier_unregister_all(NULL, buffer);
#if CONFIG_ZEPHYR_DP_SCHEDULER
#if CONFIG_PIPELINE_2_0
audio_buffer_free(buffer->stream.secondary_buffer_sink);
audio_buffer_free(buffer->stream.secondary_buffer_source);
#endif /* CONFIG_ZEPHYR_DP_SCHEDULER */
#endif /* CONFIG_PIPELINE_2_0 */
rfree(buffer->stream.addr);
rfree(buffer);
}
Expand Down
6 changes: 3 additions & 3 deletions src/audio/module_adapter/module_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ static int module_adapter_audio_stream_type_copy(struct comp_dev *dev)
return ret;
}

#if CONFIG_ZEPHYR_DP_SCHEDULER
#if CONFIG_PIPELINE_2_0
static int module_adapter_copy_ring_buffers(struct comp_dev *dev)
{
/*
Expand Down Expand Up @@ -960,12 +960,12 @@ static int module_adapter_copy_ring_buffers(struct comp_dev *dev)
}
return 0;
}
#else
#else /* CONFIG_PIPELINE_2_0 */
static inline int module_adapter_copy_ring_buffers(struct comp_dev *dev)
{
return -ENOTSUP;
}
#endif /* CONFIG_ZEPHYR_DP_SCHEDULER */
#endif /* CONFIG_PIPELINE_2_0 */

static int module_adapter_sink_source_copy(struct comp_dev *dev)
{
Expand Down
4 changes: 2 additions & 2 deletions src/include/sof/audio/audio_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ struct audio_stream {
void *end_addr; /**< Buffer end address */
uint8_t byte_align_req;
uint8_t frame_align_req;
#if CONFIG_ZEPHYR_DP_SCHEDULER
#if CONFIG_PIPELINE_2_0
struct sof_audio_buffer *secondary_buffer_sink; /**< sink API of an additional buffer
* of any type at data input
*/
struct sof_audio_buffer *secondary_buffer_source; /**< source API of an additional buffer
* at data output
*/
#endif /* CONFIG_ZEPHYR_DP_SCHEDULER */
#endif /* CONFIG_PIPELINE_2_0 */

/* runtime stream params */
struct sof_audio_stream_params runtime_stream_params;
Expand Down
4 changes: 2 additions & 2 deletions src/include/sof/audio/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ struct buffer_cb_free {
struct comp_buffer *buffer_alloc(uint32_t size, uint32_t caps, uint32_t flags, uint32_t align,
bool is_shared);
struct comp_buffer *buffer_new(const struct sof_ipc_buffer *desc, bool is_shared);
#if CONFIG_ZEPHYR_DP_SCHEDULER
#if CONFIG_PIPELINE_2_0
/*
* attach a secondary buffer (any type) before buffer (when at_input == true) or behind a buffer
*
Expand Down Expand Up @@ -226,7 +226,7 @@ int buffer_attach_secondary_buffer(struct comp_buffer *buffer, bool at_input,
* secondary buffer in an operation
*/
int buffer_sync_secondary_buffer(struct comp_buffer *buffer, size_t limit);
#endif /* CONFIG_ZEPHYR_DP_SCHEDULER */
#endif /* CONFIG_PIPELINE_2_0 */
int buffer_set_size(struct comp_buffer *buffer, uint32_t size, uint32_t alignment);
void buffer_free(struct comp_buffer *buffer);
void buffer_zero(struct comp_buffer *buffer);
Expand Down
2 changes: 1 addition & 1 deletion zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ zephyr_library_sources_ifdef(CONFIG_MATH_LUT_SINE_FIXED
# SOF module interface functions
add_subdirectory(../src/module module_unused_install/)

if(CONFIG_ZEPHYR_DP_SCHEDULER)
if(CONFIG_PIPELINE_2_0)
zephyr_library_sources(${SOF_AUDIO_PATH}/buffers/ring_buffer.c)
endif()
if(CONFIG_SCHEDULE_DMA_SINGLE_CHANNEL AND NOT(CONFIG_DMA_DOMAIN))
Expand Down
9 changes: 9 additions & 0 deletions zephyr/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,22 @@ config DMA_DOMAIN_SEM_LIMIT
that SEM_LIMIT covers the maximum number of tasks your system will be
executing at some point (worst case).

config PIPELINE_2_0
bool "Enable pipeline 2.0 changes"
depends on IPC_MAJOR_4
default y if ACE
help
This flag enables changes to new pipeline structure, known as pipeline2_0
It is required for certain new features, like DP_SCHEDULER.

config ZEPHYR_DP_SCHEDULER
bool "use Zephyr thread based DP scheduler"
default y if ACE
default n
depends on IPC_MAJOR_4
depends on ZEPHYR_SOF_MODULE
depends on ACE
depends on PIPELINE_2_0
help
Enable Data Processing preemptive scheduler based on
Zephyr preemptive threads.
Expand Down

0 comments on commit 6cdf717

Please sign in to comment.