Skip to contentSkip to conversation

virtio-sound: add latency_bytes definition

PATCH RESEND In review Matias Ezequiel Vara Larsen 3 participants 5 messages May 21, 2024 – Jun 25, 2024

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 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.

---
Changelog:
v0 -> v1:
* specify that the delay is due to the device implementation.

---
 device-types/sound/description.tex | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
device-types/sound/description.tex +4 -1
index 54c9c8e..a138e5b 100644
@@ -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 additional delay caused by
+the device's implementation. 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 · 1 line
2.41.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Matias Ezequiel Vara Larsen

This commit aims at providing a better definition of latency_bytes. To do so, this commit defines latency_bytes as is defined in Crosvm.

---
Changelog:
v0 -> v1:
* specify that the delay is due to the device implementation.
---
device-types/sound/description.tex | 5 ++++-

1 file changed, 4 insertions(+), 1 deletion(-)

LGTM!

Quoted 21 lines
device-types/sound/description.tex +0 -0
index 54c9c8e..a138e5b 100644
@@ -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 additional delay caused by

device-types/sound/description.tex +3 -0
+the device's implementation. 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 · 1 line
2.41.0
#2 lore raw
In reply to Matias Ezequiel Vara Larsen
Quoted 31 lines · Matias Ezequiel Vara Larsen

This commit aims at providing a better definition of latency_bytes. To do so, this commit defines latency_bytes as is defined in Crosvm.

---
Changelog:
v0 -> v1:
* specify that the delay is due to the device implementation.

---
 device-types/sound/description.tex | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
device-types/sound/description.tex +4 -1
index 54c9c8e..a138e5b 100644
@@ -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 additional delay caused by
+the device's implementation. 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 · 1 line
2.41.0

Dear TC,

I'd like to request a vote on solving issue 198.

Matias

#3 lore raw
Quoted 13 lines · Matias Ezequiel Vara Larsen
Quoted 12 lines · Matias Ezequiel Vara Larsen

This commit aims at providing a better definition of latency_bytes. To do so, this commit defines latency_bytes as is defined in Crosvm.

---
Changelog:
v0 -> v1:
* specify that the delay is due to the device implementation.

---
 device-types/sound/description.tex | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Quoted 13 lines

device-types/sound/description.tex \subsubsection{PCM I/O Messages}\label{sec:Device Types / Sound Device / Device · line 700

Quoted 13 lines
device-types/sound/description.tex +4 -1
index 54c9c8e..a138e5b 100644
@@ -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 additional delay caused by
+the device's implementation. 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.

the last "was recorded" seems agrammatical. Do you mean "has recorded"?

Quoted 6 lines
Quoted 6 lines
device-types/sound/description.tex +0 -0
 \end{description}
 
 Since all buffers in the queue (with one exception) should be of the size
Signature · 1 line
2.41.0
Quoted 7 lines

Dear TC,

I'd like to request a vote on solving issue 198.

Matias

OK. Can you pls add a bit more detail about the issue and the proposal in github?

#4 lore raw
Quoted 14 lines · Michael S. Tsirkin
Quoted 13 lines · Matias Ezequiel Vara Larsen
Quoted 12 lines · Matias Ezequiel Vara Larsen

This commit aims at providing a better definition of latency_bytes. To do so, this commit defines latency_bytes as is defined in Crosvm.

---
Changelog:
v0 -> v1:
* specify that the delay is due to the device implementation.

---
 device-types/sound/description.tex | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Quoted 17 lines
Quoted 5 lines
Quoted 5 lines
device-types/sound/description.tex +0 -0
index 54c9c8e..a138e5b 100644
@@ -694,7 +694,10 @@ \subsubsection{PCM I/O Messages}\label{sec:Device Types / Sound Device / Device
Quoted 8 lines

device-types/sound/description.tex \subsubsection{PCM I/O Messages}\label{sec:Device Types / Sound Device / Device · line 700

Quoted 8 lines
device-types/sound/description.tex +4 -1
 \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 additional delay caused by
+the device's implementation. 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.

the last "was recorded" seems agrammatical. Do you mean "has recorded"?

When the device processes a period, e.g. multiples descriptors, it puts it in the used queue, sets the latency_bytes and notifies the driver. For playback, the latency_bytes contains the number of bytes until the buffer is actually played, e.g., if the device notifies the driver just before playing it the value would be 0. For capture, the latency_bytes is the number of bytes that has elapsed since the buffer has been recorded. Coming back to your comment, I could rephrase it as:

During capture, this is the number of bytes since the buffer was recorded.

WDYT?

Quoted 10 lines
Quoted 10 lines
Quoted 6 lines
device-types/sound/description.tex +0 -0
 \end{description}
 
 Since all buffers in the queue (with one exception) should be of the size
Signature · 1 line
2.41.0

Dear TC,

I'd like to request a vote on solving issue 198.

Quoted 8 lines
Quoted 3 lines

Matias

OK. Can you pls add a bit more detail about the issue and the proposal in github?

Yes, I can. Thanks.

Matias.