virtio-sound: add latency_bytes definition
PATCH 1/1 virtio-sound: add latency_bytes definition
This commit aims at providing a better definition of latency_bytes. To do so, this commit defines latency_bytes as is defined in Crosvm.
--- device-types/sound/description.tex | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
device-types/sound/description.tex +4 -1
@@ -694,7 +694,10 @@ \subsubsection{PCM I/O Messages}\label{sec:Device Types / Sound Device / Device \begin{description} \item[\field{status}] contains VIRTIO_SND_S_OK if an operation is successful, and VIRTIO_SND_S_IO_ERR otherwise. -\item[\field{latency_bytes}] indicates the current device latency. +\item[\field{latency_bytes}] indicates the current device latency. For +playback, this is the amount of bytes that must be consumed before +the current request can be played. For capture, this is the latency in terms of +bytes that the capture buffer was recorded. \end{description} Since all buffers in the queue (with one exception) should be of the size
Signature · 18 lines
2.41.0 This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC. In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting. Subscribe: [email protected] Unsubscribe: [email protected] List help: [email protected] List archive: https://lists.oasis-open.org/archives/virtio-comment/ Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists Committee: https://www.oasis-open.org/committees/virtio/ Join OASIS: https://www.oasis-open.org/join/
Ping Anton.
Thanks, Matias.
Quoted 26 lines · Matias Ezequiel Vara Larsen
This commit aims at providing a better definition of
latency_bytes. To do so, this commit defineslatency_bytesas is defined in Crosvm.Signed-off-by Matias Ezequiel Vara Larsen <[email protected]>--- device-types/sound/description.tex | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)device-types/sound/description.tex +4
-2@@ -694,7 +694,10 @@ \subsubsection{PCM I/O Messages}\label{sec:Device Types / Sound Device / Device \begin{description} \item[\field{status}] contains VIRTIO_SND_S_OK if an operation is successful, and VIRTIO_SND_S_IO_ERR otherwise. -\item[\field{latency_bytes}] indicates the current device latency. +\item[\field{latency_bytes}] indicates the current device latency. For +playback, this is the amount of bytes that must be consumed before +the current request can be played. For capture, this is the latency in terms of +bytes that the capture buffer was recorded. \end{description} Since all buffers in the queue (with one exception) should be of the size --
Quoted 2 lines
2.41.0
This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.
In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.
Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/
Hi Matias,
Quoted 15 lines · Matias Ezequiel Vara Larsen
Ping Anton.
Thanks, Matias.
Quoted 9 lines · Matias Ezequiel Vara Larsen
This commit aims at providing a better definition of
latency_bytes. To do so, this commit defineslatency_bytesas is defined in Crosvm.Signed-off-by Matias Ezequiel Vara Larsen <[email protected]>--- device-types/sound/description.tex | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Quoted 14 lines
Quoted 5 lines
device-types/sound/description.tex +0
-0device-types/sound/description.tex \subsubsection{PCM I/O Messages}\label{sec:Device Types / Sound Device / Device · line 701
Quoted 9 lines
device-types/sound/description.tex +4
-1@@ -694,7 +694,10 @@ \subsubsection{PCM I/O Messages}\label{sec:Device Types / Sound Device / Device \begin{description} \item[\field{status}] contains VIRTIO_SND_S_OK if an operation is successful, and VIRTIO_SND_S_IO_ERR otherwise. -\item[\field{latency_bytes}] indicates the current device latency. +\item[\field{latency_bytes}] indicates the current device latency. For +playback, this is the amount of bytes that must be consumed before +the current request can be played. For capture, this is the latency in terms of +bytes that the capture buffer was recorded. \end{description}
Yes, this field definitely needs some clarification.
If you think about it, from the point of view of the application in the guest, the size of the current latency is the current contents of the buffer. I.e. exactly what you added to the description, but without taking into account the value of this field.
In the current Linux driver implementation, this "latency_bytes" value is saved to the "delay" field, which is then passed to user space. And this "delay", as I understand it, indicates an additional delay caused by the specifics of the hardware.
And it turns out that the latency_bytes field either should indicate such an additional delay (for example, caused by the specific implementation of the backend on the device side), or does not make sense, since the current latency value is already known a priori. What do you think?
Quoted 6 lines
Quoted 5 lines
device-types/sound/description.tex +0
-1Since all buffers in the queue (with one exception) should be of the size --2.41.0
Signature · 21 lines
Anton Yakovlev Senior Software Engineer OpenSynergy GmbH Rotherstr. 20, 10245 Berlin This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC. In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting. Subscribe: [email protected] Unsubscribe: [email protected] List help: [email protected] List archive: https://lists.oasis-open.org/archives/virtio-comment/ Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists Committee: https://www.oasis-open.org/committees/virtio/ Join OASIS: https://www.oasis-open.org/join/
Hello Anton,
Quoted 41 lines · Anton Yakovlev
Hi Matias,
Quoted 15 lines · Matias Ezequiel Vara Larsen
Ping Anton.
Thanks, Matias.
Quoted 9 lines · Matias Ezequiel Vara Larsen
This commit aims at providing a better definition of
latency_bytes. To do so, this commit defineslatency_bytesas is defined in Crosvm.Signed-off-by Matias Ezequiel Vara Larsen <[email protected]>--- device-types/sound/description.tex | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)Quoted 14 lines
Quoted 5 lines
device-types/sound/description.tex +0
-0device-types/sound/description.tex \subsubsection{PCM I/O Messages}\label{sec:Device Types / Sound Device / Device · line 701
Quoted 9 lines
device-types/sound/description.tex +4
-1@@ -694,7 +694,10 @@ \subsubsection{PCM I/O Messages}\label{sec:Device Types / Sound Device / Device \begin{description} \item[\field{status}] contains VIRTIO_SND_S_OK if an operation is successful, and VIRTIO_SND_S_IO_ERR otherwise. -\item[\field{latency_bytes}] indicates the current device latency. +\item[\field{latency_bytes}] indicates the current device latency. For +playback, this is the amount of bytes that must be consumed before +the current request can be played. For capture, this is the latency in terms of +bytes that the capture buffer was recorded. \end{description}Yes, this field definitely needs some clarification.
If you think about it, from the point of view of the application in the guest, the size of the current latency is the current contents of the buffer. I.e. exactly what you added to the description, but without taking into account the value of this field.
Quoted 4 lines
In the current Linux driver implementation, this "
latency_bytes" value is saved to the "delay" field, which is then passed to user space. And this "delay", as I understand it, indicates an additional delay caused by the specifics of the hardware.
Yes, I understood the same. For me, it was not clear how "delay" would be used by user applications. In crosvm, for example, latency_bytes is set to 0, but I'm not sure what would happen if it was set to something else. When I played around with different values, I didn't notice any difference in behavior.
Quoted 4 lines
And it turns out that the
latency_bytesfield either should indicate such an additional delay (for example, caused by the specific implementation of the backend on the device side), or does not make sense, since the current latency value is already known a priori. What do you think?
Do you mean that we could get rid of this field and add it in the future in case we need it? Or, to add to the description the fact that latency_bytes is a specific implementation value that adds additional delay?
Also I do not understand how the latency_bytes value and the completion notification may interact. For example, a device could send completion notification immediately after a request is received and just set the correct value to the latency_bytes field to indicate how many bytes would take to the current buffer to be consumed. I can't see any issue with using the latency_byte value in that way.
Thanks, Matias.
This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.
In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.
Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/
Hi Matias,
Quoted 49 lines · Matias Ezequiel Vara Larsen
Hello Anton,
Quoted 41 lines · Anton Yakovlev
Hi Matias,
Quoted 15 lines · Matias Ezequiel Vara Larsen
Ping Anton.
Thanks, Matias.
Quoted 9 lines · Matias Ezequiel Vara Larsen
This commit aims at providing a better definition of
latency_bytes. To do so, this commit defineslatency_bytesas is defined in Crosvm.Signed-off-by Matias Ezequiel Vara Larsen <[email protected]>--- device-types/sound/description.tex | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)Quoted 14 lines
Quoted 5 lines
device-types/sound/description.tex +0
-0device-types/sound/description.tex \subsubsection{PCM I/O Messages}\label{sec:Device Types / Sound Device / Device · line 701
Quoted 9 lines
device-types/sound/description.tex +4
-1@@ -694,7 +694,10 @@ \subsubsection{PCM I/O Messages}\label{sec:Device Types / Sound Device / Device \begin{description} \item[\field{status}] contains VIRTIO_SND_S_OK if an operation is successful, and VIRTIO_SND_S_IO_ERR otherwise. -\item[\field{latency_bytes}] indicates the current device latency. +\item[\field{latency_bytes}] indicates the current device latency. For +playback, this is the amount of bytes that must be consumed before +the current request can be played. For capture, this is the latency in terms of +bytes that the capture buffer was recorded. \end{description}Yes, this field definitely needs some clarification.
If you think about it, from the point of view of the application in the guest, the size of the current latency is the current contents of the buffer. I.e. exactly what you added to the description, but without taking into account the value of this field.
Quoted 4 lines
In the current Linux driver implementation, this "
latency_bytes" value is saved to the "delay" field, which is then passed to user space. And this "delay", as I understand it, indicates an additional delay caused by the specifics of the hardware.
Quoted 5 lines
Yes, I understood the same. For me, it was not clear how "delay" would be used by user applications. In crosvm, for example,
latency_bytesis set to 0, but I'm not sure what would happen if it was set to something else. When I played around with different values, I didn't notice any difference in behavior.
The value of this delay is reported to user space, and can also be taken into account when calculating timestamps for the substream. So the application can take this into account if necessary.
Quoted 9 lines
Quoted 4 lines
And it turns out that the
latency_bytesfield either should indicate such an additional delay (for example, caused by the specific implementation of the backend on the device side), or does not make sense, since the current latency value is already known a priori. What do you think?Do you mean that we could get rid of this field and add it in the future in case we need it? Or, to add to the description the fact that
latency_bytesis a specific implementation value that adds additional delay?
I meant that we could add something like: "indicates the current value of the additional delay caused by the implementation of the device".
Quoted 6 lines
Also I do not understand how the
latency_bytesvalue and the completion notification may interact. For example, a device could send completion notification immediately after a request is received and just set the correct value to thelatency_bytesfield to indicate how many bytes would take to the current buffer to be consumed. I can't see any issue with using thelatency_bytevalue in that way.
But what is the practical meaning of this?
And, ideally, the completion of requests should coincide with period boundaries on the timeline. Otherwise, for example, there will be problems with synchronizing video and audio streams when timestamps based on the hw_ptr value are used.
Best regards,
Quoted 3 lines
Thanks, Matias.
Signature · 21 lines
Anton Yakovlev Senior Software Engineer OpenSynergy GmbH Rotherstr. 20, 10245 Berlin This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC. In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting. Subscribe: [email protected] Unsubscribe: [email protected] List help: [email protected] List archive: https://lists.oasis-open.org/archives/virtio-comment/ Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists Committee: https://www.oasis-open.org/committees/virtio/ Join OASIS: https://www.oasis-open.org/join/
Hello Anton,
Quoted 58 lines · Anton Yakovlev
Hi Matias,
Quoted 49 lines · Matias Ezequiel Vara Larsen
Hello Anton,
Quoted 41 lines · Anton Yakovlev
Hi Matias,
Quoted 15 lines · Matias Ezequiel Vara Larsen
Ping Anton.
Thanks, Matias.
Quoted 9 lines · Matias Ezequiel Vara Larsen
This commit aims at providing a better definition of
latency_bytes. To do so, this commit defineslatency_bytesas is defined in Crosvm.Signed-off-by Matias Ezequiel Vara Larsen <[email protected]>--- device-types/sound/description.tex | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)Quoted 14 lines
Quoted 5 lines
device-types/sound/description.tex +0
-0device-types/sound/description.tex \subsubsection{PCM I/O Messages}\label{sec:Device Types / Sound Device / Device · line 701
Quoted 9 lines
device-types/sound/description.tex +4
-1@@ -694,7 +694,10 @@ \subsubsection{PCM I/O Messages}\label{sec:Device Types / Sound Device / Device \begin{description} \item[\field{status}] contains VIRTIO_SND_S_OK if an operation is successful, and VIRTIO_SND_S_IO_ERR otherwise. -\item[\field{latency_bytes}] indicates the current device latency. +\item[\field{latency_bytes}] indicates the current device latency. For +playback, this is the amount of bytes that must be consumed before +the current request can be played. For capture, this is the latency in terms of +bytes that the capture buffer was recorded. \end{description}Yes, this field definitely needs some clarification.
If you think about it, from the point of view of the application in the guest, the size of the current latency is the current contents of the buffer. I.e. exactly what you added to the description, but without taking into account the value of this field.
Quoted 4 lines
In the current Linux driver implementation, this "
latency_bytes" value is saved to the "delay" field, which is then passed to user space. And this "delay", as I understand it, indicates an additional delay caused by the specifics of the hardware.Quoted 5 lines
Yes, I understood the same. For me, it was not clear how "delay" would be used by user applications. In crosvm, for example,
latency_bytesis set to 0, but I'm not sure what would happen if it was set to something else. When I played around with different values, I didn't notice any difference in behavior.
Quoted 5 lines
The value of this delay is reported to user space, and can also be taken into account when calculating timestamps for the substream. So the application can take this into account if necessary.
Got it. Thanks for the explanation.
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
And it turns out that the
latency_bytesfield either should indicate such an additional delay (for example, caused by the specific implementation of the backend on the device side), or does not make sense, since the current latency value is already known a priori. What do you think?
Quoted 8 lines
Quoted 4 lines
Do you mean that we could get rid of this field and add it in the future in case we need it? Or, to add to the description the fact that
latency_bytesis a specific implementation value that adds additional delay?I meant that we could add something like: "indicates the current value of the additional delay caused by the implementation of the device".
Thanks, I will add that in the PATCH.
Quoted 8 lines
Quoted 7 lines
Also I do not understand how the
latency_bytesvalue and the completion notification may interact. For example, a device could send completion notification immediately after a request is received and just set the correct value to thelatency_bytesfield to indicate how many bytes would take to the current buffer to be consumed. I can't see any issue with using thelatency_bytevalue in that way.
Quoted 8 lines
But what is the practical meaning of this?
And, ideally, the completion of requests should coincide with period boundaries on the timeline. Otherwise, for example, there will be problems with synchronizing video and audio streams when timestamps based on the
hw_ptrvalue are used.
Thanks for the clarification.
Matias
This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.
In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.
Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/