Skip to content

Conversation

@dbaluta
Copy link
Collaborator

@dbaluta dbaluta commented Sep 10, 2025

After commit 5821682 ("heap: simplify heap API") flags sent via IPC by the App processor are merged with caps.

There is an overlap after this merged so SOF_BUF_OVERRUN_PERMITTED overlaps with SOF_MEM_FLAG_DMA for example.

Also, it looks like the old flags are mostly unused. For now just remove the call audio_stream_set_underrun/audio_stream_set_overrun inside buffer_alloc_struct and set it in the buffer_new() function where we do have access to unmodified flags received from Linux.

In the future, we might completely remove the old flags.

Copilot AI review requested due to automatic review settings September 10, 2025 15:03
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes an issue where buffer flags are being incorrectly interpreted due to flag overlap after heap API changes. The SOF_BUF_OVERRUN_PERMITTED flag was overlapping with SOF_MEM_FLAG_DMA, causing incorrect behavior when setting underrun/overrun permissions.

  • Move audio_stream_set_underrun/overrun calls from buffer_alloc_struct to buffer_new
  • Use original unmodified flags from Linux IPC instead of merged flags with caps

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/ipc/ipc-helper.c Added audio_stream_set_underrun/overrun calls using original desc->flags
src/audio/buffers/comp_buffer.c Removed audio_stream_set_underrun/overrun calls that used merged flags

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

After commit 5821682 ("heap: simplify heap API")
flags sent via IPC by the App processor are merged with caps.

There is an overlap after this merged so SOF_BUF_OVERRUN_PERMITTED
overlaps with SOF_MEM_FLAG_DMA for example.

Also, it looks like the old `flags` are mostly unused. For now
just remove the call audio_stream_set_underrun/audio_stream_set_overrun
inside buffer_alloc_struct and set it in the buffer_new() function where
we do have access to unmodified flags received from Linux.

In the future, we might completely remove the `old` flags.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
@dbaluta
Copy link
Collaborator Author

dbaluta commented Sep 11, 2025

Changes since v1:

  • fixed checkpatch.pl errors.

audio_stream_set_underrun(&buffer->stream,
!!(desc->flags & SOF_BUF_UNDERRUN_PERMITTED));
audio_stream_set_overrun(&buffer->stream,
!!(desc->flags & SOF_BUF_OVERRUN_PERMITTED));
Copy link
Collaborator

Choose a reason for hiding this comment

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

this doesn't seem enough to me. Line 81 above still calls buffer_alloc() with flags derived from desc->flags which now isn't correct. I think #10227 is a better fix.

@dbaluta
Copy link
Collaborator Author

dbaluta commented Sep 12, 2025

Merged this #10227 instead so closing.

@dbaluta dbaluta closed this Sep 12, 2025
@dbaluta dbaluta deleted the fix_heap_api2 branch September 12, 2025 06:28
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.

5 participants