-
Notifications
You must be signed in to change notification settings - Fork 350
pipeline: allocate on specific heap #10539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -11,6 +11,7 @@ | |||||
| #include <sof/ipc/msg.h> | ||||||
| #include <rtos/interrupt.h> | ||||||
| #include <rtos/symbol.h> | ||||||
| #include <rtos/alloc.h> | ||||||
| #include <sof/lib/mm_heap.h> | ||||||
| #include <sof/lib/uuid.h> | ||||||
| #include <sof/compiler_attributes.h> | ||||||
|
|
@@ -108,8 +109,8 @@ void pipeline_posn_init(struct sof *sof) | |||||
| } | ||||||
|
|
||||||
| /* create new pipeline - returns pipeline id or negative error */ | ||||||
| struct pipeline *pipeline_new(uint32_t pipeline_id, uint32_t priority, uint32_t comp_id, | ||||||
| struct create_pipeline_params *pparams) | ||||||
| struct pipeline *pipeline_new(struct k_heap *heap, uint32_t pipeline_id, uint32_t priority, | ||||||
| uint32_t comp_id, struct create_pipeline_params *pparams) | ||||||
| { | ||||||
| struct sof_ipc_stream_posn posn; | ||||||
| struct pipeline *p; | ||||||
|
|
@@ -122,13 +123,16 @@ struct pipeline *pipeline_new(uint32_t pipeline_id, uint32_t priority, uint32_t | |||||
| heap_trace_all(0); | ||||||
|
|
||||||
| /* allocate new pipeline */ | ||||||
| p = rzalloc(SOF_MEM_FLAG_USER, sizeof(*p)); | ||||||
| p = sof_heap_alloc(heap, SOF_MEM_FLAG_USER, sizeof(*p), 0); | ||||||
| if (!p) { | ||||||
| pipe_cl_err("Out of Memory"); | ||||||
| return NULL; | ||||||
| } | ||||||
|
|
||||||
| memset(p, 0, sizeof(*p)); | ||||||
|
||||||
|
|
||||||
| /* init pipeline */ | ||||||
| p->heap = heap; | ||||||
| p->comp_id = comp_id; | ||||||
| p->priority = priority; | ||||||
| p->pipeline_id = pipeline_id; | ||||||
|
|
@@ -161,7 +165,7 @@ struct pipeline *pipeline_new(uint32_t pipeline_id, uint32_t priority, uint32_t | |||||
|
|
||||||
| return p; | ||||||
| free: | ||||||
| rfree(p); | ||||||
| sof_heap_free(heap, p); | ||||||
|
||||||
| sof_heap_free(heap, p); | |
| sof_heap_free(p->heap, p); |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |||||
| #include <sof/audio/buffer.h> | ||||||
| #include <sof/audio/component_ext.h> | ||||||
| #include <sof/audio/pipeline.h> | ||||||
| #include <rtos/alloc.h> | ||||||
| #include <rtos/interrupt.h> | ||||||
| #include <sof/lib/agent.h> | ||||||
| #include <sof/list.h> | ||||||
|
|
@@ -241,15 +242,17 @@ static struct task *pipeline_task_init(struct pipeline *p, uint32_t type) | |||||
| { | ||||||
| struct pipeline_task *task = NULL; | ||||||
|
|
||||||
| task = rzalloc(SOF_MEM_FLAG_USER, | ||||||
| sizeof(*task)); | ||||||
| task = sof_heap_alloc(p->heap, SOF_MEM_FLAG_USER, | ||||||
| sizeof(*task), 0); | ||||||
|
||||||
| sizeof(*task), 0); | |
| sizeof(*task), __alignof__(*task)); |
Copilot
AI
Feb 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
memset() is newly used here, but this file doesn't appear to include the header that declares it. Add an explicit include for the project’s string/memory header (typically <string.h> or the SOF wrapper) to avoid relying on transitive includes and potential implicit-declaration build failures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using an explicit alignment of
0relies onsof_heap_alloc()default behavior. Since this allocates a struct, it’s safer/clearer to pass an explicit alignment (e.g.,__alignof__(*p)/alignof(struct pipeline)or the project’s default alignment constant) to prevent misalignment if a heap implementation changes.