-
Notifications
You must be signed in to change notification settings - Fork 140
[RFC]: Add support for drain operation on compress streams #3808
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
[RFC]: Add support for drain operation on compress streams #3808
Conversation
Added new ipc stream structure that will be used by the FW in order to notify the host that the drain operation is done. For the moment, the structure contains only the reply header since that's the only information we care about but, by adding a new ipc stream structure, we can send more information from FW regarding the drain operation if need be. Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Since we want to notify the host when the drain operation is done in the FW, this change will enable the FW to send an IPC message to the host in order to signal that the draining is done. Upon receiving the notification, the host signals to ALSA's compress-offload API that the draining is over so it can continue its workflow. As of now, the drain operation is only implemented for compress streams. Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
The purpose of this change is to allow the compress API to send the TRIG_DRAIN IPC message to the FW so it can start the draining operation. Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
| break; | ||
| case SNDRV_PCM_TRIGGER_DRAIN: | ||
| stream.hdr.cmd |= SOF_IPC_STREAM_TRIG_DRAIN; | ||
| break; |
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.
you probably need a different behavior for capture and playback.
From the alsa-lib PCM documentation https://www.alsa-project.org/alsa-doc/alsa-lib/group___p_c_m.html#ga49afc5b8527f30c33fafa476533c9f86
"
For playback wait for all pending frames to be played and then stop the PCM. For capture stop PCM permitting to retrieve residual frames.
"
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.
Yeah, most likely so
| * reply then the drain operation finished successfully. | ||
| */ | ||
| if (spcm->pcm.compress) | ||
| snd_compr_drain_notify(stream->cstream); |
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.
And what happens when the drain is finished? Don't we need a TRIGGER_STOP or something?
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.
Drain can be possible without stop if there are somehow two consecutive streams being fed, you do a partial drain for the first stream before starting the next one (useful for gapless playback I guess? Not 100% sure). I'd guess stop should wait until a drain finishes though.
|
Closing this for now because it's really bad. Will reopen when I'll have a more solid solution. |
This is a rough attempt of adding support for the drain operation on compress streams.