[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH 00/27] Virtio sound card implementation
From: |
Gerd Hoffmann |
Subject: |
Re: [RFC PATCH 00/27] Virtio sound card implementation |
Date: |
Fri, 30 Apr 2021 12:56:50 +0200 |
Hi,
> - The output from the sound card is accompanied by periodic
> white noise. I do not know why this is happening. I tried
> debugging it by writing the buffers to a new wav file and
> sure enough the contents of the file were different at
> some places, but I couldn't find what must be causing it.
> (Relevant patches: #19, #20, #21 and #25.) What steps should
> I take for debugging this?
Hmm, I'd try to simplify the code. The two helper functions
virtio_snd_pcm_get_buf() + virtio_snd_pcm_handle_buf_written() look
rather complex to me. I'd suggest to make them handle a single
virtqueue element only. That should make the logic simpler.
The loop in virtio_snd_output_cb() will need to take a few more rounds
then, and virtio_snd_pcm_get_buf() would probably have to return the
number of bytes it actually placed in the buffer so you can pass on that
value to AUD_write().
For actual debugging I typically use trace points or temporary debug
printfs or a combination of both. I'd suggest logging the buffer
handling, filling them from virt queue, writing to AUD, also log the
offset, maybe something goes wrong with partial writes.
> - What is the suggested way of waiting? When the driver issues
> the VIRTIO_SND_PCM_STOP ctrl command I want to wait for the
> buffers existing in tx vq to be consumed before closing the
> stream.
Store a pointer to the virtqueue element, then complete it when
virtio_snd_output_cb() processed all pending buffers.
take care,
Gerd
- [RFC PATCH 20/27] virtio-snd: Add VIRITO_SND_R_PCM_START handler, (continued)
- [RFC PATCH 20/27] virtio-snd: Add VIRITO_SND_R_PCM_START handler, Shreyansh Chouhan, 2021/04/29
- [RFC PATCH 17/27] virtio-snd: Add VIRTIO_SND_R_PCM_PREPARE handler, Shreyansh Chouhan, 2021/04/29
- [RFC PATCH 19/27] virtio-snd: Add callback for SWVoiceOut, Shreyansh Chouhan, 2021/04/29
- [RFC PATCH 23/27] virtio-snd: Replaced goto with if else, Shreyansh Chouhan, 2021/04/29
- [RFC PATCH 22/27] virtio-snd: Add VIRTIO_SND_R_PCM_RELEASE handler, Shreyansh Chouhan, 2021/04/29
- [RFC PATCH 25/27] virtio-snd: Add tx vq and handler, Shreyansh Chouhan, 2021/04/29
- [RFC PATCH 24/27] virtio-snd: Add code to device unrealize function, Shreyansh Chouhan, 2021/04/29
- [RFC PATCH 27/27] virtio-snd: Add rx vq and stub handler, Shreyansh Chouhan, 2021/04/29
- [RFC PATCH 26/27] virtio-snd: Add event vq and a handler stub, Shreyansh Chouhan, 2021/04/29
- Re: [RFC PATCH 00/27] Virtio sound card implementation, no-reply, 2021/04/29
- Re: [RFC PATCH 00/27] Virtio sound card implementation,
Gerd Hoffmann <=