NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/54474: Jetson TK1 audio playback has clicks since isaki-audio2 merge



At Sat, 31 Aug 2019 21:51:23 +0100,
Nick Hudson wrote:
> tk1# audiocfg test 0
> 0: [*] audio0 @ hdafg0: NVIDIA Tegra124 HDMI
>         playback: 8ch, 44100Hz
>         record:   2ch, 44100Hz
>         (P-) slinear_le 16/16, 2ch, { 44100 }
>         (P-) slinear_le 16/16, 4ch, { 44100 }
>         (P-) slinear_le 16/16, 6ch, { 44100 }
>         (P-) slinear_le 16/16, 8ch, { 44100 }
>         (PR) slinear_le 16/16, 2ch, 44100-44100Hz
>    testing channel 0... done
>    testing channel 1... done
>    testing channel 2... done
>    testing channel 3... done
>    testing channel 4... done
>    testing channel 5... done
>    testing channel 6... done
>    testing channel 7... done
> tk1#

Thank you for complementing my missing information.
And the problem "write: Resouce temporarily unavailable" seems gone.
(It's small but good thing to me.)

> The audio is still "clicky"/distorted in some way.
:
> I couldn't hear any audio with this, but then the tk1's fan is really noisy.
> 
> Something is still no quite right with audiocfg test audio output.

Hmm, what happens in 2channels mode instead of 8channels mode?
You can change it by following command on netbsd-9:
  # audiocfg set 0 p slinear_le 16 2 41000
  # audiocfg test 0

Next, would you try the following patch (to netbsd-9)?
This reverts a part of changes I made in isaki-audio2 branch.  The
patch should not improve your problem but I want to confirm it.

Or, would you send me the recorded waveform of "audiocfg test 0"?

Thanks,
---
Tetsuya Isaki <isaki%pastel-flower.jp@localhost / isaki%NetBSD.org@localhost>

diff --git a/sys/dev/hdaudio/hdafg.c b/sys/dev/hdaudio/hdafg.c
index 3609c0095..c693180e9 100644
--- a/sys/dev/hdaudio/hdafg.c
+++ b/sys/dev/hdaudio/hdafg.c
@@ -3940,7 +3940,7 @@ hdafg_round_blocksize(void *opaque, int blksize, int mode,
 {
 	struct hdaudio_audiodev *ad = opaque;
 	struct hdaudio_stream *st;
-	int bufsize;
+	int bufsize, nblksize;
 
 	st = (mode == AUMODE_PLAY) ? ad->ad_playback : ad->ad_capture;
 	if (st == NULL) {
@@ -3958,12 +3958,22 @@ hdafg_round_blocksize(void *opaque, int blksize, int mode,
 	 * https://www.intel.co.jp/content/www/jp/ja/standards/high-definition-audio-specification.html , p70.
 	 */
 
+	if (blksize > 8192)
+		blksize = 8192;
+	else if (blksize < 0)
+		blksize = 128;
+
+	for (nblksize = 128; nblksize < blksize; nblksize <<= 1)
+		;
+
 	/* Make sure there are enough BDL descriptors */
 	bufsize = st->st_data.dma_size;
-	if (bufsize > HDAUDIO_BDL_MAX * blksize) {
+	if (bufsize > HDAUDIO_BDL_MAX * nblksize) {
 		blksize = bufsize / HDAUDIO_BDL_MAX;
+		for (nblksize = 128; nblksize < blksize; nblksize <<= 1)
+			;
 	}
-	return blksize;
+	return nblksize;
 }
 
 static int


Home | Main Index | Thread Index | Old Index