pcsp weirdness/report (yes, even with libasound 1.0.16 revert)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi.
Quoted 3 lines · Andreas Mohr
Immediately tried playback, and nothing worked properly. Sound is
__EXTREMELY__silent, about 15 times more silent than the normal terminal beep.
Sorry for the silly question but... do you have the Master volume at maximum?
Quoted 1 line
insmod with nforce_wa=1, no success either.
nforce_wa is only needed if your speaker is completely silent otherwise. So you don't need it.
Quoted 8 lines
Debug output is (val has astonishingly uniform values):
input: PC Speaker as /class/input/input12
PCSP: lpj=4012338, min_div=32, res=1
PCSP: open called
PCSP: prepare called, size=32768 psize=2048 f=16 f1=16
PCSP: trigger called
PCSP:start_playingcalledtimer_cnt32 val 128CUR_DIV64chip->treble0chip->max_treble1
Quoted 8 lines
timer_cnt27 val 111CUR_DIV64chip->treble0chip->max_treble1timer_cnt35 val 141CUR_DIV64chip->treble0chip->max_treble1timer_cnt28 val 115CUR_DIV64chip->treble0chip->max_treble1timer_cnt27 val 111CUR_DIV64chip->treble0chip->max_treble1timer_cnt32 val 128CUR_DIV64chip->treble0chip->max_treble1timer_cnt36 val 145CUR_DIV64chip->treble0chip->max_treble1timer_cnt32 val 130CUR_DIV64chip->treble0chip->max_treble1timer_cnt30 val 123CUR_DIV64chip->treble0chip->max_treble1
Only timer_cnt and val may change. Others are from the mixer controls. Well, whatever should change, seems changing. :)
Quoted 3 lines
BTW, since it has been frequently mentioned that sound device reordering is an issue:
why not make that hard-coded in the driver itself??
I was thinking about that too - I don't know an answer. Added alsa-devel to CC because of that question.
Quoted 3 lines
If this is safe to do (setting it to a "max" value or to e.g. 10, and all/most ALSA users still evaluate things properly), then one should probably do it.
Hopefully someone else can comment on that.
Quoted 2 lines
And mixer controls in gamix are very confusing, too.
E.g. when clicking on the BaseFRQ enum box, I get _two_ 18643 entries listed.
I've seen this too, but I think this is a bug in that mixer gui. It doesn't seem to handle the ENUMERATED values right, IIRC. alsamixer works right.
Quoted 2 lines
And I'm still not sure (haven't investigated fully) why that other setting is called "treble".
Where? In the GUI or in the code? It shouldn't be called as such in the GUI, and for the code... well, I don't know, that was too long ago. :)
Quoted 3 lines
All in all very confusing.
All I'd want is enable playback, enable standard beep, master playback volume and having the base frequency displayed(/changeable).
Could you please see if there are any problems with alsamixer first? If not, then the problems are likely in the mixer you use.
Quoted 3 lines
Oh, and maybe oversampling configuration (how many samples to average, for reduced timer load, see e.g.
http://kerneltrap.org/mailarchive/linux-activists/1993/4/13/29718 ).
They seem to be talking about a simple downsampling to reduce the data transfer. I beleive they talk about downsampling in the player, not in the driver.
You can't reduce the PWM freq. Making it below 18KHz would just whistle.
Quoted 10 lines
Oh, and why does the code order I/O sequence as
outb_p(chip->val61, 0x61); outb_p(timer_cnt, 0x42); outb(chip->val61 ^ 1, 0x61); instead of outb_p(chip->val61, 0x61); outb(chip->val61 ^ 1, 0x61); outb_p(timer_cnt, 0x42);as mentioned at some other sites? Is there any reason or maybe it just doesn't matter?
I think it doesn't matter, and I did it that way to increase the delays between the port 0x61 writes. I have no proof that it helps or hurts.
Quoted 3 lines
Kconfigdescription should perhaps also be updated to prominently but shortly display the fact that this driver provides full playback, not just simple beeps (e.g. mention "digital sound driver" or so).
It says something about a "primitive sound card", but I see no problems improving the text.
Quoted 2 lines
Thanks a lot for providing a rather important puzzle piece for Linux usability!
:)
Ok, the problems should be solved, the texts should be improved, the users should upgrade, etc. And in a mean time, the warning I put there, is hopefully strong enough. :)
If not, we can always depend that driver on CONFIG_BROKEN... but I'd like to hear more opinions about that option. Hmm, actually, why not? We can always un-depend it later. Thoughts?
Hi,
Quoted 9 lines · Stas Sergeev
Hi.
Quoted 3 lines · Andreas Mohr
Immediately tried playback, and nothing worked properly. Sound is
__EXTREMELY__silent, about 15 times more silent than the normal terminal beep.Sorry for the silly question but... do you have the Master volume at maximum?
Uh, well... NO.
Hold on... well, of course I definitely had, but - I didn't have swvol configured (as done by your sample asound.conf.gz / .asoundrc).
Now sound is a lot better, but it's still a wee bit too silent (piezo...).
And of course I don't quite like the fact that I'm burning 50% user-space on my Athlon!!!
(probably caused by tasklet, and probably by excessive ALSA handling there as well).
Do we really have to do ALSA housekeeping during every timer cycle?? Not a single standard soundcard does this, it only triggers a sound interrupt whenever a period elapsed and _then_ calls snd_pcm_period_elapsed().
Thus I'm strongly suspecting that we're severely overhandling things here, but I didn't really look into it.
Anyway, 50% user-space is really excessive, I'm quite sure that configuring my azt3328 card to fire 20000 hardware sequencer timer interrupts per second burned about 15% CPU (sys) only! (on this very same machine, and on a drastically older/worse kernel version already, around 2.6.15ish!) Thus it'd seem we have a lot of overhead in this handler which one should try to reduce, by trying to find a solution for the locking issue and by reducing ALSA handling.
Quoted 4 lines
Quoted 1 line
insmod with nforce_wa=1, no success either.
nforce_wais only needed if your speaker is completely silent otherwise. So you don't need it.
Yup, and with it sound deteriorated, as mentioned in the driver.
Quoted 6 lines
Quoted 2 lines
And mixer controls in gamix are very confusing, too.
E.g. when clicking on the BaseFRQ enum box, I get _two_ 18643 entries listed.I've seen this too, but I think this is a bug in that mixer gui. It doesn't seem to handle the ENUMERATED values right, IIRC. alsamixer works right.
gamix doesn't seem to handle a whole lot of things right (that's not the first time that I'm hitting a problem there).
But OTOH all those bazillions of stupid little mixer apps out there really aren't any better... (rather worse).
Quoted 6 lines
Quoted 2 lines
And I'm still not sure (haven't investigated fully) why that other setting is called "treble".
Where? In the GUI or in the code? It shouldn't be called as such in the GUI, and for the code... well, I don't know, that was too long ago. :)
Code. It just seemed to me that treble is something entirely different than the thing used by the driver.
Quoted 10 lines
Quoted 10 lines
Oh, and why does the code order I/O sequence as
outb_p(chip->val61, 0x61); outb_p(timer_cnt, 0x42); outb(chip->val61 ^ 1, 0x61); instead of outb_p(chip->val61, 0x61); outb(chip->val61 ^ 1, 0x61); outb_p(timer_cnt, 0x42);as mentioned at some other sites? Is there any reason or maybe it just doesn't matter?
Quoted 4 lines
I think it doesn't matter, and I did it that way to increase the delays between the port
0x61writes. I have no proof that it helps or hurts.
But that doesn't happen to be the reason for the nforce breakage, right?
For me it works fine either way.
Quoted 13 lines
Quoted 2 lines
Thanks a lot for providing a rather important puzzle piece for Linux usability!
:)
Ok, the problems should be solved, the texts should be improved, the users should upgrade, etc. And in a mean time, the warning I put there, is hopefully strong enough. :)
If not, we can always depend that driver onCONFIG_BROKEN... but I'd like to hear more opinions about that option. Hmm, actually, why not? We can always un-depend it later. Thoughts?
I'm tending against CONFIG_BROKEN. The driver isn't really broken, and it doesn't obscure regular speaker use (right?), and fixing of the nagging usability issues (weird .asoundrc additions required, gamix problems, high CPU use...) will happen much faster by spitting into the face of our users, not by going out of their way :)
(since CONFIG_BROKEN would cause the driver to be invisible on pretty much every standard distro setup)
Thanks,
Andreas Mohr
Signature · 1 line
GNU/Linux. It's not the software that's free, it's you.
Hello.
Quoted 2 lines · Andreas Mohr
Hold on... well, of course I definitely had, but - I didn't have swvol configured (as done by your sample asound.conf.gz / .asoundrc).
Why? Do you have an updated the PC-Speaker.conf from alsa-lib hg (same that I posted to LKML)? That should be enough to get softvol working "out of the box".
But there is a small caveat to that. After you load the driver module, you won't get softvol configured immediately. Running the mixer doesn't help, too. You need to play some sound, and then softvol gets configured so you can start mixer and change volume. I never investigated that, but its an alsa-lib bug most certainly. Running alsamixer without playing any sound first, should be sufficient to get softvol running. If this is what got you trapped into, then I'll appreciate if you report that to the right place. :)
Quoted 2 lines
Now sound is a lot better, but it's still a wee bit too silent (piezo...).
Of course you can adjust the softvol config and increase an amplification, but...
Quoted 2 lines
And of course I don't quite like the fact that I'm burning 50% user-space on my Athlon!!!
What Athlon?
Have you tried setting the sampling rate to 18KHz in alsamixer? Does that change anything?
I am pretty sure there are the unhappy asound.conf configurations that look innocent but burns up your whole CPU.
I had them myself while trying to create a good config for the driver.
Could you please remove all the custom /etc/asound.conf, .asoundrc etc, and only use the PC-Speaker.conf of alsa-lib hg? I was testing that driver since 486DX4 120 (not in alsa version but an OSS), and it didn't lead to any significant CPU load.
Quoted 1 line
(probably caused by tasklet,
AFAIK tasklet is a very light-weight technique. And hopefully it'll be nuked from the driver soon. :) It is only used once per playback btw, so shouldn't hurt the CPU load at all.
Quoted 2 lines
and probably by excessive ALSA handling
there as well).
I suspect the excessive _user-space_ alsa handling. That's what happened to me a few times too.
Quoted 1 line
Do we really have to do ALSA housekeeping during every timer cycle??
There is only a small housekeeping per every cycle. Most of it is a... well... a locking mess. :) The rest is to take the next byte from DMA buffer, write a timer counter and advance a playback pointer. Shouldn't be anything more.
Quoted 3 lines
Not a single standard soundcard does this, it only triggers a sound interrupt whenever a period elapsed and _then_ calls
snd_pcm_period_elapsed().
snd_pcm_period_elapsed() should only be called when the period(s) has elapsed. If not - its a bug. snd-pcsp is not an exception.
Quoted 2 lines
Thus I'm strongly suspecting that we're severely overhandling things here, but I didn't really look into it.
Its rather messy right now because of the locking stuff. But I don't think it really does something redundant by mistake.
Quoted 1 line
Thus it'd seem we have a lot of overhead in this handler which one
If it is really a callback problem, then perhaps the hrtimer code itself can generate an overhead. Maybe you can try an empty callback to check that out.
Quoted 2 lines
gamix doesn't seem to handle a whole lot of things right (that's not the first time that I'm hitting a problem there).
Undoubtedly, you have already reported it to the right people. :)
And I have to report the same problem about the gnome-volume-control prog...
Quoted 2 lines
Code. It just seemed to me that treble is something entirely different than the thing used by the driver.
OK, I'll rename it soon then.
Or you can do that yourself. :)
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Oh, and why does the code order I/O sequence as
outb_p(chip->val61, 0x61); outb_p(timer_cnt, 0x42); outb(chip->val61 ^ 1, 0x61); instead of outb_p(chip->val61, 0x61); outb(chip->val61 ^ 1, 0x61); outb_p(timer_cnt, 0x42);as mentioned at some other sites? Is there any reason or maybe it just doesn't matter?
Quoted 5 lines
Quoted 4 lines
I think it doesn't matter, and I did it that way to increase the delays between the port
0x61writes. I have no proof that it helps or hurts.But that doesn't happen to be the reason for the nforce breakage, right?
No, and that's exactly what I did when first heard about an nforce problem. This was very long ago. I was hoping
an extra delays could help, but they reportedly did not. I left it though, but the first _p is of course now redundant. Now I have the nforces everywhere (actually, I don't have the non-nforce boards any more), and I wasn't able to find the right fix. Also note that all the old DOS players are broken on nforce just as well.