Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Jan 2012 14:16:45 +0200
From:      Alexander Motin <mav@FreeBSD.org>
To:        =?ISO-8859-1?Q?Micka=EBl_Maillot?= <mickael.maillot@gmail.com>
Cc:        freebsd-multimedia@freebsd.org, FreeBSD current <freebsd-current@freebsd.org>
Subject:   Re: [RFT] Major snd_hda rewrite
Message-ID:  <4F1FF2AD.9020003@FreeBSD.org>
In-Reply-To: <CAKT0JB4LbRPF2UjzPBSNSgRwpmuoyjMBs328-qG4XVJtm=WF7g@mail.gmail.com>
References:  <4F0DE3FD.2020203@FreeBSD.org> <20120112121853.GC1429@procyon.xvoid.org> <4F0ED8D0.8080403@FreeBSD.org> <CAKT0JB5xP__9KacknmkT8_QrC1hsq8Gj5quRY_FvgmB=sJGmSQ@mail.gmail.com> <4F171D7A.4080003@FreeBSD.org> <CAKT0JB6u-b1CTcYVphLnEf-rHCmuSLJJFrYOiiqChJKDYtRHtQ@mail.gmail.com> <4F177979.5010106@FreeBSD.org> <CAKT0JB7k0V42w0WGN1mq4sKgQxqbnf_NoDRZAxPrMGebuvUH2g@mail.gmail.com> <CAKT0JB5zOjmy1R13W%2BbY453VySOkYcShpnHwk8kbT=-yAUC2vQ@mail.gmail.com> <CAKT0JB5xHJ7=UFHDhumsiMqfYGEPV6QyNz2YbHb%2BojOUgw23WA@mail.gmail.com> <4F1ACBA8.6000203@FreeBSD.org> <CAKT0JB7Z=pwv9oryCcu2OV7kHnkXjPj-cYY_=0c6PMbNF1BLTw@mail.gmail.com> <4F1EB305.9000105@FreeBSD.org> <4F1EDD3D.6070800@FreeBSD.org> <CAKT0JB5jAr6VP5Q9sBVG6hFrnn%2BWafEDWT43yKhdXJuWv4U8pw@mail.gmail.com> <4F1F31CA.5000507@FreeBSD.org> <4F1F34DB.9040405@FreeBSD.org> <CAKT0JB7KfOepO9C6dBx7TRoR4qDRQ3V=V69zz=9BFtWOwqhpMQ@mail.gmail.com> <4F1F412D.5040009@FreeBSD.org> <CAKT0JB4LbRPF2UjzPBSNSgRwpmuoyjMBs328-qG4XVJtm=WF7g@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 01/25/12 09:42, Mickaël Maillot wrote:
> 2012/1/25 Alexander Motin <mav@freebsd.org <mailto:mav@freebsd.org>>
>
>
>                 What I've forgot is to allow 8ch format. :) Add the
>         patch below.
>                 Hope
>                 sound(4) has no other limitations for it.
>
>             Hmm. Looks like there is some limitation. You may grep
>         kernel for
>             AFMT_PASSTHROUGH and find two "XXX force ..." comments and code,
>             including forcing 2 channels for AC3. Luckily for not part for
>             frequency is commented out. Further we may try to comment or
>         modify
>             part about number of channels.
>
>         spotted and commented
>
>         so if my problem persist after settings 8 channels, i'll blame
>         xbmc oss
>         part.
>
>
> ok so unfortunately it's does not work :(
> first: with vchan disable, i cant set format to AFMT_AC3, ioctl always
> return -1
> in /v/l/messages:
> Jan 25 08:09:18 htpc kernel: pcm4: chn_setformat(): Format change
> 0x00100400 failed, falling back to 0x00100008
> so may be my change in sys/dev/sound/pcm/channel.c is not good ? i just
> commented:
>      /* XXX force stereo */
>      if (format & AFMT_PASSTHROUGH)
>          format = SND_FORMAT(format, AFMT_PASSTHROUGH_CHANNEL,
>              AFMT_PASSTHROUGH_EXTCHANNEL);

Commenting it appeared not good, as at least mplayer doesn't sets 
channels for AC3. That makes sound(4) use default 1 channel for AC3, 
that is definitely not supported. I believe this should be better:
http://svn.freebsd.org/changeset/base/230537

Also, as soon as sound(4) interprets 8 channel as 7.1 by default, I've 
changed previous patch a bit to allow both "8.0" and "7.1" AC3 formats:
http://svn.freebsd.org/changeset/base/230513

For me this at least doesn't break normal AC3 operation and when I 
hacked mplayer to set 8 channels, I can see predictable codec 
configuration and time in mplayer predictably running 4 times faster. 
Unluckily mplayer seems doesn't support TrueHD passthrough to ckeck 
closer -- it always does decoding.

> next with vchan: i can set ac3 to 2 channels and 8 channels.
> when i try to play DTS HDMA or TRUEHD, i set ac3, 8 channels, 192k
> and no sound ! before i had: dtshdma: some part of sound (like all data
> cant be send) and truehd: some crapy bipbip
> now everything seems to be ok for the player, procstat -f write counter
> grows up, but no sound from my receiver: no channel input, nothing
> showed, like nothing is send to him.
> no error in xbmc.log or in messages:
> Jan 25 08:15:35 htpc kernel: pcm4: chn_start(): VCHAN PARENT starting!
> (PCMDIR_PLAY/running) (ready=8192 force=1 i=1 j=0 intrtimeout=2 latency=2ms)
> Jan 25 08:15:35 htpc kernel: hdac1: 24576Kbps of 92160Kbps bandwidth used
> Jan 25 08:15:35 htpc kernel: pcm4: PCMDIR_PLAY: Stream setup
> fmt=02800400 (7.1) speed=192000
> Jan 25 08:15:35 htpc kernel: pcm4: PCMDIR_PLAY: Stream setup nid=4:
> fmt=0x1817, dfmt=0x0021, chan=0x0010, chan_count=0x07, stripe=1
> Jan 25 08:15:35 htpc kernel: pcm4: chn_trigger() pcm4:play:dsp4.p0:
> calling go=0x00000001 , prev=0xffffffff
> Jan 25 08:15:35 htpc kernel: pcm4: chn_trigger() pcm4:virtual:dsp4.vp0:
> calling go=0x00000001 , prev=0xffffffff

I've tried with both vchans on and off and found no difference. In both 
cases cases I had vchanformat set to "s16le:2.0", as vchan should just 
pass any ac3 through without conversion and set format is not important.

-- 
Alexander Motin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F1FF2AD.9020003>