Re: [alsa-devel] [ALSA patch] [PATCH - alsa-lib 4/4] pcm_file: add infile read support for mmap mode
On Mon, 20 May 2019 18:51:06 +0200, Miartus, Adam (Arion Recruitment; ADITG/ESM) wrote:
From: Adam Miartus amiartus@de.adit-jv.com
mmap_begin callback is used to copy data from input file to mmaped buffer
guard for corner use of api (multiple mmap_begin calls by user) is introduced to check if next continuous buffer was already overwritten
buffer is overwritten with input file data only in case of stream capture
Signed-off-by: Adam Miartus amiartus@de.adit-jv.com Reviewed-by: Timo Wischer twischer@de.adit-jv.com
Can't we copy the data in snd_pcm_file_mmap_commit() just like the playback case?
thanks,
Takashi
On Mon, 20 May 2019 18:51:06 +0200, Miartus, Adam (Arion Recruitment; ADITG/ESM) wrote:
From: Adam Miartus amiartus@de.adit-jv.com
mmap_begin callback is used to copy data from input file to mmaped buffer
guard for corner use of api (multiple mmap_begin calls by user) is introduced to check if next continuous buffer was already overwritten
buffer is overwritten with input file data only in case of stream capture
Signed-off-by: Adam Miartus amiartus@de.adit-jv.com Reviewed-by: Timo Wischer twischer@de.adit-jv.com
Can't we copy the data in snd_pcm_file_mmap_commit() just like the playback case?
thanks,
Takashi
My understanding is that in case of reading data in mmap mode user would call mmap_begin, read the buffer and then call mmap_commit.
In this case overwriting the buffer in mmap_commit with data from Input file would be too late.
Best regards, Adam
On Tue, 21 May 2019 10:37:43 +0200, Miartus, Adam (Arion Recruitment; ADITG/ESM) wrote:
On Mon, 20 May 2019 18:51:06 +0200, Miartus, Adam (Arion Recruitment; ADITG/ESM) wrote:
From: Adam Miartus amiartus@de.adit-jv.com
mmap_begin callback is used to copy data from input file to mmaped buffer
guard for corner use of api (multiple mmap_begin calls by user) is introduced to check if next continuous buffer was already overwritten
buffer is overwritten with input file data only in case of stream capture
Signed-off-by: Adam Miartus amiartus@de.adit-jv.com Reviewed-by: Timo Wischer twischer@de.adit-jv.com
Can't we copy the data in snd_pcm_file_mmap_commit() just like the playback case?
thanks,
Takashi
My understanding is that in case of reading data in mmap mode user would call mmap_begin, read the buffer and then call mmap_commit.
In this case overwriting the buffer in mmap_commit with data from Input file would be too late.
Hm, OK. I basically hate to add a new ops, but this might be the only way if we have to implement that.
OTOH, is this mmap support mandatory? IOW, is wrapping with the plug and mmap_emul performance-wise so bad?
thanks,
Takashi
Hi,
On Tue, May 21, 2019, at 17:52, Takashi Iwai wrote:
On Tue, 21 May 2019 10:37:43 +0200, Miartus, Adam (Arion Recruitment; ADITG/ESM) wrote:
On Mon, 20 May 2019 18:51:06 +0200, Miartus, Adam (Arion Recruitment; ADITG/ESM) wrote:
From: Adam Miartus amiartus@de.adit-jv.com
mmap_begin callback is used to copy data from input file to mmaped buffer
guard for corner use of api (multiple mmap_begin calls by user) is introduced to check if next continuous buffer was already overwritten
buffer is overwritten with input file data only in case of stream capture
Signed-off-by: Adam Miartus amiartus@de.adit-jv.com Reviewed-by: Timo Wischer twischer@de.adit-jv.com
Can't we copy the data in snd_pcm_file_mmap_commit() just like the playback case?
thanks,
Takashi
My understanding is that in case of reading data in mmap mode user would call mmap_begin, read the buffer and then call mmap_commit.
In this case overwriting the buffer in mmap_commit with data from Input file would be too late.
Hm, OK. I basically hate to add a new ops, but this might be the only way if we have to implement that.
I'm interested in this patch, however the patch is not blasted by list server. Would you please re-post your patchset so that the list server delivers them to subscribers and I can see the contents?
OTOH, is this mmap support mandatory? IOW, is wrapping with the plug and mmap_emul performance-wise so bad?
Regards
Takashi Sakamoto
On Tue, 21 May 2019 10:37:43 +0200, Miartus, Adam (Arion Recruitment; ADITG/ESM) wrote:
On Mon, 20 May 2019 18:51:06 +0200, Miartus, Adam (Arion Recruitment; ADITG/ESM) wrote:
From: Adam Miartus amiartus@de.adit-jv.com
mmap_begin callback is used to copy data from input file to mmaped buffer
guard for corner use of api (multiple mmap_begin calls by user) is introduced to check if next continuous buffer was already overwritten
buffer is overwritten with input file data only in case of stream capture
Signed-off-by: Adam Miartus amiartus@de.adit-jv.com Reviewed-by: Timo Wischer twischer@de.adit-jv.com
Can't we copy the data in snd_pcm_file_mmap_commit() just like the playback case?
thanks,
Takashi
My understanding is that in case of reading data in mmap mode user would call mmap_begin, read the buffer and then call mmap_commit.
In this case overwriting the buffer in mmap_commit with data from Input file would be too late.
Hm, OK. I basically hate to add a new ops, but this might be the only way if we have to implement that.
OTOH, is this mmap support mandatory? IOW, is wrapping with the plug and mmap_emul performance-wise so bad?
thanks,
Takashi
I understand that extending the api is not ideal, however this approach in my opinion, simplifies the solution. API could also be used to simplify code in softvol plugin, which to my understanding loops around the buffer in avail_update callback. Maybe other plugins could benefit as well.
As for emulation of mmap I was not aware it is possible. We would like to use the file plugin in mmap mode as additional tool for debugging hw/sw, with option to overwrite the mmap buffer in read mode with data from file, in this case I think it would be preferred to access mmap area without emulation. However, if this can be accomplished without api change just by alsa configuration, perhaps there is no need for this change.
best regards,
Adam
participants (3)
-
Miartus, Adam (Arion Recruitment; ADITG/ESM)
-
Takashi Iwai
-
Takashi Sakamoto