Skip to content

zephyr: buffer: host: dai: Introduction of functions that allocate a buffer from a range - #9145

Merged
kv2019i merged 5 commits into
thesofproject:mainfrom
softwarecki:alloc-range
Jun 25, 2024
Merged

kv2019i merged 5 commits into
thesofproject:mainfrom
softwarecki:alloc-range

Conversation

@softwarecki

Copy link
Copy Markdown
Collaborator

For the needs of deep buffering, a new functions buffer_alloc_range and buffer_set_size_range have been added that allocate a buffer with a size given as a range. The suggested buffer size coming from ipc doesn't have to be met if there is not enough memory. It is then reduced step by step until it reaches its minimum size. These functions were used in dai and host.

Comment thread src/audio/buffer.c Resolved
Comment thread src/audio/buffer.c Resolved
Comment thread src/audio/host-zephyr.c Resolved
@softwarecki
softwarecki force-pushed the alloc-range branch 3 times, most recently from 29b0422 to 5453feb Compare May 22, 2024 15:04
@softwarecki
softwarecki marked this pull request as ready for review May 22, 2024 15:20
Comment thread src/audio/dai-zephyr.c Resolved
@softwarecki
softwarecki force-pushed the alloc-range branch 2 times, most recently from c9910d0 to 9ca757c Compare May 23, 2024 14:16

@kv2019i kv2019i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One commit message style comment first, full review coming later.

Comment thread src/audio/buffer.c Resolved
Comment thread src/audio/buffer.c Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in fact wondering, whether it would be better to align down? Doesn't seem important though

Comment thread src/audio/dai-zephyr.c Resolved
Change name of the buffer_init to buffer_init_stream because it is only
responsible for initiating a stream. Omit the caps parameter because it is
only assigned to a structure field. Assign this field in the function
caller.

Signed-off-by: Adrian Warecki <[email protected]>
Move part of the code responsible for initializing the buffer structure
to the new function buffer_alloc_struct, which will also be used
by a new buffer allocation function.

Signed-off-by: Adrian Warecki <[email protected]>
Add two new buffer allocation functions buffer_set_size_range and
buffer_alloc_range dedicated to deep buffering. They try to allocate
the largest possible buffer according to the suggested size. If this size
cannot be obtained, it will be reduced step by step until it reaches
the minimum size.

Signed-off-by: Adrian Warecki <[email protected]>
Change buffer allocation functions to buffer_alloc_range and
buffer_set_size_range. This makes it possible to allocate the buffer even
if the suggested size given in ipc cannot be met.

Signed-off-by: Adrian Warecki <[email protected]>
Change buffer allocation functions to buffer_alloc_range and
buffer_set_size_range. This makes it possible to allocate the buffer even
if the suggested size given in ipc cannot be met.

Signed-off-by: Adrian Warecki <[email protected]>
@softwarecki

Copy link
Copy Markdown
Collaborator Author

SOFCI TEST

@kv2019i kv2019i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good to me.

@kv2019i
kv2019i merged commit 9a322a2 into thesofproject:main Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants