Skip to contentSkip to conversation

Channels jumping with snd_intel8x0, nforce2 and 5.1 output

DISCUSSION Gorka Olaizola 3 participants 5 messages Jan 4, 2004 – Jan 12, 2004

lore
Share & tools
lore
#0 lore raw

Hello,

I've been experimenting with a Nforce2 mobo during last month and the only thing I couldn't fix is this sound problem with 5.1 surround sound.

I have read all the messages in this and other lists refering this problem and I have tried 3 different versions of alsa drivers (0.9.8, 1.0.0rc2 and latest cvs 1.0.1). All of this present the same problem of jumping channels.

When seeking in mplayer or using speaker_test the channels change their positions randomly.
I know it's a known bug but I want to know if it's on the list of bugs to fix or if it is a bigger problem like lack of documentation or something.

If there is a way I can help or something I can do to isolate this bug tell me.

Thank you

#1 lore raw

At Sun, 4 Jan 2004 18:55:52 +0100,

Quoted 7 lines · Gorka Olaizola

[1 <text/plain; us-ascii (7bit)>]
Hello,

I've been experimenting with a Nforce2 mobo during last month and the only thing I couldn't fix is this sound problem with 5.1 surround sound.

Quoted 8 lines

I have read all the messages in this and other lists refering this problem and I have tried 3 different versions of alsa drivers (0.9.8, 1.0.0rc2 and latest cvs 1.0.1). All of this present the same problem of jumping channels.

When seeking in mplayer or using speaker_test the channels change their positions randomly.
I know it's a known bug but I want to know if it's on the list of bugs to fix or if it is a bigger problem like lack of documentation or something.

does this happen with 4.0 output?

what came into my mind is the alignment problem, if it doesn't happen with 4.0 output. check the period and buffer size shown in /proc/asound/card0/pcm0p/sub0 directory, anyway.

thanks,

Takashi

-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click

#2 lore raw
Quoted 3 lines · Takashi Iwai

does this happen with 4.0 output?

With 4.0 and 4 channels it doesn't seem to happen.

Output while using #speaker_test -Dsurround40 -c 4 -r 48000

cat /proc/asound/card0/pcm0p/sub0/hw_params
access: RW_INTERLEAVED
format: S16_LE
subformat: STD
channels: 4
rate: 48000 (48000/1)
period_size: 1200
buffer_size: 4800
tick_time: 1000

cat /proc/asound/card0/pcm0p/sub0/sw_params
tstamp_mode: NONE
period_step: 1
sleep_min: 0
avail_min: 1200
xfer_align: 1
start_threshold: 4800
stop_threshold: 4800
silence_threshold: 0
silence_size: 0
boundary: 1258291200

cat /proc/asound/card0/pcm0p/sub0/prealloc
64

The output of #speaker_test -Dsurround51 -c 6 -r 48000 is the same than the above one but with 6 channels.

Sometimes, when the channel jumping happens in surround51, playing speaker_test with surround40 scrolls the channels too (The rear speaker play instead the front speaker). Playing speaker_test
again and again in surround40 mode does not seem to scroll the channels. They stay changed until I change them in surround51 mode.

If I change the period_size and buffer_size in the speaker_test code to 1024 and 8192, the values stay the same in surround40 mode but the buffer_size value change to 5120 in surround51 mode. I don't know if it does matter.

#3 lore raw

I think i've found something interesting.

I downloaded de nvaudio driver from Nvidia's site and read the source a bit. I found this function:

void __start_dac(struct Nvaudio_state *state)

{
    int i =0;
    unsigned int i_glob_cnt = 0;
    struct Nvaudio_card *card = state->card;
    struct dmabuf *dmabuf = &state->dmabuffer;

    if (dmabuf->count > 0 && state->ready && !state->enable &&
        (state->trigger & PCM_ENABLE_OUTPUT)) {

----------------------------------------------------------------------

        /* Reset the Global Cnt back to Stereo 16ch and set the format 
           This is needed to keep the 6 channel data in alignment ,
           to start from Front Left always */
        i_glob_cnt = inl(card->iobase + GLOB_CNT);
        outl((i_glob_cnt & 0xcfffff),card->iobase + GLOB_CNT);
        mdelay(50);
        outl(i_glob_cnt,card->iobase + GLOB_CNT);
----------------------------------------------------------------------
        /* Reset the leftover datainfo*/
        for(i=0; i < 5 ; i++)
            AnalogLeftovers[i] = 0;
        AnalogLeftoverCount = 0;

        state->enable = DAC_RUNNING;

        /* Interrupt Enable, LVI Enable, DMA Enable*/
        outb((0x10|0x04|0x01), state->card->iobase + PO_CR);
#ifdef NV_DEBUG_PLAY
        printk("Starting DAC \n");
#endif
    }
}

I translated the part that I thought interesting to the function "snd_intel8x0_setup_multi_channels" in the file intel8x0.c of Alsa (Line
923)

I have added this to the function

	case DEVICE_NFORCE:
		cnt = igetdword(chip, ICHREG(GLOB_CNT));
		cnt &= ~ICH_PCM_246_MASK;
		if (chip->multi4 && channels == 4)
			cnt |= ICH_PCM_4;
		else if (chip->multi6 && channels == 6)
			cnt |= ICH_PCM_6;
		iputdword(chip, ICHREG(GLOB_CNT), (cnt & 0xcfffff));
		mdelay(50);
		iputdword(chip, ICHREG(GLOB_CNT), cnt);
		break;

Now speaker_test works well for me and the sound is coming from the right speaker all the time. But there are some problems.
With mplayer in oss emulation the sound is very choppy and with alsa9:surround51 there are constant cracks and pops.
If I play a DVD with xine with alsa:surround51 the sound seems correct and I don't hear cracks. Maybe mplayer has some problems with alsa 1.0.x

I hope it's useful.

#4 lore raw
Quoted 10 lines · Gorka Olaizola

I downloaded de nvaudio driver from Nvidia's site and read the source a bit.

        /* Reset the Global Cnt back to Stereo 16ch and set the format
           This is needed to keep the 6 channel data in alignment ,
           to start from Front Left always */
        i_glob_cnt = inl(card->iobase + GLOB_CNT);
        outl((i_glob_cnt & 0xcfffff),card->iobase + GLOB_CNT);
        mdelay(50);
        outl(i_glob_cnt,card->iobase + GLOB_CNT);
Quoted 10 lines

I translated the part that I thought interesting to the function "snd_intel8x0_setup_multi_channels" in the file intel8x0.c of Alsa (Line
923)
...
Now speaker_test works well for me and the sound is coming from the right speaker all the time. But there are some problems.
With mplayer in oss emulation the sound is very choppy and with alsa9:surround51 there are constant cracks and pops.
If I play a DVD with xine with alsa:surround51 the sound seems correct and I don't hear cracks. Maybe mplayer has some problems with alsa 1.0.x

I think these problems are not related to your patch.

Please add an explanatory comment to your change, and submit a patch for intel8x0.c.

Regards,
Clemens

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html