Skip to contentSkip to conversation

2.6.0 sound output - wierd effects

DISCUSSION Martin J. Bligh 12 participants 41 messages Dec 26, 2003 – Jan 3, 2004

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

Upgraded my home desktop to 2.6.0.
Somewhere between 2.5.63 and 2.6.0, sound got screwed up - I've confirmed this happens on mainline, as well as -mjb.

If I leave xmms playing (in random shuffle mode) every 2 minutes or so, I'll get some wierd effect for a few seconds, either static, or the track will mysteriously speed up or slow down. Then all is back to normal for another couple of minutes.

Anyone else seen this, or got any clues? Else I guess I'm stuck playing bisection search.

Advanced Linux Sound Architecture Driver Version 0.9.7 (Thu Sep 25 19:16:36 2003 UTC).
PCI: Found IRQ 11 for device 0000:00:02.7
intel8x0: clocking to 48000
ALSA device list:
#0: SiS SI7012 at 0xdc00, irq 11

AMD Athlon(tm) XP 2100+, no power management or ACPI compiled in.

M.

#1 lore raw
Quoted 11 lines · Martin J. Bligh

Upgraded my home desktop to 2.6.0.
Somewhere between 2.5.63 and 2.6.0, sound got screwed up - I've confirmed this happens on mainline, as well as -mjb.

If I leave xmms playing (in random shuffle mode) every 2 minutes or so, I'll get some wierd effect for a few seconds, either static, or the track will mysteriously speed up or slow down. Then all is back to normal for another couple of minutes.

Anyone else seen this, or got any clues? Else I guess I'm stuck playing bisection search.

I get exactly the same with kernel 2.4 and alsa, intel8x0 ac97, but did not test alsa 1.0rc yet, which mentions "intel8x0 driver fixes, OSS PCM emulation fixes" - perhaps these fixes help.

c'ya
sven

Signature · 2 lines
The Internet treats censorship as a routing problem, and routes around it.
(John Gilmore on http://www.cygnus.com/~gnu/)
#2 lore raw
Quoted 9 lines
Quoted 9 lines

Upgraded my home desktop to 2.6.0.
Somewhere between 2.5.63 and 2.6.0, sound got screwed up - I've confirmed this happens on mainline, as well as -mjb.

If I leave xmms playing (in random shuffle mode) every 2 minutes or so, I'll get some wierd effect for a few seconds, either static, or the track will mysteriously speed up or slow down. Then all is back to normal for another couple of minutes.

Quoted 6 lines
Quoted 2 lines

Anyone else seen this, or got any clues? Else I guess I'm stuck playing bisection search.

I get exactly the same with kernel 2.4 and alsa, intel8x0 ac97, but did not test alsa 1.0rc yet, which mentions "intel8x0 driver fixes, OSS PCM emulation fixes" - perhaps these fixes help.

I tried rc2, the latest from their website, it's still broken.

M.

#3 lore raw
In reply to Martin J. Bligh
Quoted 12 lines · Martin J. Bligh

Upgraded my home desktop to 2.6.0.
Somewhere between 2.5.63 and 2.6.0, sound got screwed up - I've confirmed this happens on mainline, as well as -mjb.

If I leave xmms playing (in random shuffle mode) every 2 minutes or so, I'll get some wierd effect for a few seconds, either static, or the track will mysteriously speed up or slow down. Then all is back to normal for another couple of minutes.

Anyone else seen this, or got any clues? Else I guess I'm stuck playing bisection search.

Quoted 8 lines

Advanced Linux Sound Architecture Driver Version 0.9.7 (Thu Sep 25 19:16:36 2003 UTC).
PCI: Found IRQ 11 for device 0000:00:02.7
intel8x0: clocking to 48000
ALSA device list:
#0: SiS SI7012 at 0xdc00, irq 11

AMD Athlon(tm) XP 2100+, no power management or ACPI compiled in.

I have had this as well, around there, and started using OSS, which worked fine (ICH5 onboard - also). Somewhere when I tried again, it worked fine, so this is what I am using now. What version userland libs/utils ? OSS emulation?

Signature · 1 line
Martin Schlemmer
#4 lore raw

--Martin Schlemmer <[email protected]> wrote (on Saturday, December 27, 2003 00:52:47 +0200):

Quoted 19 lines · Martin J. Bligh
Quoted 18 lines

Upgraded my home desktop to 2.6.0.
Somewhere between 2.5.63 and 2.6.0, sound got screwed up - I've confirmed this happens on mainline, as well as -mjb.

If I leave xmms playing (in random shuffle mode) every 2 minutes or so, I'll get some wierd effect for a few seconds, either static, or the track will mysteriously speed up or slow down. Then all is back to normal for another couple of minutes.

Anyone else seen this, or got any clues? Else I guess I'm stuck playing bisection search.

Advanced Linux Sound Architecture Driver Version 0.9.7 (Thu Sep 25 19:16:36 2003 UTC).
PCI: Found IRQ 11 for device 0000:00:02.7
intel8x0: clocking to 48000
ALSA device list:
# 0: SiS SI7012 at 0xdc00, irq 11

Quoted 10 lines
Quoted 2 lines

AMD Athlon(tm) XP 2100+, no power management or ACPI compiled in.

I have had this as well, around there, and started using OSS, which worked fine (ICH5 onboard - also). Somewhere when I tried again, it worked fine, so this is what I am using now. What version userland libs/utils ? OSS emulation?

Signature · 1 line
Martin Schlemmer

Dunno - I'm not clued up on sound stuff.

$ egrep  '(SOUND|SND|ALSA|OSS)' /boot/config-2.6.0 | egrep -v '^#'
CONFIG_SOUND_GAMEPORT=y
CONFIG_SOUND=y
CONFIG_SND=y
CONFIG_SND_SEQUENCER=y
CONFIG_SND_OSSEMUL=y
CONFIG_SND_MIXER_OSS=y
CONFIG_SND_PCM_OSS=y
CONFIG_SND_SEQUENCER_OSS=y
CONFIG_SND_ENS1371=y
CONFIG_SND_INTEL8X0=y

Userspace stuff is stock Debian Woody, but not sure which libs you want the version of. The following might help, but probably doesn't

M.

PS. 2.5.70 seems to work as well.

$ apt-cache showpkg xmms
Package: xmms
Versions: 
1.2.7-1(/var/lib/apt/lists/ftp.debian.org_debian_dists_stable_main_binary-i386_Packages)(/var/lib/dpkg/status)

Reverse Depends:
eroaster,xmms
xmms-liveice,xmms
xmmsarts,xmms
xmms-wmdiscotux,xmms
xmms-volnorm,xmms
xmms-synaesthesia,xmms
xmms-singit,xmms
xmms-sid,xmms 1.2.5
xmms-shell,xmms
xmms-qbble,xmms
xmms-osd-plugin,xmms 1.2.0
xmms-msa,xmms
xmms-modplug,xmms
xmms-lirc,xmms
xmms-jess,xmms 1.0
xmms-jess,xmms
xmms-infopipe,xmms
xmms-goodnight,xmms
xmms-fmradio,xmms
xmms-flac,xmms
xmms-dev,xmms 0.9.5.1-4
xmms-dev,xmms 1.2.7-1
xmms-crossfade,xmms
xmms-cdread,xmms 1.2.5
xmms-bumpscope,xmms
xmms-alarm,xmms 1.2
wmxmms-spectrum,xmms 0.9.5
wmusic,xmms
rep-xmms,xmms 1.2.4
normalize,xmms
logjam,xmms
libxmms-perl,xmms
junior-sound,xmms
gnomp3,xmms
gkrellmms,xmms
gdancer,xmms
extace,xmms
eroaster,xmms
Dependencies:
1.2.7-1 - libc6 (2 2.2.4-4) libglib1.2 (2 1.2.0) libgtk1.2 (2 1.2.10-4) xlibs (4 4.1.0) unzip (0 (null)) gdk-imlib1 (0 (null)) libart2 (2 1.2.13-5) libdb3 (2 3.2.9-1) libgnome32 (2 1.2.13-5) libgnomesupport0 (2 1.2.13-5) libgnomeui32 (2 1.2.13-5) libgnorba27 (2 1.2.13-5) liborbit0 (2 0.5.12) libpanel-applet0 (2 1.4.0.2-3) libwrap0 (0 (null)) libaudiofile0 (0 (null)) libesd0 (18 0.2.23-1) libesd-alsa0 (2 0.2.23-1) libgl1 (0 (null)) libmikmod2 (2 3.1.9) libogg0 (2 1.0rc3-1) libvorbis0 (2 1.0rc3-1) libxml1 (2 1:1.8.14-3) zlib1g (2 1:1.1.3) x11ampg (0 (null)) x11amp (0 (null)) xmms-vorbis (0 (null)) x11ampg (0 (null)) x11amp (0 (null)) xmms-vorbis (0 (null)) Provides:
1.2.7-1 - xmms-vorbis x11amp x11ampg mp3-decoder
Reverse Provides:

#5 lore raw
Quoted 24 lines · Martin J. Bligh

--Martin Schlemmer <[email protected]> wrote (on Saturday, December 27, 2003 00:52:47 +0200):

Quoted 22 lines · Martin J. Bligh
Quoted 20 lines

Upgraded my home desktop to 2.6.0.
Somewhere between 2.5.63 and 2.6.0, sound got screwed up - I've confirmed this happens on mainline, as well as -mjb.

If I leave xmms playing (in random shuffle mode) every 2 minutes or so, I'll get some wierd effect for a few seconds, either static, or the track will mysteriously speed up or slow down. Then all is back to normal for another couple of minutes.

Anyone else seen this, or got any clues? Else I guess I'm stuck playing bisection search.

Advanced Linux Sound Architecture Driver Version 0.9.7 (Thu Sep 25 19:16:36 2003 UTC).
PCI: Found IRQ 11 for device 0000:00:02.7
intel8x0: clocking to 48000
ALSA device list:
# 0: SiS SI7012 at 0xdc00, irq 11

AMD Athlon(tm) XP 2100+, no power management or ACPI compiled in.

Quoted 9 lines
Quoted 5 lines

I have had this as well, around there, and started using OSS, which worked fine (ICH5 onboard - also). Somewhere when I tried again, it worked fine, so this is what I am using now. What version userland libs/utils ? OSS emulation?

Userspace stuff is stock Debian Woody, but not sure which libs you want the version of. The following might help, but probably doesn't

Over here the your main one if not using oss emu is alsa-lib I used 0.9.8 for most of the time, but latest 1.0_rc[12] works as well. Also for completeness you might include the version of alsa-utils.

Then, what does lsmod give? Also, does xmms use oss or alsa as output driver - switching between the two may or may not improve things?

Signature · 1 line
Martin Schlemmer
#6 lore raw
Quoted 2 lines

Over here the your main one if not using oss emu is alsa-lib I used 0.9.8 for most of the time, but latest 1.0_rc[12] works as well.

Debian doesn't seem to have an alsa-lib exactly.

Package: libalsaplayer0
Versions:
0.99.59-5(/var/lib/apt/lists/ftp.debian.org_debian_dists_stable_main_binary-i386_Packages)(/var/lib/dpkg/status) (provides /usr/lib/libalsaplayer.so.0.0.1)

$ apt-cache showpkg alsaplayer-alsa     
Package: alsaplayer-alsa
Versions: 
0.99.59-5(/var/lib/apt/lists/ftp.debian.org_debian_dists_stable_main_binary-i386_Packages)(/var/lib/dpkg/status)
(provides /usr/lib/alsaplayer/output/libalsa.so)
Quoted 1 line

Also for completeness you might include the version of alsa-utils.

$ apt-cache showpkg alsa-utils
Package: alsa-utils
Versions: 
0.9.0beta12-1(/var/lib/apt/lists/ftp.debian.org_debian_dists_stable_main_binary-i386_Packages)(/var/lib/dpkg/status)
Quoted 1 line

Then, what does lsmod give?

Nothing, as I don't use modules ;-)
I'll attatch the full config.

Quoted 2 lines

Also, does xmms use oss or alsa as output
driver - switching between the two may or may not improve things?

Errm. No idea which it uses, nor can I see anything in it that switches ;-)

M.

PS. Current search gives us that it broke between 2.5.70 and 2.6.0-test3.

#7 lore raw
Quoted 5 lines · Martin J. Bligh
Quoted 2 lines

Over here the your main one if not using oss emu is alsa-lib I used 0.9.8 for most of the time, but latest 1.0_rc[12] works as well.

Debian doesn't seem to have an alsa-lib exactly.

Should provide /usr/lib/libasound.so.2.0.0 (version may differ).

Quoted 5 lines
Quoted 2 lines

Also, does xmms use oss or alsa as output
driver - switching between the two may or may not improve things?

Errm. No idea which it uses, nor can I see anything in it that switches ;-)

If you right click on xmms, and then select options->preferences, on the first page to the bottom there should be output plugin. If you cannot select alsa, see if there is a xmms-alsa or libxmms-alsa plugin. Sorry, I do not know Debian that well.

Basically as sombody else noted - it might be with the OSS emulation, so we want to use native alsa support with xmms ...

Signature · 1 line
Martin Schlemmer
#8 lore raw
Quoted 7 lines · Martin J. Bligh
Quoted 4 lines
Quoted 2 lines

Over here the your main one if not using oss emu is alsa-lib I used 0.9.8 for most of the time, but latest 1.0_rc[12] works as well.

Debian doesn't seem to have an alsa-lib exactly.

Should provide /usr/lib/libasound.so.2.0.0 (version may differ).

Aha, thanks ;-)

$ dpkg -S /usr/lib/libasound.so.2.0.0
libasound2: /usr/lib/libasound.so.2.0.0

Package: libasound2
Versions:
0.9.0beta10a-3(/var/lib/apt/lists/ftp.debian.org_debian_dists_stable_main_binary-i386_Packages)(/var/lib/dpkg/status)

Which is probably horribly old, knowing Debian stable ;-)

Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

Also, does xmms use oss or alsa as output
driver - switching between the two may or may not improve things?

Errm. No idea which it uses, nor can I see anything in it that switches ;-)

If you right click on xmms, and then select options->preferences, on the first page to the bottom there should be output plugin. If you cannot select alsa, see if there is a xmms-alsa or libxmms-alsa plugin. Sorry, I do not know Debian that well.

Thanks, it was on OSS - there's no ALSA selection, nor can I find one. There's probably one in unstable somewhere, but ... see below.

Quoted 2 lines

Basically as sombody else noted - it might be with the OSS emulation, so we want to use native alsa support with xmms ...

I'll play with it - should narrow things down. However, fundamentally, it used to work in 2.5.74, and is broken as of test3 ... that strongly implies to me there's a kernel problem. I'd rather fix OSS emulation if possible, and save everybody migrating to 2.6 from this pain ... ;-)

M.

#9 lore raw
Quoted 8 lines · Martin J. Bligh
Quoted 2 lines

Basically as sombody else noted - it might be with the OSS emulation, so we want to use native alsa support with xmms ...

I'll play with it - should narrow things down. However, fundamentally, it used to work in 2.5.74, and is broken as of test3 ... that strongly implies to me there's a kernel problem. I'd rather fix OSS emulation if possible, and save everybody migrating to 2.6 from this pain ... ;-)

I was using esound compiled with alsa support, but I just killed it and played with oss for some time now - seems still fine this side.

You might try to go to the preferences again, and configure oss plugin, and up the buffer used. On another note - did you try another player than xmms? Using xmms 1.2.8 here, so if Debian that far behind, it may still be an xmms issue ...

Signature · 1 line
Martin Schlemmer
#10 lore raw
In reply to Martin J. Bligh
Quoted 7 lines · Martin J. Bligh
Quoted 4 lines

If you right click on xmms, and then select options->preferences, on the first page to the bottom there should be output plugin. If you cannot select alsa, see if there is a xmms-alsa or libxmms-alsa plugin. Sorry, I do not know Debian that well.

Thanks, it was on OSS - there's no ALSA selection, nor can I find one. There's probably one in unstable somewhere, but ... see below.

Btw, compile xmms yourself - should have alsa then =) Not sure if it will if you build with apt-get from source, or when they started to ship the alsa module with xmms source - think it was not so long ago. Does with 1.2.8 though:

--

# qpkg -v -f /usr/lib/xmms/Output/libALSA.so
media-sound/xmms-1.2.8-r3 *
--
Signature · 1 line
Martin Schlemmer
#11 lore raw
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

If you right click on xmms, and then select options->preferences, on the first page to the bottom there should be output plugin. If you cannot select alsa, see if there is a xmms-alsa or libxmms-alsa plugin. Sorry, I do not know Debian that well.

Quoted 7 lines
Quoted 2 lines

Thanks, it was on OSS - there's no ALSA selection, nor can I find one. There's probably one in unstable somewhere, but ... see below.

Btw, compile xmms yourself - should have alsa then =) Not sure if it will if you build with apt-get from source, or when they started to ship the alsa module with xmms source - think it was not so long ago. Does with 1.2.8 though:

Oh, I understand I could work around the problem in userspace, but that's not the point - something broke in the kernel, presumably OSS emulation. test2 works, test3 doesn't.

I suspect this changeset:

[email protected] 2003-07-28 13:35:31+02:00 perex@cz:/home/perex/bk/linux-sound/linux-sound all diffs ALSA 0.9.6 update
- added __setup() to all midlevel modules
- sequencer protocol 1.0.1
- added timestamping flags for ports
- OSS PCM emulation
- fixed write() behaviour
- added two new options no-silence & whole-frag
- a try to fix OOPSes caused in the rate plugin
- emu10k1 driver
- more support for Audigy/Audigy2 EX
- fixed soundfont locking
- sb16 driver
- fixed fm_res handling (and proc OOPS)
- via82xx driver
- fixed revision check for 8233A
- usbaudio driver
- added a workaround for M-Audio Audiophile USB

Particlarly the bit about OSS PCM emulation ;-)

M.

#12 lore raw
Quoted 8 lines · Martin J. Bligh
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

If you right click on xmms, and then select options->preferences, on the first page to the bottom there should be output plugin. If you cannot select alsa, see if there is a xmms-alsa or libxmms-alsa plugin. Sorry, I do not know Debian that well.

Thanks, it was on OSS - there's no ALSA selection, nor can I find one. There's probably one in unstable somewhere, but ... see below.

Quoted 9 lines
Quoted 4 lines

Btw, compile xmms yourself - should have alsa then =) Not sure if it will if you build with apt-get from source, or when they started to ship the alsa module with xmms source - think it was not so long ago. Does with 1.2.8 though:

Oh, I understand I could work around the problem in userspace, but that's not the point - something broke in the kernel, presumably OSS emulation. test2 works, test3 doesn't.

It might be that there always was a problem in userspace ... Like I said in another mail - its working here now. Also, _did_ you try something else than xmms ... it may be an xmms issue, and not a alsa one ... ?

Signature · 1 line
Martin Schlemmer
#13 lore raw
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 7 lines
Quoted 4 lines

If you right click on xmms, and then select options->preferences, on the first page to the bottom there should be output plugin. If you cannot select alsa, see if there is a xmms-alsa or libxmms-alsa plugin. Sorry, I do not know Debian that well.

Thanks, it was on OSS - there's no ALSA selection, nor can I find one. There's probably one in unstable somewhere, but ... see below.

Btw, compile xmms yourself - should have alsa then =) Not sure if it will if you build with apt-get from source, or when they started to ship the alsa module with xmms source - think it was not so long ago. Does with 1.2.8 though:

Quoted 8 lines
Quoted 4 lines

Oh, I understand I could work around the problem in userspace, but that's not the point - something broke in the kernel, presumably OSS emulation. test2 works, test3 doesn't.

It might be that there always was a problem in userspace ... Like I said in another mail - its working here now. Also, _did_ you try something else than xmms ... it may be an xmms issue, and not a alsa one ... ?

Nope. But I find it hard to believe, given that it's so consistent on switching kernels, and others have had the same problem.

M.

#14 lore raw
In reply to Martin J. Bligh
Quoted 5 lines · Martin J. Bligh

I'll play with it - should narrow things down. However, fundamentally, it used to work in 2.5.74, and is broken as of test3 ... that strongly implies to me there's a kernel problem. I'd rather fix OSS emulation if possible, and save everybody migrating to 2.6 from this pain ... ;-)

Please do, while it would be nice if OSS could be dropped altogether there are a great many commercial and closed source apps that we all need and only currently work with OSS. For example flash player for linux and real player, not to mention a myrid of open source apps that have yet to move to ALSA support. Right now its virtually impossible to live with a kernel with no OSS for people like me who require use of these apps on a daily basis.

-sb

Quoted 8 lines

M.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#15 lore raw
Quoted 7 lines · Stan Bubrouski

Please do, while it would be nice if OSS could be dropped altogether there are a great many commercial and closed source apps that we all need and only currently work with OSS. For example flash player for linux and real player, not to mention a myrid of open source apps that have yet to move to ALSA support. Right now its virtually impossible to live with a kernel with no OSS for people like me who require use of these apps on a daily basis.

Why isn't the OSS emulation layer sufficient?

Rob Love

#16 lore raw
Quoted 9 lines
Quoted 7 lines

Please do, while it would be nice if OSS could be dropped altogether there are a great many commercial and closed source apps that we all need and only currently work with OSS. For example flash player for linux and real player, not to mention a myrid of open source apps that have yet to move to ALSA support. Right now its virtually impossible to live with a kernel with no OSS for people like me who require use of these apps on a daily basis.

Why isn't the OSS emulation layer sufficient?

Because someone broke it ... that's what this thread is about ;-)

Between test2 and test3. I'm guessing it's "ALSA 0.9.6 update" - backing that out from test3 right now, and restesting ...

M.

#17 lore raw
Quoted 1 line · Martin J. Bligh

Because someone broke it ... that's what this thread is about ;-)

Right, sorry :-)

But what does that have to do with OSS remaining in the kernel and the guy I was responding to having to continue to use OSS?

I mean, it is a bug, and we will fix it. Keeping OSS is orthogonal. That was my point.

Rob Love

#18 lore raw
Quoted 6 lines · Rob Love
Quoted 1 line · Martin J. Bligh

Because someone broke it ... that's what this thread is about ;-)

Right, sorry :-)

Heh.

Quoted 3 lines

But what does that have to do with OSS remaining in the kernel and the guy I was responding to having to continue to use OSS?

I'm the guy, I was talking about keeping the emulation layer working, sorry its late specificity has never been a strong point of mine, and tonight is no exception.

Quoted 3 lines

I mean, it is a bug, and we will fix it. Keeping OSS is orthogonal. That was my point.

Agreed.

Quoted 3 lines

Rob Love

-sb

#19 lore raw
In reply to Rob Love

--- Rob Love <[email protected]> a écrit : > On Sat, 2003-12-27 at

Quoted 6 lines · Martin J. Bligh
Quoted 2 lines

Because someone broke it ... that's what this thread is

about ;-)

Right, sorry :-)

Quoted 8 lines

But what does that have to do with OSS remaining in the kernel and the
guy I was responding to having to continue to use OSS?

I mean, it is a bug, and we will fix it. Keeping OSS is orthogonal.
That was my point.

The problem is that alsa is not stable. At least not like oss. I switched from alsa to oss because i could compile oss directly in my kernel
(that was a long time ago).

and when 2.6.0-test apeared i compiled alsa in the kernel but i had
problems with it and came back to oss:
1. SOund was jerky compared to oss (almost inaudible) with oss emulation.
2. doesn't have an btaudio driver and i wasn't been able to compile alsa and oss btaudio driver in the same kernel so i couldn't watch tv with the alsa kernel :-(
3. Many old sound applications require oss (even emulated) And oss emulation is far from stable.

These are my opinions. I hope they will change soon :-)

Quoted 2 lines

Rob Love

Calin

=====
--
A mouse is a device used to point at
the xterm you want to type in.
Kim Alm on a.s.r.

_________________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.yahoo.com

#20 lore raw

OSS sound emulation broken between 2.6.0-test2 and test3

In reply to Stan Bubrouski

Something appears to have broken OSS sound emulation between test2 and test3. Best I can tell (despite the appearance of the BK logs), that included ALSA updates 0.9.5 and 0.9.6. Hopefully someone who understands the sound architecture better than I can fix this?

If I leave xmms playing (in random shuffle mode) every 2 minutes or so, I'll get some wierd effect for a few seconds, either static, or the track will mysteriously speed up or slow down. Then all is back to normal for another couple of minutes.

I cut the core-looking ALSA changes out of test3, and attatch them here. Backing out this patch from test3 makes the problem go away, and sound emulation works normally again. But now I'm stuck - I can't split it further than this. Changelogs for 0.9.5 and 0.9.6 include:

- PCM OSS interface
- implemented POST ioctl
- fixed read() semantics according original OSS API

- OSS PCM emulation
- fixed write() behaviour
- added two new options no-silence & whole-frag
- a try to fix OOPSes caused in the rate plugin

I'll test patches if anyone can come up with anything.

Thanks,

M.

Return-Path: <mbligh@w-mbligh>
X-Sieve: cmu-sieve 2.0
Return-path: <[email protected]>
Envelope-to: mbligh@localhost
Delivery-date: Thu, 31 Jul 2003 23:25:47 -0700
Received: from w-mbligh.beaverton.ibm.com

	([127.0.0.1] helo=mail.aracnet.com ident=mbligh)
	by w-mbligh.beaverton.ibm.com with esmtp (Exim 3.35 #1 (Debian))
	id 19iTMH-0006Y5-00
	for <mbligh@localhost>; Thu, 31 Jul 2003 23:25:45 -0700
Received: from psmtp.com (exprod5mx38.postini.com [12.158.34.195])
	by obsidian.spiritone.com (8.12.9/8.12.8) with SMTP id h716Plgu017805
	for <[email protected]>; Thu, 31 Jul 2003 23:25:47 -0700
Delivered-To: <[email protected]>
Received: from source ([67.72.78.212]) by exprod5mx38.postini.com ([12.158.34.245]) with SMTP;
	Thu, 31 Jul 2003 23:24:50 PDT
Received: ([email protected]) by vger.kernel.org via listexpand
	id S274837AbTHAGYB (ORCPT <rfc822;[email protected]>);
	Fri, 1 Aug 2003 02:24:01 -0400
Received: ([email protected]) by vger.kernel.org id S275118AbTHAGYB
	(ORCPT <rfc822;bk-commits-head-outgoing>);
	Fri, 1 Aug 2003 02:24:01 -0400
Received: from hera.kernel.org ([63.209.29.2]:3986 "EHLO hera.kernel.org")
	by vger.kernel.org with ESMTP id S274837AbTHAGQl (ORCPT
	<rfc822;[email protected]>);
	Fri, 1 Aug 2003 02:16:41 -0400
Received: from hera.kernel.org (dwmw2@localhost [127.0.0.1])
	by hera.kernel.org (8.12.8/8.12.8) with ESMTP id h716GeUk003941
	for <[email protected]>; Thu, 31 Jul 2003 23:16:40 -0700
Received: (from dwmw2@localhost)
	by hera.kernel.org (8.12.8/8.12.8/Submit) id h716GasI003916
	for [email protected]; Thu, 31 Jul 2003 23:16:36 -0700

Message-Id: <[email protected]>
Subject: ALSA 0.9.6 update
Date: Mon, 28 Jul 2003 11:35:31 +0000
From: Linux Kernel Mailing List <[email protected]>
To: [email protected]
X-BK-Repository: hera.kernel.org:/home/dwmw2/BK/linus-2.5
X-BK-ChangeSetKey: [email protected]|ChangeSet|20030728113531|60648
Sender: [email protected]
Precedence: bulk
X-Mailing-List: [email protected]

ChangeSet 1.1595.3.2, 2003/07/28 13:35:31+02:00, [email protected]

ALSA 0.9.6 update
- added __setup() to all midlevel modules
- sequencer protocol 1.0.1
- added timestamping flags for ports
- OSS PCM emulation
- fixed write() behaviour
- added two new options no-silence & whole-frag
- a try to fix OOPSes caused in the rate plugin
- emu10k1 driver
- more support for Audigy/Audigy2 EX
- fixed soundfont locking
- sb16 driver
- fixed fm_res handling (and proc OOPS)
- via82xx driver
- fixed revision check for 8233A
- usbaudio driver
- added a workaround for M-Audio Audiophile USB

# This patch includes the following deltas:
# ChangeSet 1.1595.3.1 -> 1.1595.3.2
# sound/pci/emu10k1/emu10k1.c 1.11 -> 1.12
# Documentation/sound/alsa/ALSA-Configuration.txt 1.10 -> 1.11
# sound/core/seq/seq_clientmgr.c 1.18 -> 1.19
# sound/core/rawmidi.c 1.26 -> 1.27
# include/sound/emu10k1.h 1.16 -> 1.17
# sound/core/oss/pcm_plugin.c 1.5 -> 1.6
# sound/core/oss/plugin_ops.h 1.1 -> 1.2
# sound/core/pcm_native.c 1.36 -> 1.37
# include/sound/version.h 1.61 -> 1.62
# sound/core/pcm_lib.c 1.22 -> 1.23
# sound/core/oss/rate.c 1.3 -> 1.4
# sound/pci/emu10k1/emufx.c 1.23 -> 1.24
# include/sound/asequencer.h 1.5 -> 1.6

#	sound/pci/maestro3.c	1.23    -> 1.24   
#	sound/pci/intel8x0.c	1.36    -> 1.37   
#	  sound/core/timer.c	1.19    -> 1.20   

# include/sound/asound.h 1.15 -> 1.16
# sound/core/sound.c 1.30 -> 1.31
# sound/core/pcm_memory.c 1.10 -> 1.11
# sound/core/seq/seq_ports.h 1.2 -> 1.3
# sound/core/seq/seq_ports.c 1.10 -> 1.11
# include/sound/pcm_oss.h 1.2 -> 1.3
# sound/pci/emu10k1/irq.c 1.7 -> 1.8
# sound/usb/usbaudio.c 1.40 -> 1.41
# sound/synth/emux/soundfont.c 1.4 -> 1.5
# sound/core/oss/pcm_plugin.h 1.2 -> 1.3
# sound/isa/sb/sb16.c 1.18 -> 1.19
# sound/core/rtctimer.c 1.14 -> 1.15
# sound/pci/via82xx.c 1.33 -> 1.34
# sound/pci/emu10k1/emumixer.c 1.8 -> 1.9
# sound/core/oss/pcm_oss.c 1.25 -> 1.26
# sound/drivers/dummy.c 1.17 -> 1.18
# sound/pci/ac97/ac97_patch.c 1.15 -> 1.16
# sound/core/oss/route.c 1.3 -> 1.4
# sound/pci/emu10k1/emu10k1_main.c 1.13 -> 1.14
# sound/core/memalloc.c 1.9 -> 1.10
# include/sound/soundfont.h 1.2 -> 1.3
#

 Documentation/sound/alsa/ALSA-Configuration.txt |    3 
 include/sound/asequencer.h                      |    7 +-
 include/sound/asound.h                          |    3 
 include/sound/emu10k1.h                         |    1 
 include/sound/pcm_oss.h                         |    4 -
 include/sound/soundfont.h                       |    1 
 include/sound/version.h                         |    4 -
 sound/core/memalloc.c                           |   19 +++++
 sound/core/oss/pcm_oss.c                        |   52 +++++++++++++--
 sound/core/oss/pcm_plugin.c                     |   23 +++++-
 sound/core/oss/pcm_plugin.h                     |    1 
 sound/core/oss/plugin_ops.h                     |    2 
 sound/core/oss/rate.c                           |   22 +-----
 sound/core/oss/route.c                          |    4 +
 sound/core/pcm_lib.c                            |    9 --
 sound/core/pcm_memory.c                         |   16 ++++
 sound/core/pcm_native.c                         |   12 ++-
 sound/core/rawmidi.c                            |   20 +++++
 sound/core/rtctimer.c                           |   14 +++-
 sound/core/seq/seq_clientmgr.c                  |   56 +++++++++-------
 sound/core/seq/seq_ports.c                      |   14 ++++
 sound/core/seq/seq_ports.h                      |    3 
 sound/core/sound.c                              |   18 +++++
 sound/core/timer.c                              |   14 +++-
 sound/drivers/dummy.c                           |   26 +++++--
 sound/isa/sb/sb16.c                             |   16 ++++
 sound/pci/ac97/ac97_patch.c                     |   22 ++++++
 sound/pci/emu10k1/emu10k1.c                     |    8 --
 sound/pci/emu10k1/emu10k1_main.c                |    8 ++
 sound/pci/emu10k1/emufx.c                       |   23 ++++--
 sound/pci/emu10k1/emumixer.c                    |   82 ++++++++++++++++++++----
 sound/pci/emu10k1/irq.c                         |   45 ++++++-------
 sound/pci/intel8x0.c                            |    3 
 sound/pci/maestro3.c                            |    7 +-
 sound/pci/via82xx.c                             |    6 -
 sound/synth/emux/soundfont.c                    |   18 +----
 sound/usb/usbaudio.c                            |    8 ++
 37 files changed, 456 insertions(+), 138 deletions(-)
Documentation/sound/alsa/ALSA-Configuration.txt +3 -0
diff -Nru a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt
@@ -1303,6 +1303,9 @@
 	  - direct    don't use plugins
 	  - block     force block mode (rvplayer)
 	  - non-block force non-block mode
+	  - whole-frag  write only whole fragments (optimization affecting
+			playback only)
+	  - no-silence  do not fill silence ahead to avoid clicks
 
   Example: echo "x11amp 128 16384" > /proc/asound/card0/pcm0p/oss
            echo "squake 0 0 disable" > /proc/asound/card0/pcm0c/oss
include/sound/asequencer.h +5 -2
diff -Nru a/include/sound/asequencer.h b/include/sound/asequencer.h
@@ -29,7 +29,7 @@
 #include <sound/asound.h>
 
 /** version of the sequencer */
-#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION (1, 0, 0)
+#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION (1, 0, 1)
 
 /**
  * definition of sequencer event types
@@ -604,6 +604,8 @@
 
 /* misc. conditioning flags */
 #define SNDRV_SEQ_PORT_FLG_GIVEN_PORT	(1<<0)
+#define SNDRV_SEQ_PORT_FLG_TIMESTAMP	(1<<1)
+#define SNDRV_SEQ_PORT_FLG_TIME_REAL	(1<<1)
 
 struct sndrv_seq_port_info {
 	struct sndrv_seq_addr addr;	/* client/port numbers */
@@ -620,7 +622,8 @@
 
 	void *kernel;			/* reserved for kernel use (must be NULL) */
 	unsigned int flags;		/* misc. conditioning */
-	char reserved[60];		/* for future use */
+	unsigned char time_queue;	/* queue # for timestamping */
+	char reserved[59];		/* for future use */
 };
 
 
include/sound/asound.h +2 -1
diff -Nru a/include/sound/asound.h b/include/sound/asound.h
@@ -105,9 +105,10 @@
 	SNDRV_HWDEP_IFACE_ICS2115,	/* Wavetable synth */
 	SNDRV_HWDEP_IFACE_SSCAPE,	/* Ensoniq SoundScape ISA card (MC68EC000) */
 	SNDRV_HWDEP_IFACE_VX,		/* Digigram VX cards */
+	SNDRV_HWDEP_IFACE_MIXART,	/* Digigram miXart cards */
 
 	/* Don't forget to change the following: */
-	SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_VX,
+	SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_MIXART,
 };
 
 struct sndrv_hwdep_info {
include/sound/emu10k1.h +1 -0
diff -Nru a/include/sound/emu10k1.h b/include/sound/emu10k1.h
@@ -931,6 +931,7 @@
 	unsigned long port;			/* I/O port number */
 	struct resource *res_port;
 	int APS: 1,				/* APS flag */
+	    no_ac97: 1,				/* no AC'97 */
 	    tos_link: 1;			/* tos link detected */
 	unsigned int audigy;			/* is Audigy? */
 	unsigned int revision;			/* chip revision */
include/sound/pcm_oss.h +3 -1
diff -Nru a/include/sound/pcm_oss.h b/include/sound/pcm_oss.h
@@ -30,7 +30,9 @@
 	unsigned int disable:1,
 		     direct:1,
 		     block:1,
-		     nonblock:1;
+		     nonblock:1,
+		     wholefrag:1,
+		     nosilence:1;
 	unsigned int periods;
 	unsigned int period_size;
 	snd_pcm_oss_setup_t *next;
include/sound/soundfont.h +0 -1
diff -Nru a/include/sound/soundfont.h b/include/sound/soundfont.h
@@ -95,7 +95,6 @@
 	int zone_locked;	/* locked time for zone */
 	int sample_locked;	/* locked time for sample */
 	snd_sf_callback_t callback;	/* callback functions */
-	char sf_locked;		/* font lock flag */
 	struct semaphore presets_mutex;
 	spinlock_t lock;
 	snd_util_memhdr_t *memhdr;
include/sound/version.h +2 -2
diff -Nru a/include/sound/version.h b/include/sound/version.h
@@ -1,3 +1,3 @@
 /* include/version.h.  Generated by configure.  */
-#define CONFIG_SND_VERSION "0.9.5"
-#define CONFIG_SND_DATE " (Mon Jul 21 08:59:59 2003 UTC)"
+#define CONFIG_SND_VERSION "0.9.6"
+#define CONFIG_SND_DATE " (Mon Jul 28 11:08:42 2003 UTC)"
sound/core/memalloc.c +19 -0
diff -Nru a/sound/core/memalloc.c b/sound/core/memalloc.c
@@ -946,6 +946,25 @@
 module_exit(snd_mem_exit)
 
 
+#ifndef MODULE
+
+/* format is: snd-page-alloc=enable */
+
+static int __init snd_mem_setup(char *str)
+{
+	static unsigned __initdata nr_dev = 0;
+
+	if (nr_dev >= SNDRV_CARDS)
+		return 0;
+	(void)(get_option(&str,&enable[nr_dev]) == 2);
+	nr_dev++;
+	return 1;
+}
+
+__setup("snd-page-alloc=", snd_mem_setup);
+
+#endif
+
 /*
  * exports
  */
sound/core/oss/pcm_oss.c +45 -7

91 lines not on this page · raw message

sound/core/oss/pcm_plugin.c +19 -4
diff -Nru a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c
@@ -56,6 +56,17 @@
 	return 0;
 }
 
+/*
+ *  because some cards might have rates "very close", we ignore
+ *  all "resampling" requests within +-5%
+ */
+static int rate_match(unsigned int src_rate, unsigned int dst_rate)
+{
+	unsigned int low = (src_rate * 95) / 100;
+	unsigned int high = (src_rate * 105) / 100;
+	return dst_rate >= low && dst_rate <= high;
+}
+
 static int snd_pcm_plugin_alloc(snd_pcm_plugin_t *plugin, snd_pcm_uframes_t frames)
 {
 	snd_pcm_plugin_format_t *format;
@@ -80,11 +91,14 @@
 		plugin->buf = vmalloc(size);
 		plugin->buf_frames = frames;
 	}
-	if (!plugin->buf)
+	if (!plugin->buf) {
+		plugin->buf_frames = 0;
 		return -ENOMEM;
+	}
 	c = plugin->buf_channels;
 	if (plugin->access == SNDRV_PCM_ACCESS_RW_INTERLEAVED) {
 		for (channel = 0; channel < format->channels; channel++, c++) {
+			c->frames = frames;
 			c->enabled = 1;
 			c->wanted = 0;
 			c->area.addr = plugin->buf;
@@ -95,6 +109,7 @@
 		snd_assert((size % format->channels) == 0,);
 		size /= format->channels;
 		for (channel = 0; channel < format->channels; channel++, c++) {
+			c->frames = frames;
 			c->enabled = 1;
 			c->wanted = 0;
 			c->area.addr = plugin->buf + (channel * size);
@@ -420,7 +435,7 @@
 
 	/* Format change (linearization) */
 	if ((srcformat.format != dstformat.format ||
-	     srcformat.rate != dstformat.rate ||
+	     !rate_match(srcformat.rate, dstformat.rate) ||
 	     srcformat.channels != dstformat.channels) &&
 	    !snd_pcm_format_linear(srcformat.format)) {
 		if (snd_pcm_format_linear(dstformat.format))
@@ -468,7 +483,7 @@
 				ttable[v * sv + v] = FULL;
 		}
 		tmpformat.channels = dstformat.channels;
-		if (srcformat.rate == dstformat.rate &&
+		if (rate_match(srcformat.rate, dstformat.rate) &&
 		    snd_pcm_format_linear(dstformat.format))
 			tmpformat.format = dstformat.format;
 		err = snd_pcm_plugin_build_route(plug,
@@ -490,7 +505,7 @@
 	}
 
 	/* rate resampling */
-	if (srcformat.rate != dstformat.rate) {
+	if (!rate_match(srcformat.rate, dstformat.rate)) {
 		tmpformat.rate = dstformat.rate;
 		if (srcformat.channels == dstformat.channels &&
 		    snd_pcm_format_linear(dstformat.format))
sound/core/oss/pcm_plugin.h +1 -0
diff -Nru a/sound/core/oss/pcm_plugin.h b/sound/core/oss/pcm_plugin.h
@@ -106,6 +106,7 @@
 typedef struct _snd_pcm_plugin_channel {
 	void *aptr;			/* pointer to the allocated area */
 	snd_pcm_channel_area_t area;
+	snd_pcm_uframes_t frames;	/* allocated frames */
 	unsigned int enabled:1;		/* channel need to be processed */
 	unsigned int wanted:1;		/* channel is wanted */
 } snd_pcm_plugin_channel_t;
sound/core/oss/plugin_ops.h +1 -1
diff -Nru a/sound/core/oss/plugin_ops.h b/sound/core/oss/plugin_ops.h
@@ -323,7 +323,7 @@
 
 #ifdef PUT_S16_LABELS
 /* dst_wid dst_endswap unsigned */
-static void *put_s16_labels[4 * 2 * 2 * 4 * 2] = {
+static void *put_s16_labels[4 * 2 * 2] = {
 	&&put_s16_xx12_xxx1,	 /* 16h ->  8h */
 	&&put_s16_xx12_xxx9,	 /* 16h ^>  8h */
 	&&put_s16_xx12_xxx1,	 /* 16h ->  8s */
sound/core/oss/rate.c +6 -16
diff -Nru a/sound/core/oss/rate.c b/sound/core/oss/rate.c
@@ -85,11 +85,7 @@
 #undef PUT_S16_LABELS
 	void *get = get_s16_labels[data->get];
 	void *put = put_s16_labels[data->put];
-	void *get_s16_end = 0;
 	signed short sample = 0;
-#define GET_S16_END *get_s16_end
-#include "plugin_ops.h"
-#undef GET_S16_END
 	
 	for (channel = 0; channel < plugin->src_format.channels; channel++) {
 		pos = data->pos;
@@ -108,24 +104,16 @@
 		dst_step = dst_channels[channel].area.step / 8;
 		src_frames1 = src_frames;
 		dst_frames1 = dst_frames;
-		if (pos & ~R_MASK) {
-			get_s16_end = &&after_get1;
-			goto *get;
-		after_get1:
-			pos &= R_MASK;
-			S1 = S2;
-			S2 = sample;
-			src += src_step;
-			src_frames1--;
-		}
 		while (dst_frames1-- > 0) {
 			if (pos & ~R_MASK) {
 				pos &= R_MASK;
 				S1 = S2;
 				if (src_frames1-- > 0) {
-					get_s16_end = &&after_get2;
 					goto *get;
-				after_get2:
+#define GET_S16_END after_get
+#include "plugin_ops.h"
+#undef GET_S16_END
+				after_get:
 					S2 = sample;
 					src += src_step;
 				}
@@ -318,6 +306,8 @@
 #endif
 
 	dst_frames = rate_dst_frames(plugin, frames);
+	if (dst_frames > dst_channels[0].frames)
+		dst_frames = dst_channels[0].frames;
 	data = (rate_t *)plugin->extra_data;
 	data->func(plugin, src_channels, dst_channels, frames, dst_frames);
 	return dst_frames;
sound/core/oss/route.c +4 -0
diff -Nru a/sound/core/oss/route.c b/sound/core/oss/route.c
@@ -518,6 +518,10 @@
 	int sign, width, endian;
 	sign = !snd_pcm_format_signed(format);
 	width = snd_pcm_format_width(format) / 8 - 1;
+	if (width < 0 || width > 3) {
+		snd_printk(KERN_ERR "snd-pcm-oss: invalid format %d\n", format);
+		width = 0;
+	}
 #ifdef SNDRV_LITTLE_ENDIAN
 	endian = snd_pcm_format_big_endian(format);
 #else
sound/core/pcm_lib.c +3 -6
diff -Nru a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
@@ -60,13 +60,11 @@
 			return;
 		snd_assert(runtime->silence_filled <= runtime->buffer_size, return);
 		noise_dist = snd_pcm_playback_hw_avail(runtime) + runtime->silence_filled;
-		if (noise_dist > (snd_pcm_sframes_t) runtime->silence_threshold)
+		if (noise_dist >= (snd_pcm_sframes_t) runtime->silence_threshold)
 			return;
 		frames = runtime->silence_threshold - noise_dist;
 		if (frames > runtime->silence_size)
 			frames = runtime->silence_size;
-		else
-			frames = runtime->silence_threshold;
 	} else {
 		if (new_hw_ptr == ULONG_MAX) {	/* initialization */
 			runtime->silence_filled = 0;
@@ -86,10 +84,9 @@
 			if ((snd_pcm_sframes_t)runtime->silence_start < 0)
 				runtime->silence_start += runtime->boundary;
 		}
-		frames = runtime->buffer_size;
+		frames = runtime->buffer_size - runtime->silence_filled;
 	}
-	snd_assert(frames >= runtime->silence_filled, return);
-	frames -= runtime->silence_filled;
+	snd_assert(frames <= runtime->buffer_size, return);
 	if (frames == 0)
 		return;
 	ofs = (runtime->silence_start + runtime->silence_filled) % runtime->buffer_size;
sound/core/pcm_memory.c +16 -0
diff -Nru a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c
@@ -22,6 +22,7 @@
 #include <sound/driver.h>
 #include <asm/io.h>
 #include <linux/time.h>
+#include <linux/init.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/info.h>
@@ -568,3 +569,18 @@
 }
 
 #endif /* CONFIG_PCI */
+
+#ifndef MODULE
+
+/* format is: snd-pcm=preallocate_dma,maximum_substreams */
+
+static int __init alsa_pcm_setup(char *str)
+{
+	(void)(get_option(&str,&preallocate_dma) == 2 &&
+	       get_option(&str,&maximum_substreams) == 2);
+	return 1;
+}
+
+__setup("snd-pcm=", alsa_pcm_setup);
+
+#endif /* ifndef MODULE */
sound/core/pcm_native.c +9 -3
diff -Nru a/sound/core/pcm_native.c b/sound/core/pcm_native.c
@@ -461,9 +461,15 @@
 	if (params->xfer_align == 0 ||
 	    params->xfer_align % runtime->min_align != 0)
 		return -EINVAL;
-	if ((params->silence_threshold != 0 || params->silence_size < runtime->boundary) &&
-	    (params->silence_threshold + params->silence_size > runtime->buffer_size))
-		return -EINVAL;
+	if (params->silence_size >= runtime->boundary) {
+		if (params->silence_threshold != 0)
+			return -EINVAL;
+	} else {
+		if (params->silence_size > params->silence_threshold)
+			return -EINVAL;
+		if (params->silence_threshold > runtime->buffer_size)
+			return -EINVAL;
+	}
 	snd_pcm_stream_lock_irq(substream);
 	runtime->tstamp_mode = params->tstamp_mode;
 	runtime->sleep_min = params->sleep_min;
sound/core/rawmidi.c +20 -0
diff -Nru a/sound/core/rawmidi.c b/sound/core/rawmidi.c
@@ -1630,6 +1630,26 @@
 module_init(alsa_rawmidi_init)
 module_exit(alsa_rawmidi_exit)
 
+#ifndef MODULE
+#ifdef CONFIG_SND_OSSEMUL
+/* format is: snd-rawmidi=midi_map,amidi_map */
+
+static int __init alsa_rawmidi_setup(char *str)
+{
+	static unsigned __initdata nr_dev = 0;
+
+	if (nr_dev >= SNDRV_CARDS)
+		return 0;
+	(void)(get_option(&str,&midi_map[nr_dev]) == 2 &&
+	       get_option(&str,&amidi_map[nr_dev]) == 2);
+	nr_dev++;
+	return 1;
+}
+
+__setup("snd-rawmidi=", alsa_rawmidi_setup);
+#endif /* CONFIG_SND_OSSEMUL */
+#endif /* ifndef MODULE */
+
 EXPORT_SYMBOL(snd_rawmidi_output_params);
 EXPORT_SYMBOL(snd_rawmidi_input_params);
 EXPORT_SYMBOL(snd_rawmidi_drop_output);
sound/core/rtctimer.c +13 -1
diff -Nru a/sound/core/rtctimer.c b/sound/core/rtctimer.c
@@ -57,7 +57,7 @@
 	.stop =		rtctimer_stop,
 };
 
-int rtctimer_freq = RTC_FREQ;		/* frequency */
+static int rtctimer_freq = RTC_FREQ;		/* frequency */
 static snd_timer_t *rtctimer;
 static atomic_t rtc_inc = ATOMIC_INIT(0);
 static rtc_task_t rtc_task;
@@ -181,5 +181,17 @@
 MODULE_PARM_DESC(rtctimer_freq, "timer frequency in Hz");
 
 MODULE_LICENSE("GPL");
+
+#ifndef MODULE
+/* format is: snd-rtctimer=freq */
+
+static int __init rtctimer_setup(char *str)
+{
+	(void)(get_option(&str,&rtctimer_freq) == 2);
+	return 1;
+}
+
+__setup("snd-rtctimer=", rtctimer_setup);
+#endif /* ifndef MODULE */
 
 #endif /* CONFIG_RTC || CONFIG_RTC_MODULE */
sound/core/seq/seq_clientmgr.c +34 -22

80 lines not on this page · raw message

sound/core/seq/seq_ports.c +14 -0
diff -Nru a/sound/core/seq/seq_ports.c b/sound/core/seq/seq_ports.c
@@ -352,6 +352,11 @@
 	port->midi_voices = info->midi_voices;
 	port->synth_voices = info->synth_voices;
 
+	/* timestamping */
+	port->timestamping = (info->flags & SNDRV_SEQ_PORT_FLG_TIMESTAMP) ? 1 : 0;
+	port->time_real = (info->flags & SNDRV_SEQ_PORT_FLG_TIME_REAL) ? 1 : 0;
+	port->time_queue = info->time_queue;
+
 	return 0;
 }
 
@@ -378,6 +383,15 @@
 	info->read_use = port->c_src.count;
 	info->write_use = port->c_dest.count;
 	
+	/* timestamping */
+	info->flags = 0;
+	if (port->timestamping) {
+		info->flags |= SNDRV_SEQ_PORT_FLG_TIMESTAMP;
+		if (port->time_real)
+			info->flags |= SNDRV_SEQ_PORT_FLG_TIME_REAL;
+		info->time_queue = port->time_queue;
+	}
+
 	return 0;
 }
 
sound/core/seq/seq_ports.h +3 -0
diff -Nru a/sound/core/seq/seq_ports.h b/sound/core/seq/seq_ports.h
@@ -74,6 +74,9 @@
 	void *private_data;
 	unsigned int callback_all : 1;
 	unsigned int closing : 1;
+	unsigned int timestamping: 1;
+	unsigned int time_real: 1;
+	int time_queue;
 	
 	/* capability, inport, output, sync */
 	unsigned int capability;	/* port capability bits */
sound/core/sound.c +18 -0
diff -Nru a/sound/core/sound.c b/sound/core/sound.c
@@ -389,6 +389,24 @@
 module_init(alsa_sound_init)
 module_exit(alsa_sound_exit)
 
+#ifndef MODULE
+
+/* format is: snd=major,cards_limit[,device_mode] */
+
+static int __init alsa_sound_setup(char *str)
+{
+	(void)(get_option(&str,&major) == 2 &&
+	       get_option(&str,&cards_limit) == 2);
+#ifdef CONFIG_DEVFS_FS
+	(void)(get_option(&str,&device_mode) == 2);
+#endif
+	return 1;
+}
+
+__setup("snd=", alsa_sound_setup);
+
+#endif /* ifndef MODULE */
+
   /* sound.c */
 EXPORT_SYMBOL(snd_major);
 EXPORT_SYMBOL(snd_ecards_limit);
sound/core/timer.c +13 -1
diff -Nru a/sound/core/timer.c b/sound/core/timer.c
@@ -41,7 +41,7 @@
 #define DEFAULT_TIMER_LIMIT 2
 #endif
 
-int timer_limit = DEFAULT_TIMER_LIMIT;
+static int timer_limit = DEFAULT_TIMER_LIMIT;
 MODULE_AUTHOR("Jaroslav Kysela <[email protected]>, Takashi Iwai <[email protected]>");
 MODULE_DESCRIPTION("ALSA timer interface");
 MODULE_LICENSE("GPL");
@@ -1805,6 +1805,18 @@
 
 module_init(alsa_timer_init)
 module_exit(alsa_timer_exit)
+
+#ifndef MODULE
+/* format is: snd-timer=timer_limit */
+
+static int __init alsa_timer_setup(char *str)
+{
+	(void)(get_option(&str,&timer_limit) == 2);
+	return 1;
+}
+
+__setup("snd-timer=", alsa_timer_setup);
+#endif /* ifndef MODULE */
 
 EXPORT_SYMBOL(snd_timer_open);
 EXPORT_SYMBOL(snd_timer_close);
sound/drivers/dummy.c +20 -6
diff -Nru a/sound/drivers/dummy.c b/sound/drivers/dummy.c
@@ -69,6 +69,15 @@
 #define USE_PERIODS_MAX		255
 #endif
 
+#if 0 /* simple AC97 bridge (intel8x0) with 48kHz AC97 only codec */
+#define USE_FORMATS		SNDRV_PCM_FMTBIT_S16_LE
+#define USE_CHANNELS_MIN	2
+#define USE_CHANNELS_MAX	2
+#define USE_RATE		SNDRV_PCM_RATE_48000
+#define USE_RATE_MIN		48000
+#define USE_RATE_MAX		48000
+#endif
+
 
 /* defaults */
 #ifndef MAX_BUFFER_SIZE
@@ -77,6 +86,11 @@
 #ifndef USE_FORMATS
 #define USE_FORMATS 		(SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE)
 #endif
+#ifndef USE_RATE
+#define USE_RATE		SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000
+#define USE_RATE_MIN		5500
+#define USE_RATE_MAX		48000
+#endif
 #ifndef USE_CHANNELS_MIN
 #define USE_CHANNELS_MIN 	1
 #endif
@@ -271,9 +285,9 @@
 	.info =			(SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
 				 SNDRV_PCM_INFO_MMAP_VALID),
 	.formats =		USE_FORMATS,
-	.rates =		SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
-	.rate_min =		5500,
-	.rate_max =		48000,
+	.rates =		USE_RATE,
+	.rate_min =		USE_RATE_MIN,
+	.rate_max =		USE_RATE_MAX,
 	.channels_min =		USE_CHANNELS_MIN,
 	.channels_max =		USE_CHANNELS_MAX,
 	.buffer_bytes_max =	MAX_BUFFER_SIZE,
@@ -289,9 +303,9 @@
 	.info =			(SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
 				 SNDRV_PCM_INFO_MMAP_VALID),
 	.formats =		USE_FORMATS,
-	.rates =		SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
-	.rate_min =		5500,
-	.rate_max =		48000,
+	.rates =		USE_RATE,
+	.rate_min =		USE_RATE_MIN,
+	.rate_max =		USE_RATE_MAX,
 	.channels_min =		USE_CHANNELS_MIN,
 	.channels_max =		USE_CHANNELS_MAX,
 	.buffer_bytes_max =	MAX_BUFFER_SIZE,
sound/isa/sb/sb16.c +15 -1
diff -Nru a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c
@@ -350,6 +350,18 @@
 
 #endif /* CONFIG_PNP */
 
+static void snd_sb16_free(snd_card_t *card)
+{
+	struct snd_card_sb16 *acard = (struct snd_card_sb16 *)card->private_data;
+        
+	if (acard == NULL)
+		return;
+	if (acard->fm_res) {
+		release_resource(acard->fm_res);
+		kfree_nocheck(acard->fm_res);
+	}
+}
+
 static int __init snd_sb16_probe(int dev,
 				 struct pnp_card_link *pcard,
 				 const struct pnp_card_device_id *pid)
@@ -374,6 +386,7 @@
 	if (card == NULL)
 		return -ENOMEM;
 	acard = (struct snd_card_sb16 *) card->private_data;
+	card->private_free = snd_sb16_free;
 #ifdef CONFIG_PNP
 	if (isapnp[dev]) {
 		if ((err = snd_card_sb16_pnp(dev, acard, pcard, pid))) {
@@ -464,7 +477,8 @@
 
 	if (fm_port[dev] > 0) {
 		if (snd_opl3_create(card, fm_port[dev], fm_port[dev] + 2,
-				    OPL3_HW_OPL3, fm_port[dev] == port[dev],
+				    OPL3_HW_OPL3,
+				    fm_port[dev] == port[dev] || fm_port[dev] == 0x388,
 				    &opl3) < 0) {
 			snd_printk(KERN_ERR PFX "no OPL device at 0x%lx-0x%lx\n",
 				   fm_port[dev], fm_port[dev] + 2);
sound/pci/ac97/ac97_patch.c +22 -0
diff -Nru a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
@@ -650,6 +650,26 @@
 	return 0;
 }
 
+static const snd_kcontrol_new_t snd_ac97_controls_ad1885[] = {
+	AC97_SINGLE("Digital Mono Direct", AC97_AD_MISC, 11, 1, 0),
+	AC97_SINGLE("Digital Audio Mode", AC97_AD_MISC, 12, 1, 0),
+	AC97_SINGLE("Low Power Mixer", AC97_AD_MISC, 14, 1, 0),
+	AC97_SINGLE("Zero Fill DAC", AC97_AD_MISC, 15, 1, 0),
+};
+
+static int patch_ad1885_specific(ac97_t * ac97)
+{
+	int err;
+
+	if ((err = patch_build_controls(ac97, snd_ac97_controls_ad1885, ARRAY_SIZE(snd_ac97_controls_ad1885))) < 0)
+		return err;
+	return 0;
+}
+
+static struct snd_ac97_build_ops patch_ad1885_build_ops = {
+	.build_specific = &patch_ad1885_specific
+};
+
 int patch_ad1885(ac97_t * ac97)
 {
 	unsigned short jack;
@@ -661,6 +681,8 @@
 	/* turn off jack sense bits D8 & D9 */
 	jack = snd_ac97_read(ac97, AC97_AD_JACK_SPDIF);
 	snd_ac97_write_cache(ac97, AC97_AD_JACK_SPDIF, jack | 0x0300);
+
+	ac97->build_ops = &patch_ad1885_build_ops;
 	return 0;
 }
 
sound/pci/emu10k1/emu10k1.c +3 -5
diff -Nru a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c
@@ -135,11 +135,9 @@
 		snd_card_free(card);
 		return err;
 	}		
-	if (!emu->APS) {	/* APS board has not an AC97 mixer */
-		if ((err = snd_emu10k1_mixer(emu)) < 0) {
-			snd_card_free(card);
-			return err;
-		}		
+	if ((err = snd_emu10k1_mixer(emu)) < 0) {
+		snd_card_free(card);
+		return err;
 	}
 	if (emu->audigy) {
 		if ((err = snd_emu10k1_audigy_midi(emu)) < 0) {
sound/pci/emu10k1/emu10k1_main.c +8 -0
diff -Nru a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
@@ -674,6 +674,14 @@
 	if (emu->serial == 0x40011102) {
 		emu->card_type = EMU10K1_CARD_EMUAPS;
 		emu->APS = 1;
+		emu->no_ac97 = 1; /* APS has no AC97 chip */
+	}
+	else if (emu->revision == 4 && emu->serial == 0x10051102) {
+		/* Audigy 2 EX has apparently no effective AC97 controls
+		 * (for both input and output), so we skip the AC97 detections
+		 */
+		snd_printdd(KERN_INFO "Audigy2 EX is detected. skpping ac97.\n");
+		emu->no_ac97 = 1;
 	}
 	
 	emu->fx8010.fxbus_mask = 0x303f;
sound/pci/emu10k1/emufx.c +15 -8
diff -Nru a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
@@ -1238,7 +1238,10 @@
 
 static int __devinit _snd_emu10k1_audigy_init_efx(emu10k1_t *emu)
 {
-	int err, i, z, gpr, tmp, playback, capture, nctl;
+	int err, i, z, gpr, nctl;
+	const int playback = 10;
+	const int capture = playback + (SND_EMU10K1_PLAYBACK_CHANNELS * 2); /* we reserve 10 voices */
+	const int tmp = 0x88;
 	u32 ptr;
 	emu10k1_fx8010_code_t *icode;
 	emu10k1_fx8010_control_gpr_t *controls, *ctl;
@@ -1261,19 +1264,15 @@
 	strcpy(icode->name, "Audigy DSP code for ALSA");
 	ptr = 0;
 	nctl = 0;
-	playback = 10;
-	capture = playback + (SND_EMU10K1_PLAYBACK_CHANNELS * 2); /* we reserve 10 voices */
 	gpr = capture + 10;
-	tmp = 0x88;
 
 	/* stop FX processor */
 	snd_emu10k1_ptr_write(emu, A_DBG, 0, (emu->fx8010.dbg = 0) | A_DBG_SINGLE_STEP);
 
-	/* Wave Playback */
+	/* Wave Playback Volume */
 	A_OP(icode, &ptr, iMAC0, A_GPR(playback), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LEFT));
 	A_OP(icode, &ptr, iMAC0, A_GPR(playback+1), A_C_00000000, A_GPR(gpr+1), A_FXBUS(FXBUS_PCM_RIGHT));
-	snd_emu10k1_init_stereo_control(&controls[nctl++], "Wave Playback Volume", gpr,
-					emu->revision == 4 ? 50 : 100);
+	snd_emu10k1_init_stereo_control(&controls[nctl++], "Wave Playback Volume", gpr, 100);
 	gpr += 2;
 
 	/* Wave Surround Playback */
@@ -1497,6 +1496,14 @@
 	snd_emu10k1_init_stereo_onoff_control(controls + nctl++, "Tone Control - Switch", gpr, 0);
 	gpr += 2;
 
+	/* Master volume for audigy2 */
+	if (emu->revision == 4) {
+		A_OP(icode, &ptr, iMAC0, A_GPR(playback+0+SND_EMU10K1_PLAYBACK_CHANNELS), A_C_00000000, A_GPR(gpr), A_GPR(playback+0+SND_EMU10K1_PLAYBACK_CHANNELS));
+		A_OP(icode, &ptr, iMAC0, A_GPR(playback+1+SND_EMU10K1_PLAYBACK_CHANNELS), A_C_00000000, A_GPR(gpr+1), A_GPR(playback+1+SND_EMU10K1_PLAYBACK_CHANNELS));
+		snd_emu10k1_init_stereo_control(&controls[nctl++], "Wave Master Playback Volume", gpr, 0);
+		gpr += 2;
+	}
+
 	/* digital outputs */
 	A_PUT_STEREO_OUTPUT(A_EXTOUT_FRONT_L, A_EXTOUT_FRONT_R, playback + SND_EMU10K1_PLAYBACK_CHANNELS);
 	A_PUT_STEREO_OUTPUT(A_EXTOUT_REAR_L, A_EXTOUT_REAR_R, playback+2 + SND_EMU10K1_PLAYBACK_CHANNELS);
@@ -1504,7 +1511,7 @@
 	A_PUT_OUTPUT(A_EXTOUT_LFE, playback+5 + SND_EMU10K1_PLAYBACK_CHANNELS);
 
 	/* analog speakers */
-	if (emu->audigy && emu->revision == 4) { /* audigy2 */
+	if (emu->revision == 4) { /* audigy2 */
 		A_PUT_STEREO_OUTPUT(A_EXTOUT_AFRONT_L, A_EXTOUT_AFRONT_R, playback + SND_EMU10K1_PLAYBACK_CHANNELS);
 	} else {
 		A_PUT_STEREO_OUTPUT(A_EXTOUT_AC97_L, A_EXTOUT_AC97_R, playback + SND_EMU10K1_PLAYBACK_CHANNELS);
sound/pci/emu10k1/emumixer.c +71 -11

119 lines not on this page · raw message

sound/pci/emu10k1/irq.c +23 -22

68 lines not on this page · raw message

sound/pci/intel8x0.c +2 -1
diff -Nru a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
@@ -1002,7 +1002,7 @@
 	snd_pcm_runtime_t *runtime = substream->runtime;
 	static unsigned int i, rates[] = {
 		/* ATTENTION: these values depend on the definition in pcm.h! */
-		5512, 8000, 11025, 16000, 22050, 32000, 44100, 480000
+		5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000
 	};
 	int err;
 
@@ -1558,6 +1558,7 @@
 	{ 0x1028, 0x0126, "Dell Optiplex GX260", AC97_TUNE_HP_ONLY },
 	{ 0x1734, 0x0088, "Fujitsu-Siemens D1522", AC97_TUNE_HP_ONLY },
 	{ 0x10f1, 0x2665, "Fujitsu-Siemens Celcius", AC97_TUNE_HP_ONLY },
+	{ 0x110a, 0x0056, "Fujitsu-Siemens Scenic", AC97_TUNE_HP_ONLY },
 	{ 0x8086, 0x4d44, "Intel D850EMV2", AC97_TUNE_HP_ONLY },
 	/* { 0x4144, 0x5360, "AMD64 Motherboard", AC97_TUNE_HP_ONLY }, */ /* FIXME: this seems invalid */
 	{ 0x1043, 0x80b0, "ASUS P4PE Mobo", AC97_TUNE_SWAP_SURROUND },
sound/pci/maestro3.c +6 -1
diff -Nru a/sound/pci/maestro3.c b/sound/pci/maestro3.c
@@ -1535,9 +1535,14 @@
 snd_m3_pcm_pointer(snd_pcm_substream_t * subs)
 {
 	m3_t *chip = snd_pcm_substream_chip(subs);
+	unsigned int ptr;
 	m3_dma_t *s = (m3_dma_t*)subs->runtime->private_data;
 	snd_assert(s != NULL, return 0);
-	return bytes_to_frames(subs->runtime, snd_m3_get_pointer(chip, s, subs));
+
+	spin_lock(&chip->reg_lock);
+	ptr = snd_m3_get_pointer(chip, s, subs);
+	spin_unlock(&chip->reg_lock);
+	return bytes_to_frames(subs->runtime, ptr);
 }
 
 
sound/pci/via82xx.c +3 -3
diff -Nru a/sound/pci/via82xx.c b/sound/pci/via82xx.c
@@ -886,7 +886,7 @@
 		snd_ac97_set_rate(chip->ac97, AC97_PCM_LFE_DAC_RATE, runtime->rate);
 		snd_ac97_set_rate(chip->ac97, AC97_SPDIF, runtime->rate);
 	}
-	if (chip->chip_type == TYPE_VIA8233A)
+	if (chip->revision == VIA_REV_8233A)
 		rbits = 0;
 	else
 		rbits = (0xfffff / 48000) * runtime->rate + ((0xfffff % 48000) * runtime->rate) / 48000;
@@ -928,7 +928,7 @@
 	fmt = (runtime->format == SNDRV_PCM_FORMAT_S16_LE) ? VIA_REG_MULTPLAY_FMT_16BIT : VIA_REG_MULTPLAY_FMT_8BIT;
 	fmt |= runtime->channels << 4;
 	outb(fmt, VIADEV_REG(viadev, OFS_MULTPLAY_FORMAT));
-	if (chip->chip_type == TYPE_VIA8233A)
+	if (chip->revision == VIA_REV_8233A)
 		slots = 0;
 	else {
 		/* set sample number to slot 3, 4, 7, 8, 6, 9 (for VIA8233/C,8235) */
@@ -1108,7 +1108,7 @@
 	if ((err = snd_via82xx_pcm_open(chip, viadev, substream)) < 0)
 		return err;
 	substream->runtime->hw.channels_max = 6;
-	if (chip->chip_type == TYPE_VIA8233A)
+	if (chip->revision == VIA_REV_8233A)
 		snd_pcm_hw_constraint_list(substream->runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, &hw_constraints_channels);
 	return 0;
 }
sound/synth/emux/soundfont.c +6 -12
diff -Nru a/sound/synth/emux/soundfont.c b/sound/synth/emux/soundfont.c
@@ -66,15 +66,11 @@
 static int
 lock_preset(snd_sf_list_t *sflist, int nonblock)
 {
-	unsigned long flags;
-	spin_lock_irqsave(&sflist->lock, flags);
-	if (sflist->sf_locked && nonblock) {
-		spin_unlock_irqrestore(&sflist->lock, flags);
-		return -EBUSY;
-	}
-	spin_unlock_irqrestore(&sflist->lock, flags);
-	down(&sflist->presets_mutex);
-	sflist->sf_locked = 1;
+	if (nonblock) {
+		if (down_trylock(&sflist->presets_mutex))
+			return -EBUSY;
+	} else 
+		down(&sflist->presets_mutex);
 	return 0;
 }
 
@@ -86,7 +82,6 @@
 unlock_preset(snd_sf_list_t *sflist)
 {
 	up(&sflist->presets_mutex);
-	sflist->sf_locked = 0;
 }
 
 
@@ -1356,7 +1351,6 @@
 
 	init_MUTEX(&sflist->presets_mutex);
 	spin_lock_init(&sflist->lock);
-	sflist->sf_locked = 0;
 	sflist->memhdr = hdr;
 
 	if (callback)
@@ -1403,7 +1397,7 @@
 
 /*
  * Remove unlocked samples.
- * The soundcard should be silet before calling this function.
+ * The soundcard should be silent before calling this function.
  */
 int
 snd_soundfont_remove_unlocked(snd_sf_list_t *sflist)
sound/usb/usbaudio.c +8 -0
diff -Nru a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
@@ -2297,6 +2297,14 @@
 			 */
 			fp->attributes &= ~EP_CS_ATTR_SAMPLE_RATE;
 		}
+
+		/* workaround for M-Audio Audiophile USB */
+		if (dev->descriptor.idVendor == 0x0763 &&
+		    dev->descriptor.idProduct == 0x2003) {
+			/* doesn't set the sample rate attribute, but supports it */
+			fp->attributes |= EP_CS_ATTR_SAMPLE_RATE;
+		}
+
 		/*
 		 * plantronics headset and Griffin iMic have set adaptive-in
 		 * although it's really not...

-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#21 lore raw

Re: OSS sound emulation broken between 2.6.0-test2 and test3

Quoted 5 lines · Martin J. Bligh

Something appears to have broken OSS sound emulation between test2 and test3. Best I can tell (despite the appearance of the BK logs), that included ALSA updates 0.9.5 and 0.9.6. Hopefully someone who understands the sound architecture better than I can fix this?

I wont say I understand it, but a quick look seems the major change is the addition of the 'whole-frag' and 'no-silence' opts. You might try the following to revert what 'no-silence' change at least does:

--

 # echo 'xmms 0 0 no-silence' > /proc/asound/card0/pcm0p/oss
 # echo 'xmms 0 0 whole-frag' > /proc/asound/card0/pcm0p/oss
--

and restart xmms. If that do not work, then one of the alsa guys will have to have a look.

Signature · 1 line
Martin Schlemmer
#22 lore raw

Re: OSS sound emulation broken between 2.6.0-test2 and test3

Quoted 7 lines · Martin Schlemmer
Quoted 5 lines · Martin J. Bligh

Something appears to have broken OSS sound emulation between test2 and test3. Best I can tell (despite the appearance of the BK logs), that included ALSA updates 0.9.5 and 0.9.6. Hopefully someone who understands the sound architecture better than I can fix this?

Quoted 8 lines

I wont say I understand it, but a quick look seems the major change is the addition of the 'whole-frag' and 'no-silence' opts. You might try the following to revert what 'no-silence' change at least does:

--

 # echo 'xmms 0 0 no-silence' > /proc/asound/card0/pcm0p/oss
 # echo 'xmms 0 0 whole-frag' > /proc/asound/card0/pcm0p/oss
--

Thanks, that fixes it for me. I too have been seeing terrible problems with XMMS since the early 2.6 pre- kernels.

Because it only happens in XMMS I thought it was one of those application bugs brought out by scheduler changes. I now use Zinf BTW -It's better for large music collections (although not as stable or flash).

I guess someone ought to revert the standard behaviour.

Ed-T.

Quoted 2 lines

and restart xmms. If that do not work, then one of the alsa guys will have to have a look.

#23 lore raw

Re: OSS sound emulation broken between 2.6.0-test2 and test3

Quoted 17 lines · Edward Tandi
Quoted 7 lines · Martin Schlemmer
Quoted 5 lines · Martin J. Bligh

Something appears to have broken OSS sound emulation between test2 and test3. Best I can tell (despite the appearance of the BK logs), that included ALSA updates 0.9.5 and 0.9.6. Hopefully someone who understands the sound architecture better than I can fix this?

Quoted 8 lines

I wont say I understand it, but a quick look seems the major change is the addition of the 'whole-frag' and 'no-silence' opts. You might try the following to revert what 'no-silence' change at least does:

--

 # echo 'xmms 0 0 no-silence' > /proc/asound/card0/pcm0p/oss
 # echo 'xmms 0 0 whole-frag' > /proc/asound/card0/pcm0p/oss
--
Quoted 8 lines

Thanks, that fixes it for me. I too have been seeing terrible problems with XMMS since the early 2.6 pre- kernels.

Because it only happens in XMMS I thought it was one of those application bugs brought out by scheduler changes. I now use Zinf BTW -It's better for large music collections (although not as stable or flash).

Can you check which one actually fixes it ?

Thanks,

Signature · 1 line
Martin Schlemmer
#24 lore raw

Re: OSS sound emulation broken between 2.6.0-test2 and test3

Quoted 21 lines · Martin Schlemmer
Quoted 20 lines · Edward Tandi
Quoted 7 lines · Martin Schlemmer
Quoted 5 lines · Martin J. Bligh

Something appears to have broken OSS sound emulation between test2 and test3. Best I can tell (despite the appearance of the BK logs), that included ALSA updates 0.9.5 and 0.9.6. Hopefully someone who understands the sound architecture better than I can fix this?

Quoted 8 lines

I wont say I understand it, but a quick look seems the major change is the addition of the 'whole-frag' and 'no-silence' opts. You might try the following to revert what 'no-silence' change at least does:

--

 # echo 'xmms 0 0 no-silence' > /proc/asound/card0/pcm0p/oss
 # echo 'xmms 0 0 whole-frag' > /proc/asound/card0/pcm0p/oss
--

Thanks, that fixes it for me. I too have been seeing terrible problems with XMMS since the early 2.6 pre- kernels.

Quoted 7 lines
Quoted 5 lines

Because it only happens in XMMS I thought it was one of those application bugs brought out by scheduler changes. I now use Zinf BTW -It's better for large music collections (although not as stable or flash).

Can you check which one actually fixes it ?

Yes, its the 'whole-frag' line.

Ed-T.

#25 lore raw

Re: OSS sound emulation broken between 2.6.0-test2 and test3

Quoted 28 lines · Edward Tandi
Quoted 27 lines · Martin Schlemmer
Quoted 25 lines · Edward Tandi
Quoted 7 lines · Martin Schlemmer
Quoted 5 lines · Martin J. Bligh

Something appears to have broken OSS sound emulation between test2 and test3. Best I can tell (despite the appearance of the BK logs), that included ALSA updates 0.9.5 and 0.9.6. Hopefully someone who understands the sound architecture better than I can fix this?

Quoted 8 lines

I wont say I understand it, but a quick look seems the major change is the addition of the 'whole-frag' and 'no-silence' opts. You might try the following to revert what 'no-silence' change at least does:

--

 # echo 'xmms 0 0 no-silence' > /proc/asound/card0/pcm0p/oss
 # echo 'xmms 0 0 whole-frag' > /proc/asound/card0/pcm0p/oss
--

Thanks, that fixes it for me. I too have been seeing terrible problems with XMMS since the early 2.6 pre- kernels.

Because it only happens in XMMS I thought it was one of those application bugs brought out by scheduler changes. I now use Zinf BTW -It's better for large music collections (although not as stable or flash).

Quoted 4 lines
Quoted 1 line

Can you check which one actually fixes it ?

Yes, its the 'whole-frag' line.

Well, I can't say I can see why. In snd_pcm_oss_write1 where the change for whole-frag was, I cannot see a race or such. The only possible causes I can see, is that:
1) xmms's scheduling gets screwed due to the short writes
2) some drivers may have issues with getting short writes all the time.

Only problem with 2), is that Zinf works fine for you, so I guess the only thing to assume is that either Zinf do not use OSS, but ALSA interface, or that 1) is indeed the correct answer. What version of XMMS do you use btw?

Signature · 1 line
Martin Schlemmer
#26 lore raw

Re: OSS sound emulation broken between 2.6.0-test2 and test3

Quoted 40 lines · Martin Schlemmer
Quoted 28 lines · Edward Tandi
Quoted 27 lines · Martin Schlemmer
Quoted 25 lines · Edward Tandi
Quoted 7 lines · Martin Schlemmer
Quoted 5 lines · Martin J. Bligh

Something appears to have broken OSS sound emulation between test2 and test3. Best I can tell (despite the appearance of the BK logs), that included ALSA updates 0.9.5 and 0.9.6. Hopefully someone who understands the sound architecture better than I can fix this?

Quoted 8 lines

I wont say I understand it, but a quick look seems the major change is the addition of the 'whole-frag' and 'no-silence' opts. You might try the following to revert what 'no-silence' change at least does:

--

 # echo 'xmms 0 0 no-silence' > /proc/asound/card0/pcm0p/oss
 # echo 'xmms 0 0 whole-frag' > /proc/asound/card0/pcm0p/oss
--

Thanks, that fixes it for me. I too have been seeing terrible problems with XMMS since the early 2.6 pre- kernels.

Because it only happens in XMMS I thought it was one of those application bugs brought out by scheduler changes. I now use Zinf BTW -It's better for large music collections (although not as stable or flash).

Quoted 4 lines
Quoted 1 line

Can you check which one actually fixes it ?

Yes, its the 'whole-frag' line.

Well, I can't say I can see why. In snd_pcm_oss_write1 where the change for whole-frag was, I cannot see a race or such. The only possible causes I can see, is that:
1) xmms's scheduling gets screwed due to the short writes
2) some drivers may have issues with getting short writes all the time.

Quoted 4 lines

Only problem with 2), is that Zinf works fine for you, so I guess the only thing to assume is that either Zinf do not use OSS, but ALSA interface, or that 1) is indeed the correct answer. What version of XMMS do you use btw?

I was originally running 1.2.7 when I first encountered the problem. I then built 1.2.8 -but no difference.

Zinf does indeed use the ALSA interface (as most apps do nowadays).

I would say the symptoms are that the music starts playing OK bit after a short period (18-19 seconds), the music changes overall speed (by a semi-tone or so). When it does this, the sound also starts to break up. This is why I associated the problem with the process scheduling changes being made at the time.

It could be a driver issue. FYI, I am using a VIA KT400 chipset. Any one know of any low-level timing issues with the KT400?

Ed-T.

#27 lore raw

Re: OSS sound emulation broken between 2.6.0-test2 and test3

Quoted 46 lines · Edward Tandi
Quoted 40 lines · Martin Schlemmer
Quoted 28 lines · Edward Tandi
Quoted 27 lines · Martin Schlemmer
Quoted 25 lines · Edward Tandi
Quoted 7 lines · Martin Schlemmer
Quoted 5 lines · Martin J. Bligh

Something appears to have broken OSS sound emulation between test2 and test3. Best I can tell (despite the appearance of the BK logs), that included ALSA updates 0.9.5 and 0.9.6. Hopefully someone who understands the sound architecture better than I can fix this?

Quoted 8 lines

I wont say I understand it, but a quick look seems the major change is the addition of the 'whole-frag' and 'no-silence' opts. You might try the following to revert what 'no-silence' change at least does:

--

 # echo 'xmms 0 0 no-silence' > /proc/asound/card0/pcm0p/oss
 # echo 'xmms 0 0 whole-frag' > /proc/asound/card0/pcm0p/oss
--

Thanks, that fixes it for me. I too have been seeing terrible problems with XMMS since the early 2.6 pre- kernels.

Because it only happens in XMMS I thought it was one of those application bugs brought out by scheduler changes. I now use Zinf BTW -It's better for large music collections (although not as stable or flash).

Quoted 4 lines
Quoted 1 line

Can you check which one actually fixes it ?

Yes, its the 'whole-frag' line.

Well, I can't say I can see why. In snd_pcm_oss_write1 where the change for whole-frag was, I cannot see a race or such. The only possible causes I can see, is that:
1) xmms's scheduling gets screwed due to the short writes
2) some drivers may have issues with getting short writes all the time.

Quoted 4 lines

Only problem with 2), is that Zinf works fine for you, so I guess the only thing to assume is that either Zinf do not use OSS, but ALSA interface, or that 1) is indeed the correct answer. What version of XMMS do you use btw?

Quoted 5 lines

I was originally running 1.2.7 when I first encountered the problem. I then built 1.2.8 -but no difference.

Zinf does indeed use the ALSA interface (as most apps do nowadays).

Ok, so it still can go either way.

Quoted 6 lines

I would say the symptoms are that the music starts playing OK bit after a short period (18-19 seconds), the music changes overall speed (by a semi-tone or so). When it does this, the sound also starts to break up. This is why I associated the problem with the process scheduling changes being made at the time.

I do not use the default scheduler - I attached Nick's one, with a context-switch-accounting-fix.patch which should be applied before sched-rollup-v19a.patch ... I cannot reboot now with vanilla to test if this will break things for me again (until weekend is past), but you may try with it and see if the scheduler theory is correct.

Quoted 3 lines

It could be a driver issue. FYI, I am using a VIA KT400 chipset. Any one know of any low-level timing issues with the KT400?

I do not have a box with this chipset, so I do not follow related threads, sorry.

Signature · 1 line
Martin Schlemmer

From: Nick Piggin <[email protected]>

Make sure to count kernel preemption as a context switch. A short cut has been preventing it.

 kernel/sched.c |   37 +++++++++++++++----------------------
 1 files changed, 15 insertions(+), 22 deletions(-)
kernel/sched.c renamed from kernel/sched.c~context-switch-accounting-fix +15 -22
diff -puN kernel/sched.c~context-switch-accounting-fix kernel/sched.c
@@ -1513,33 +1513,20 @@ need_resched:
 
 	spin_lock_irq(&rq->lock);
 
-	/*
-	 * if entering off of a kernel preemption go straight
-	 * to picking the next task.
-	 */
-	if (unlikely(preempt_count() & PREEMPT_ACTIVE))
-		goto pick_next_task;
-
-	switch (prev->state) {
-	case TASK_INTERRUPTIBLE:
-		if (unlikely(signal_pending(prev))) {
+	if (prev->state != TASK_RUNNING &&
+			likely(!(preempt_count() & PREEMPT_ACTIVE)) ) {
+		if (unlikely(signal_pending(prev)) &&
+				prev->state == TASK_INTERRUPTIBLE)
 			prev->state = TASK_RUNNING;
-			break;
-		}
-	default:
-		deactivate_task(prev, rq);
-		prev->nvcsw++;
-		break;
-	case TASK_RUNNING:
-		prev->nivcsw++;
+		else
+			deactivate_task(prev, rq);
 	}
-pick_next_task:
-	if (unlikely(!rq->nr_running)) {
+
 #ifdef CONFIG_SMP
+	if (unlikely(!rq->nr_running))
 		load_balance(rq, 1, cpu_to_node_mask(smp_processor_id()));
-		if (rq->nr_running)
-			goto pick_next_task;
 #endif
+	if (unlikely(!rq->nr_running)) {
 		next = rq->idle;
 		rq->expired_timestamp = 0;
 		goto switch_tasks;
@@ -1586,6 +1573,12 @@ switch_tasks:
 	prev->timestamp = now;
 
 	if (likely(prev != next)) {
+		if (prev->state == TASK_RUNNING ||
+				unlikely(preempt_count() & PREEMPT_ACTIVE))
+			prev->nivcsw++;
+		else
+			prev->nvcsw++;
+
 		next->timestamp = now;
 		rq->nr_switches++;
 		rq->curr = next;

_

 linux-2.6-npiggin/arch/i386/kernel/smpboot.c |    4 
 linux-2.6-npiggin/fs/proc/array.c            |    8 
 linux-2.6-npiggin/include/linux/init_task.h  |    4 
 linux-2.6-npiggin/include/linux/sched.h      |   12 
 linux-2.6-npiggin/include/linux/topology.h   |    8 
 linux-2.6-npiggin/init/main.c                |    1 
 linux-2.6-npiggin/kernel/fork.c              |   30 
 linux-2.6-npiggin/kernel/sched.c             | 1237 ++++++++++++++-------------
 8 files changed, 688 insertions(+), 616 deletions(-)
arch/i386/kernel/smpboot.c renamed from arch/i386/kernel/smpboot.c~rollup +2 -2
diff -puN arch/i386/kernel/smpboot.c~rollup arch/i386/kernel/smpboot.c
@@ -915,13 +915,13 @@ static void smp_tune_scheduling (void)
 		cacheflush_time = (cpu_khz>>10) * (cachesize<<10) / bandwidth;
 	}
 
-	cache_decay_ticks = (long)cacheflush_time/cpu_khz + 1;
+	cache_decay_ticks = (long)cacheflush_time/cpu_khz * HZ / 1000;
 
 	printk("per-CPU timeslice cutoff: %ld.%02ld usecs.\n",
 		(long)cacheflush_time/(cpu_khz/1000),
 		((long)cacheflush_time*100/(cpu_khz/1000)) % 100);
 	printk("task migration cache decay timeout: %ld msecs.\n",
-		cache_decay_ticks);
+		(cache_decay_ticks + 1) * 1000 / HZ);
 }
 
 /*
fs/proc/array.c renamed from fs/proc/array.c~rollup +5 -3
diff -puN fs/proc/array.c~rollup fs/proc/array.c
@@ -154,7 +154,9 @@ static inline char * task_state(struct t
 	read_lock(&tasklist_lock);
 	buffer += sprintf(buffer,
 		"State:\t%s\n"
-		"SleepAVG:\t%lu%%\n"
+		"sleep_avg:\t%lu\n"
+		"sleep_time:\t%lu\n"
+		"total_time:\t%lu\n"
 		"Tgid:\t%d\n"
 		"Pid:\t%d\n"
 		"PPid:\t%d\n"
@@ -162,8 +164,8 @@ static inline char * task_state(struct t
 		"Uid:\t%d\t%d\t%d\t%d\n"
 		"Gid:\t%d\t%d\t%d\t%d\n",
 		get_task_state(p),
-		(p->sleep_avg/1024)*100/(1000000000/1024),
-	       	p->tgid,
+		p->sleep_avg, p->sleep_time, p->total_time,
+		p->tgid,
 		p->pid, p->pid ? p->real_parent->pid : 0,
 		p->pid && p->ptrace ? p->parent->pid : 0,
 		p->uid, p->euid, p->suid, p->fsuid,
include/linux/init_task.h renamed from include/linux/init_task.h~rollup +2 -2
diff -puN include/linux/init_task.h~rollup include/linux/init_task.h
@@ -67,8 +67,8 @@
 	.usage		= ATOMIC_INIT(2),				\
 	.flags		= 0,						\
 	.lock_depth	= -1,						\
-	.prio		= MAX_PRIO-20,					\
-	.static_prio	= MAX_PRIO-20,					\
+	.prio		= MAX_PRIO-30,					\
+	.static_prio	= MAX_PRIO-30,					\
 	.policy		= SCHED_NORMAL,					\
 	.cpus_allowed	= CPU_MASK_ALL,					\
 	.mm		= NULL,						\
include/linux/sched.h renamed from include/linux/sched.h~rollup +8 -4
diff -puN include/linux/sched.h~rollup include/linux/sched.h
@@ -283,7 +283,7 @@ struct signal_struct {
 #define MAX_USER_RT_PRIO	100
 #define MAX_RT_PRIO		MAX_USER_RT_PRIO
 
-#define MAX_PRIO		(MAX_RT_PRIO + 40)
+#define MAX_PRIO		(MAX_RT_PRIO + 59)
 
 #define rt_task(p)		((p)->prio < MAX_RT_PRIO)
 
@@ -344,14 +344,17 @@ struct task_struct {
 	struct list_head run_list;
 	prio_array_t *array;
 
+	/* Scheduler variables follow. kernel/sched.c */
+	unsigned long array_sequence;
+	unsigned long timestamp;
+
+	unsigned long total_time, sleep_time;
 	unsigned long sleep_avg;
-	long interactive_credit;
-	unsigned long long timestamp;
-	int activated;
 
 	unsigned long policy;
 	cpumask_t cpus_allowed;
 	unsigned int time_slice, first_time_slice;
+	unsigned int used_slice;
 
 	struct list_head tasks;
 	struct list_head ptrace_children;
@@ -588,6 +591,7 @@ extern int FASTCALL(wake_up_process(stru
  static inline void kick_process(struct task_struct *tsk) { }
 #endif
 extern void FASTCALL(wake_up_forked_process(struct task_struct * tsk));
+extern void FASTCALL(sched_fork(task_t * p));
 extern void FASTCALL(sched_exit(task_t * p));
 
 asmlinkage long sys_wait4(pid_t pid,unsigned int * stat_addr, int options, struct rusage * ru);
include/linux/topology.h renamed from include/linux/topology.h~rollup +8 -0
diff -puN include/linux/topology.h~rollup include/linux/topology.h
@@ -54,4 +54,12 @@ static inline int __next_node_with_cpus(
 #define for_each_node_with_cpus(node) \
 	for (node = 0; node < numnodes; node = __next_node_with_cpus(node))
 
+#ifndef NUMA_FACTOR_BONUS
+/*
+ * High NUMA_FACTOR_BONUS means rare cross-node load balancing. The default
+ * value of 20 means node rebalance after 10 failed local balances,
+ * Should be tuned for each platform in asm/topology.h.
+ */
+#define NUMA_FACTOR_BONUS (HZ/50 ?: 1)
+#endif
 #endif /* _LINUX_TOPOLOGY_H */
init/main.c renamed from init/main.c~rollup +0 -1
diff -puN init/main.c~rollup init/main.c
@@ -549,7 +549,6 @@ static void do_pre_smp_initcalls(void)
 
 	migration_init();
 #endif
-	node_nr_running_init();
 	spawn_ksoftirqd();
 }
 
kernel/fork.c renamed from kernel/fork.c~rollup +3 -27
diff -puN kernel/fork.c~rollup kernel/fork.c
@@ -958,33 +958,9 @@ struct task_struct *copy_process(unsigne
 	p->exit_signal = (clone_flags & CLONE_THREAD) ? -1 : (clone_flags & CSIGNAL);
 	p->pdeath_signal = 0;
 
-	/*
-	 * Share the timeslice between parent and child, thus the
-	 * total amount of pending timeslices in the system doesn't change,
-	 * resulting in more scheduling fairness.
-	 */
-	local_irq_disable();
-        p->time_slice = (current->time_slice + 1) >> 1;
-	/*
-	 * The remainder of the first timeslice might be recovered by
-	 * the parent if the child exits early enough.
-	 */
-	p->first_time_slice = 1;
-	current->time_slice >>= 1;
-	p->timestamp = sched_clock();
-	if (!current->time_slice) {
-		/*
-	 	 * This case is rare, it happens when the parent has only
-	 	 * a single jiffy left from its timeslice. Taking the
-		 * runqueue lock is not a problem.
-		 */
-		current->time_slice = 1;
-		preempt_disable();
-		scheduler_tick(0, 0);
-		local_irq_enable();
-		preempt_enable();
-	} else
-		local_irq_enable();
+	/* Perform scheduler related accounting */
+	sched_fork(p);
+
 	/*
 	 * Ok, add it to the run-queues and make it
 	 * visible to the rest of the system.
kernel/sched.c renamed from kernel/sched.c~rollup +660 -577

1,696 lines not on this page · raw message

_

#28 lore raw

Re: OSS sound emulation broken between 2.6.0-test2 and test3

In reply to Edward Tandi
Quoted 3 lines · In <[email protected]> Edward Tandi <[email protected]> writes:

I would say the symptoms are that the music starts playing OK bit after a short period (18-19 seconds), the music changes overall speed (by a semi-tone or so). When it does this, the sound also starts to break up.

Just a "me too" post - I've been trying out 2.6.0 over the past couple of days, and this is the only real issue I've encountered. Just like you describe, the pace of the music playing speeds up slightly, and there are some mis-sounds for a few seconds. Then it comes back to normal.

Quoted 1 line

It could be a driver issue. FYI, I am using a VIA KT400 chipset.

Could be. I have the same chipset (KT400A, actually).

Signature · 1 line
Henrik Storner
#29 lore raw

Re: OSS sound emulation broken between 2.6.0-test2 and test3

Quoted 11 lines · Henrik Storner
Quoted 3 lines · In <[email protected]> Edward Tandi <[email protected]> writes:

I would say the symptoms are that the music starts playing OK bit after a short period (18-19 seconds), the music changes overall speed (by a semi-tone or so). When it does this, the sound also starts to break up.

Just a "me too" post - I've been trying out 2.6.0 over the past couple of days, and this is the only real issue I've encountered. Just like you describe, the pace of the music playing speeds up slightly, and there are some mis-sounds for a few seconds. Then it comes back to normal.

Yes, it lasts for about 5 seconds then continues as normal. The problem then re-occurs about 1.5-2.5 minutes after that. The recurrence after that becomes harder to predict.

Interestingly, if you leave XMMS playing long enough (over an hour) such as listening to a vorbis radio stream, it finally goes into permanent break-up mode. It's so bad that you really have to stop playing and start again (no need to shut down XMMS though).

Ed-T.

#30 lore raw

Re: OSS sound emulation broken between 2.6.0-test2 and test3

In reply to Edward Tandi
Quoted 18 lines
Quoted 6 lines
Quoted 5 lines

Something appears to have broken OSS sound emulation between test2 and test3. Best I can tell (despite the appearance of the BK logs), that included ALSA updates 0.9.5 and 0.9.6. Hopefully someone who understands the sound architecture better than I can fix this?

Quoted 8 lines

I wont say I understand it, but a quick look seems the major change is the addition of the 'whole-frag' and 'no-silence' opts. You might try the following to revert what 'no-silence' change at least does:

--

 # echo 'xmms 0 0 no-silence' > /proc/asound/card0/pcm0p/oss
 # echo 'xmms 0 0 whole-frag' > /proc/asound/card0/pcm0p/oss
--

Thanks, that fixes it for me. I too have been seeing terrible problems with XMMS since the early 2.6 pre- kernels.

Quoted 6 lines

Because it only happens in XMMS I thought it was one of those application bugs brought out by scheduler changes. I now use Zinf BTW -It's better for large music collections (although not as stable or flash).

I guess someone ought to revert the standard behaviour.

OK, the following patch from Andrew fixes it up 80% or so, but I still don't think it's as good as test2 was - turning on whole-frag seems to fix the rest of it. It's much more difficult to tell now though, so I'd like other people's opinions on it. If you want to switch between the two, the above switches it on, and:

# echo 'clear' > /proc/asound/card0/pcm0p/oss

switches whole-frag back off. I'm using a 192kbps MP3 to test it, repeating the first 30s of the same song again and again (I'm gonna hate that song soon ;-)). Different bitrates might give better differentation of the problem.

Please, please experiment with this, and let us know.

M.

sound/core/oss/pcm_oss.c renamed from sound/core/oss/pcm_oss.c.old +1 -1
@@ -814,7 +814,7 @@
 			xfer += tmp;
 			if (substream->oss.setup == NULL || !substream->oss.setup->wholefrag ||
 			    runtime->oss.buffer_used == runtime->oss.period_bytes) {
-				tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer, runtime->oss.buffer_used, 1);
+				tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer, runtime->oss.period_bytes, 1);
 				if (tmp <= 0)
 					return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
 				runtime->oss.bytes += tmp;
#31 lore raw

Re: OSS sound emulation broken between 2.6.0-test2 and test3

Quoted 44 lines · Martin J. Bligh
Quoted 18 lines
Quoted 6 lines
Quoted 5 lines

Something appears to have broken OSS sound emulation between test2 and test3. Best I can tell (despite the appearance of the BK logs), that included ALSA updates 0.9.5 and 0.9.6. Hopefully someone who understands the sound architecture better than I can fix this?

Quoted 8 lines

I wont say I understand it, but a quick look seems the major change is the addition of the 'whole-frag' and 'no-silence' opts. You might try the following to revert what 'no-silence' change at least does:

--

 # echo 'xmms 0 0 no-silence' > /proc/asound/card0/pcm0p/oss
 # echo 'xmms 0 0 whole-frag' > /proc/asound/card0/pcm0p/oss
--

Thanks, that fixes it for me. I too have been seeing terrible problems with XMMS since the early 2.6 pre- kernels.

Quoted 6 lines

Because it only happens in XMMS I thought it was one of those application bugs brought out by scheduler changes. I now use Zinf BTW -It's better for large music collections (although not as stable or flash).

I guess someone ought to revert the standard behaviour.

OK, the following patch from Andrew fixes it up 80% or so, but I still don't think it's as good as test2 was - turning on whole-frag seems to fix the rest of it. It's much more difficult to tell now though, so I'd like other people's opinions on it. If you want to switch between the two, the above switches it on, and:

# echo 'clear' > /proc/asound/card0/pcm0p/oss

switches whole-frag back off. I'm using a 192kbps MP3 to test it, repeating the first 30s of the same song again and again (I'm gonna hate that song soon ;-)). Different bitrates might give better differentation of the problem.

Please, please experiment with this, and let us know.

M.

sound/core/oss/pcm_oss.c line 820

Quoted 8 lines
sound/core/oss/pcm_oss.c renamed from sound/core/oss/pcm_oss.c.old +1 -1
@@ -814,7 +814,7 @@
 			xfer += tmp;
 			if (substream->oss.setup == NULL || !substream->oss.setup->wholefrag ||
 			    runtime->oss.buffer_used == runtime->oss.period_bytes) {
-				tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer, runtime->oss.buffer_used, 1);
+				tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer, runtime->oss.period_bytes, 1);
 				if (tmp <= 0)
 					return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
 				runtime->oss.bytes += tmp;

It's not a good fix. The problem might be that the rate convert plugin is activated. When small chunks are passed to this plugin, the quality drops. You can check it with this command (and compare native and OSS rates):

cat /proc/asound/card0/pcm0p/sub0/*

Also, we fixed some OSS emulation errors in our latest code which is available here:

bk pull http://linux-sound.bkbits.net/linux-sound

or

ftp://ftp.alsa-project.org/pub/kernel-patches/alsa-bk-2003-12-05.patch.gz

I will prepare new patch for recent kernel soon.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs

#32 lore raw

Re: OSS sound emulation broken between 2.6.0-test2 and test3

Quoted 5 lines
Quoted 5 lines
sound/core/oss/pcm_oss.c renamed from sound/core/oss/pcm_oss.c.old +0 -0
@@ -814,7 +814,7 @@
 			xfer += tmp;
 			if (substream->oss.setup == NULL || !substream->oss.setup->wholefrag ||
Quoted 8 lines

sound/core/oss/pcm_oss.c line 820

Quoted 6 lines
sound/core/oss/pcm_oss.c renamed from sound/core/oss/pcm_oss.c.old +1 -1
 			    runtime->oss.buffer_used == runtime->oss.period_bytes) {
-				tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer, runtime->oss.buffer_used, 1);
+				tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer, runtime->oss.period_bytes, 1);
 				if (tmp <= 0)
 					return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
 				runtime->oss.bytes += tmp;

It's not a good fix.

OK you know the code far better than I ... but it sounds a lot better ;-) So *something* around there is broken. It sounds horrible in 2.6.0 virgin.

Quoted 5 lines

The problem might be that the rate convert plugin is activated. When small chunks are passed to this plugin, the quality drops. You can check it with this command (and compare native and OSS rates):

cat /proc/asound/card0/pcm0p/sub0/*

OSS rate: 44100
rate: 48000 (48000/1)

However, test2 worked fine - and it works fine with whole-frag turned on ... has the rate conversion changed?

Quoted 10 lines

Also, we fixed some OSS emulation errors in our latest code which is available here:

bk pull http://linux-sound.bkbits.net/linux-sound

or

ftp://ftp.alsa-project.org/pub/kernel-patches/alsa-bk-2003-12-05.patch.gz

I will prepare new patch for recent kernel soon.

I tried the above patch - doesn't help.

Thanks,

M.

#33 lore raw

Re: OSS sound emulation broken between 2.6.0-test2 and test3

In reply to Martin J. Bligh
Quoted 44 lines · Martin J. Bligh
Quoted 18 lines
Quoted 6 lines
Quoted 5 lines

Something appears to have broken OSS sound emulation between test2 and test3. Best I can tell (despite the appearance of the BK logs), that included ALSA updates 0.9.5 and 0.9.6. Hopefully someone who understands the sound architecture better than I can fix this?

Quoted 8 lines

I wont say I understand it, but a quick look seems the major change is the addition of the 'whole-frag' and 'no-silence' opts. You might try the following to revert what 'no-silence' change at least does:

--

 # echo 'xmms 0 0 no-silence' > /proc/asound/card0/pcm0p/oss
 # echo 'xmms 0 0 whole-frag' > /proc/asound/card0/pcm0p/oss
--

Thanks, that fixes it for me. I too have been seeing terrible problems with XMMS since the early 2.6 pre- kernels.

Quoted 6 lines

Because it only happens in XMMS I thought it was one of those application bugs brought out by scheduler changes. I now use Zinf BTW -It's better for large music collections (although not as stable or flash).

I guess someone ought to revert the standard behaviour.

OK, the following patch from Andrew fixes it up 80% or so, but I still don't think it's as good as test2 was - turning on whole-frag seems to fix the rest of it. It's much more difficult to tell now though, so I'd like other people's opinions on it. If you want to switch between the two, the above switches it on, and:

# echo 'clear' > /proc/asound/card0/pcm0p/oss

switches whole-frag back off. I'm using a 192kbps MP3 to test it, repeating the first 30s of the same song again and again (I'm gonna hate that song soon ;-)). Different bitrates might give better differentation of the problem.

Please, please experiment with this, and let us know.

M.

sound/core/oss/pcm_oss.c line 820

Quoted 8 lines
sound/core/oss/pcm_oss.c renamed from sound/core/oss/pcm_oss.c.old +1 -1
@@ -814,7 +814,7 @@
 			xfer += tmp;
 			if (substream->oss.setup == NULL || !substream->oss.setup->wholefrag ||
 			    runtime->oss.buffer_used == runtime->oss.period_bytes) {
-				tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer, runtime->oss.buffer_used, 1);
+				tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer, runtime->oss.period_bytes, 1);
 				if (tmp <= 0)
 					return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
 				runtime->oss.bytes += tmp;

I cannot see that this is a very clean approach. Sure, this is how it was, but the test was also different:

--
if (runtime->oss.buffer_used == runtime->oss.period_bytes) { --

Meaning the buffer was only written when it was full (period_bytes is your period size, meaning buffer size). What you will have now, is that you will write the full buffer with your valid data, and whatever crud is left from a previous pass that used the buffer to its full extend, or at least more of it than this pass (which might very well be the reason for the 20% noise/whatever left). Basically writing a chunk of crap at the end of every user buffer.

You might try something like below, but I will be honest if I do not know for a fact that

--

sound/core/oss/pcm_oss.c 2003-12-27 22:00:47.323058872 +0200 renamed from sound/core/oss/pcm_oss.c 2003-12-27 12:53:06.000000000 +0200 +6 -0
@@ -814,6 +814,12 @@
                        xfer += tmp;
                        if (substream->oss.setup == NULL || !substream->oss.setup->wholefrag ||
                            runtime->oss.buffer_used == runtime->oss.period_bytes) {
+                               if (runtime->oss.buffer_used != runtime->oss.period_bytes) {
+
+                                       memset(runtime->oss.buffer + runtime->oss.buffer_used,
+                                               (u_int8_t)snd_pcm_format_silence_64(snd_pcm_oss_format_from(runtime->oss.format)),
+                                               runtime->oss.period_bytes - runtime->oss.buffer_used);
+                               }
                                tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer, runtime->oss.buffer_used, 1);
                                if (tmp <= 0)
                                        return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;

--

But I would imagine the 'silent parts' in the song (if that long, and dont anyhow sound like skips or choppy) will still be annoying =)

Signature · 1 line
Martin Schlemmer
#34 lore raw

Re: OSS sound emulation broken between 2.6.0-test2 and test3

Quoted 90 lines · Martin Schlemmer
Quoted 44 lines · Martin J. Bligh
Quoted 18 lines
Quoted 6 lines
Quoted 5 lines

Something appears to have broken OSS sound emulation between test2 and test3. Best I can tell (despite the appearance of the BK logs), that included ALSA updates 0.9.5 and 0.9.6. Hopefully someone who understands the sound architecture better than I can fix this?

Quoted 8 lines

I wont say I understand it, but a quick look seems the major change is the addition of the 'whole-frag' and 'no-silence' opts. You might try the following to revert what 'no-silence' change at least does:

--

 # echo 'xmms 0 0 no-silence' > /proc/asound/card0/pcm0p/oss
 # echo 'xmms 0 0 whole-frag' > /proc/asound/card0/pcm0p/oss
--

Thanks, that fixes it for me. I too have been seeing terrible problems with XMMS since the early 2.6 pre- kernels.

Quoted 6 lines

Because it only happens in XMMS I thought it was one of those application bugs brought out by scheduler changes. I now use Zinf BTW -It's better for large music collections (although not as stable or flash).

I guess someone ought to revert the standard behaviour.

OK, the following patch from Andrew fixes it up 80% or so, but I still don't think it's as good as test2 was - turning on whole-frag seems to fix the rest of it. It's much more difficult to tell now though, so I'd like other people's opinions on it. If you want to switch between the two, the above switches it on, and:

# echo 'clear' > /proc/asound/card0/pcm0p/oss

switches whole-frag back off. I'm using a 192kbps MP3 to test it, repeating the first 30s of the same song again and again (I'm gonna hate that song soon ;-)). Different bitrates might give better differentation of the problem.

Please, please experiment with this, and let us know.

M.

sound/core/oss/pcm_oss.c line 820

Quoted 8 lines
sound/core/oss/pcm_oss.c renamed from sound/core/oss/pcm_oss.c.old +1 -1
@@ -814,7 +814,7 @@
 			xfer += tmp;
 			if (substream->oss.setup == NULL || !substream->oss.setup->wholefrag ||
 			    runtime->oss.buffer_used == runtime->oss.period_bytes) {
-				tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer, runtime->oss.buffer_used, 1);
+				tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer, runtime->oss.period_bytes, 1);
 				if (tmp <= 0)
 					return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
 				runtime->oss.bytes += tmp;

I cannot see that this is a very clean approach. Sure, this is how it was, but the test was also different:

--
if (runtime->oss.buffer_used == runtime->oss.period_bytes) { --

Meaning the buffer was only written when it was full (period_bytes is your period size, meaning buffer size). What you will have now, is that you will write the full buffer with your valid data, and whatever crud is left from a previous pass that used the buffer to its full extend, or at least more of it than this pass (which might very well be the reason for the 20% noise/whatever left). Basically writing a chunk of crap at the end of every user buffer.

You might try something like below, but I will be honest if I do not know for a fact that

--

sound/core/oss/pcm_oss.c 2003-12-27 22:00:47.323058872 +0200 renamed from sound/core/oss/pcm_oss.c 2003-12-27 12:53:06.000000000 +0200 +6 -1
@@ -814,6 +814,12 @@
                        xfer += tmp;
                        if (substream->oss.setup == NULL || !substream->oss.setup->wholefrag ||
                            runtime->oss.buffer_used == runtime->oss.period_bytes) {
+                               if (runtime->oss.buffer_used != runtime->oss.period_bytes) {
+
+                                       memset(runtime->oss.buffer + runtime->oss.buffer_used,
+                                               (u_int8_t)snd_pcm_format_silence_64(snd_pcm_oss_format_from(runtime->oss.format)),
+                                               runtime->oss.period_bytes - runtime->oss.buffer_used);
+                               }
                                tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer, runtime->oss.buffer_used, 1);
                                if (tmp <= 0)
                                        return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
--
Quoted 2 lines

But I would imagine the 'silent parts' in the song (if that long, and dont anyhow sound like skips or choppy) will still be annoying =)

Besides for me forgetting to change runtime->oss.buffer_used to runtime->oss.period_bytes as other patch, the memset part should really test if it should use 8, 16, 32 or 64 bit first, and I am sure there is more to it to get the start position aligned, etc ... But then, I do not see how its going to fix anything, as you will now have silence instead of it breaking up.

Signature · 1 line
Martin Schlemmer
#35 lore raw

Re: OSS sound emulation broken between 2.6.0-test2 and test3

OK, I chose to just back out the wholefrag stuff - it doesn't seem to work. Presumably someone from the ALSA project will come up with a better fix than this, if not, I'll send this upstream. This should just fix it, without the need to do other stuff in userspace to work around it ... at least it does for me.

This is the way the world was in -test2, and maybe it should have stayed like that - the new feature seems to me to default wholefrag off, where it was on before. Patch is also in 2.6.0-mjb2, which I'll release in a bit.

M.

include/sound/pcm_oss.h +0 -1
diff -urpN -X /home/fletch/.diff.exclude 610-alsa_100rc2/include/sound/pcm_oss.h 620-force_wholefrag/include/sound/pcm_oss.h
@@ -31,7 +31,6 @@ struct _snd_pcm_oss_setup {
 		     direct:1,
 		     block:1,
 		     nonblock:1,
-		     wholefrag:1,
 		     nosilence:1;
 	unsigned int periods;
 	unsigned int period_size;
sound/core/oss/pcm_oss.c +3 -7
diff -urpN -X /home/fletch/.diff.exclude 610-alsa_100rc2/sound/core/oss/pcm_oss.c 620-force_wholefrag/sound/core/oss/pcm_oss.c
@@ -814,9 +814,8 @@ static ssize_t snd_pcm_oss_write1(snd_pc
 			buf += tmp;
 			bytes -= tmp;
 			xfer += tmp;
-			if (substream->oss.setup == NULL || !substream->oss.setup->wholefrag ||
-			    runtime->oss.buffer_used == runtime->oss.period_bytes) {
-				tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer, runtime->oss.buffer_used, 1);
+			if (runtime->oss.buffer_used == runtime->oss.period_bytes) {
+				tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer, runtime->oss.period_bytes, 1);
 				if (tmp <= 0)
 					return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
 				runtime->oss.bytes += tmp;
@@ -2195,7 +2194,7 @@ static void snd_pcm_oss_proc_read(snd_in
 	snd_pcm_oss_setup_t *setup = pstr->oss.setup_list;
 	down(&pstr->oss.setup_mutex);
 	while (setup) {
-		snd_iprintf(buffer, "%s %u %u%s%s%s%s%s%s\n",
+		snd_iprintf(buffer, "%s %u %u%s%s%s%s%s\n",
 			    setup->task_name,
 			    setup->periods,
 			    setup->period_size,
@@ -2203,7 +2202,6 @@ static void snd_pcm_oss_proc_read(snd_in
 			    setup->direct ? " direct" : "",
 			    setup->block ? " block" : "",
 			    setup->nonblock ? " non-block" : "",
-			    setup->wholefrag ? " whole-frag" : "",
 			    setup->nosilence ? " no-silence" : "");
 		setup = setup->next;
 	}
@@ -2270,8 +2268,6 @@ static void snd_pcm_oss_proc_write(snd_i
 				template.block = 1;
 			} else if (!strcmp(str, "non-block")) {
 				template.nonblock = 1;
-			} else if (!strcmp(str, "whole-frag")) {
-				template.wholefrag = 1;
 			} else if (!strcmp(str, "no-silence")) {
 				template.nosilence = 1;
 			}
#36 lore raw

Re: OSS sound emulation broken between 2.6.0-test2 and test3

In reply to Edward Tandi

On Sat, Dec 27, 2003 at 11:44:11AM +0000, Edward Tandi scrawled:

Quoted 5 lines

Because it only happens in XMMS I thought it was one of those application bugs brought out by scheduler changes. I now use Zinf BTW -It's better for large music collections (although not as stable or flash).

Have you tried and see if it occurs with the ALSA output driver for XMMS. Without the whole frag line set?

Cheers,
Chris Shafer

Signature · 2 lines
My public key can be obtained from the MIT keyservers at pgp.mit.edu.
The key ID is 8F47ED2E. 
#37 lore raw

Re: OSS sound emulation broken between 2.6.0-test2 and test3

Quoted 10 lines · Chris Shafer

On Sat, Dec 27, 2003 at 11:44:11AM +0000, Edward Tandi scrawled:

Quoted 5 lines

Because it only happens in XMMS I thought it was one of those application bugs brought out by scheduler changes. I now use Zinf BTW -It's better for large music collections (although not as stable or flash).

Have you tried and see if it occurs with the ALSA output driver for XMMS. Without the whole frag line set?

That should work. The chip used for the i8[67]5 boards used to behave like this, but apparently to somebody else on the list it was because it could not handle variable data lengths (could have the term wrong) written to it, and was fixed driver side - this is not maybe an issue for the sis based boards as well (using a realtek chip i think??) ? Meaning its chip/driver side, not OSS-emu side?

Cheers,

Signature · 1 line
Martin Schlemmer
#38 lore raw

Re: OSS sound emulation broken between 2.6.0-test2 and test3

In reply to Martin J. Bligh
Quoted 4 lines

If I leave xmms playing (in random shuffle mode) every 2 minutes or so, I'll get some wierd effect for a few seconds, either static, or the track will mysteriously speed up or slow down. Then all is back to normal for another couple of minutes.

We had this problem with an Intel 8x0 sound chipset, turned out to be that the chipset requires a fixed bit rate. I can't remember what we did to fix it, but I will ask my friend who has the system.

js

Signature · 3 lines
VB programmers ask why no one takes them seriously, 
it's somewhat akin to a McDonalds manager asking employees 
why they don't take their 'career' seriously.
#39 lore raw
In reply to Martin J. Bligh
Quoted 9 lines · Martin J. Bligh

Upgraded my home desktop to 2.6.0. Somewhere between 2.5.63 and 2.6.0, sound got screwed up - I've confirmed this happens on mainline, as well as -mjb.

If I leave xmms playing (in random shuffle mode) every 2 minutes or so,
I'll get some wierd effect for a few seconds, either static, or the track will mysteriously speed up or slow down. Then all is back to normal for another couple of minutes.

Anyone else seen this, or got any clues? Else I guess I'm stuck playing bisection search.

Yes had this problem, i found that it was the oss emulation. When i switched to the alsa plugin the effect was gone.

#40 lore raw
Quoted 5 lines
Quoted 2 lines

Anyone else seen this, or got any clues? Else I guess I'm stuck playing bisection search.

Yes had this problem, i found that it was the oss emulation. When i switched to the alsa plugin the effect was gone.

Cool, thanks ... but it used to work this way. 2.5.70 worked ... if you're seeing the same problem on 2.6.0, any chance you could confirm that 2.5.70 works for you?

M.