Skip to content

Conversation

@ktrzcinx
Copy link
Member

@ktrzcinx ktrzcinx commented Jul 10, 2020

Small DMA fixes extracted from #3156

depends on #3174

@ktrzcinx ktrzcinx changed the title Dma use audio stream Dma use audio stream API Jul 10, 2020
Copy link
Collaborator

@paulstelian97 paulstelian97 left a comment

Choose a reason for hiding this comment

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

The generic functions may also be a bit more atomic, so good change.

@lgirdwood
Copy link
Member

Rerun CI to inlcude recent FW fix.

@lgirdwood
Copy link
Member

SOFCI TEST

src/lib/dma.c Outdated
Copy link

Choose a reason for hiding this comment

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

Replacing specific dma buffer handling in host/dai components with consistent use of audio-stream api is a good idea since the dma buffer might be handled as an audio-stream by other parts as well (like pcm-converter code).

Regarding this specific line, when called by dai component, the dd->frame_fmt used previously is replaced with source->stream.frame_fmt now, so assert(==) before a call might be a good idea to make sure they are consistently updated. Another option is to remove dd->frame_fmt completely and pass the setting to the audio-stream if possible (audio-stream already attached when dd->frame_fmt is configured?)

Copy link
Member

Choose a reason for hiding this comment

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

can we make sure there are no dependencies on PCM formats in DMA buffers? we will use DMAs for compressed formats.

Copy link
Member Author

Choose a reason for hiding this comment

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

can we make sure there are no dependencies on PCM formats in DMA buffers? we will use DMAs for compressed formats.

I'm not familiar with compressed audio streams, but I guess it should be next data format, like SOF_IPC_FRAME_MP3_LE, isn't it? If so, then conversion should be done in pcm_converter, in flow like host.dma_buffer->(mp3) pcm_converter-> (arbitrary pcm) host.local_buffer or are you going to do separate component and create flow like host.dma_buffer->(mp3) pcm_converter-> (mp3) host.local_buffer -> (mp3) decompresser -> (pcm, eg s32) pcm_converter -> (arbitrary pcm) ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think converters will really work on compressed formats. I think in the compress situation the pipeline must be something like host.dma_buffer->(mp3) decompresser ->(pcm, say s24le) pcm_converter ->(pcm, whichever is demanded by further components)

Copy link
Member Author

Choose a reason for hiding this comment

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

Then passing number of bytes from source buffer in dma_buffer_copy_*() probably will be better idea - more universal solution.

@ktrzcinx ktrzcinx force-pushed the dma-use-audio-stream branch 2 times, most recently from 5ddcc29 to 6fe778c Compare July 13, 2020 11:47
@ktrzcinx
Copy link
Member Author

SOFCI TEST

@ktrzcinx
Copy link
Member Author

depends on #3174

@ktrzcinx ktrzcinx force-pushed the dma-use-audio-stream branch 2 times, most recently from ceca95b to 2dc2c9f Compare July 14, 2020 09:42
@lgirdwood
Copy link
Member

@mmaka1 @plbossart comments resolved ?

Copy link
Member

@plbossart plbossart left a comment

Choose a reason for hiding this comment

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

I am still not clear on the ties between buffers and samples, see below

src/lib/dma.c Outdated
Copy link
Member

Choose a reason for hiding this comment

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

I was good with this patch since it used bytes instead of samples, which is a good thing to do when dealing with DMAs, but this re-introduces samples which may not be correct in all cases if the data is not PCM.

Copy link
Member Author

@ktrzcinx ktrzcinx Jul 16, 2020

Choose a reason for hiding this comment

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

I will remove this samples number calculation from this place, but I need changes from this one and one more PR , let me do it step-by-step. Even this PR needs changes from #3174, I wouldn't like to make too long PR dependency chain

Copy link
Member

Choose a reason for hiding this comment

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

ok, looks like we are in agreement on directions, fine with me if we do this in steps, as long as each PR doesn't break because the others are missing.

Copy link
Member

@plbossart plbossart left a comment

Choose a reason for hiding this comment

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

changed to Approved with the understanding there is an update coming. Thanks @ktrzcinx

@plbossart
Copy link
Member

Travis CI reports errors?

@ktrzcinx ktrzcinx force-pushed the dma-use-audio-stream branch from 2dc2c9f to 3320ae6 Compare July 17, 2020 11:05
@lgirdwood
Copy link
Member

@ktrzcinx some CI issues and conflicts.

@ktrzcinx
Copy link
Member Author

@lgirdwood I'm waiting for #3174, because CI will claim in this PR without it.

@lgirdwood
Copy link
Member

@lgirdwood I'm waiting for #3174, because CI will claim in this PR without it.

ok, can you reply to @plbossart comments to move it forward.

Each audio_stream should have set valid metadata information.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
@ktrzcinx ktrzcinx force-pushed the dma-use-audio-stream branch from 3320ae6 to 555e2dd Compare July 23, 2020 11:09
@ktrzcinx
Copy link
Member Author

SOFCI TEST

ktrzcinx added 2 commits July 24, 2020 10:27
This value is strictly correlated with given samples number,
passing sink/source bytes number as separate parameter may
lead to data desynchronization.
Temporary number of samples and sink_bytes is calculated in
dma_buffer_copy_*() function, but it should be removed in
future. 'process' should be modified to take only number of
bytes to process from source stream and return number of
output bytes in sink stream, to allow easily handling of
compressed audio streams.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
Usage of function from audio_stream component updates avail/free
fields. Moreover using generic function helps in maintaining code.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
@ktrzcinx ktrzcinx force-pushed the dma-use-audio-stream branch from 555e2dd to aff001d Compare July 24, 2020 08:33
@mmaka1 mmaka1 requested review from mmaka1 and plbossart July 28, 2020 19:11
@mmaka1
Copy link

mmaka1 commented Jul 28, 2020

@plbossart I accidentally clicked re-review while the browser was refreshing the list processing previous click on my name. Pls ignore.

@mmaka1 mmaka1 merged commit 131f0d4 into thesofproject:master Jul 28, 2020
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