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



The following reply was made to PR kern/54474; it has been noted by GNATS.

From: Tetsuya Isaki <isaki%pastel-flower.jp@localhost>
To: Nick Hudson <nick.hudson%gmx.co.uk@localhost>
Cc: gnats-bugs%netbsd.org@localhost,
	gnats-admin%netbsd.org@localhost,
	netbsd-bugs%netbsd.org@localhost
Subject: Re: kern/54474: Jetson TK1 audio playback has clicks since isaki-audio2 merge
Date: Fri, 06 Sep 2019 15:05:37 +0900

 At Wed, 4 Sep 2019 15:45:57 +0100,
 Nick Hudson wrote:
 >  >   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
 > 
 > tk1#  audiocfg set 0 p slinear_le 16 2 41000
 > setting audio0 to slinear_le:16,[ 194.9778959] audio0: slinear_le:16 8ch
 > 44100Hz, blk 40ms for playback
 > [ 194.9878987] audio0: slinear_le:16 2ch 44100Hz, blk 40ms for recording
 >   2ch, 41000Hz
 > ioctl AUDIO_SETFORMAT: Invalid argument
 > couldn't set parameter: Invalid argument
 
 Oops, s/41000/44100/ sorry :-)
 
 >  >   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.
 > It sounds OK with the patch!
 
 Hmm...  The patch cannot attach 6 channel device (like VirtualBox)
 (and that is why I modified it).
 
 The patch has two effects.  One limits the blocksize up to 8192 bytes,
 and the other limits the blocksize a multiple of 128 bytes.  I need to
 know which constraints does TK1 have.
 So would you please try more two tests?
 
 Test1. The following commands make blocksize 7056 bytes.  It is smaller
 than 8192 but not multiple of 128.  If TK1 only supports up to 8192 bytes
 block size, the sound will be clear.
  (make your sys/dev/hdaudio/hdafg.c clean)
  # audiocfg set 0 p slinear_le 16 8 44100   (it's default)
  # sysctl -w hw.audio0.blk_ms=10
  # audiocfg test 0
 
 Test2. The following patch+commands make blocksize multiple of 128 bytes
 but larger than 8192.  If TK1 only supports blocksize that is multiple of
 128 bytes, the sound will be clear.
 
 --- a/sys/dev/hdaudio/hdafg.c
 +++ b/sys/dev/hdaudio/hdafg.c
 @@ -3958,10 +3958,18 @@ 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 < 128)
 +		blksize = 128;
 +
 +	blksize = rounddown(blksize, 128);
 +	printf("%s blksize=%d\n", __func__, blksize);
 +
  	/* Make sure there are enough BDL descriptors */
  	bufsize = st->st_data.dma_size;
 -	if (bufsize > HDAUDIO_BDL_MAX * blksize) {
 +	if (bufsize > HDAUDIO_BDL_MAX * blksize) {
  		blksize = bufsize / HDAUDIO_BDL_MAX;
 +		blksize = rounddown(blksize, 128);
 +		printf("%s blksize2=%d\n", __func__, blksize);
  	}
  	return blksize;
  }
 
  # audiocfg set 0 p slinear_le 16 8 44100  (it's default)
  # sysctl -w hw.audio0.blk_ms=40           (it's default)
  # audiocfg test 0
 
 > I can send you recording of before and after if you want, but the patch
 > seems to fix it.
 
 Don't worry about it, thanks.
 ---
 Tetsuya Isaki <isaki%pastel-flower.jp@localhost / isaki%NetBSD.org@localhost>
 


Home | Main Index | Thread Index | Old Index