[alsa-devel] Backported sbxfi driver, possible fix
Thomas Scheunemann
thomas.scheunemann at uni-duisburg-essen.de
Sat Oct 25 15:06:52 CEST 2008
I think I found a bug in the driver, which at least for me was
responsible for the crashes with pulseaudio.
A little backstory:
I have a Fedora 8 System with an SB X-Fi installed and of course
no sound. I didn't want to replace the entire ALSA driver, so I
just took the files sbxfi.c and emu20k1-regs.h from the unstable
sources, wrote a small spec-file and am now at a point where I
can just "rpm -i" the driver as a dkms package and just modprobe
the driver.
After that "speaker-test -D hw -c 2 -r 96000 -t sine" works just
fine, but as soon as pulseaudio is started my System froze.
The bug I think I found is in the get_xfi_order function. As long
as pages actually is a power of two it works correctly. But if
pages isn't a power of two it should round up, but it rounds down.
As a result I believe this screws up sbxfi_alloc_tlb_pages.
After a small modification to get_xfi_order:
--- /tmp/sbxfi.c 2008-10-25 14:51:55.000000000 +0200
+++ sbxfi.c 2008-10-25 14:03:48.000000000 +0200
@@ -851,11 +851,12 @@
/* get the order of pages (power-of-two) */
static int get_xfi_order(unsigned int pages)
{
- int order = -1;
- do {
+ int order = 0;
+ pages--;
+ while(pages){
pages >>= 1;
order++;
- } while (pages);
+ }
return order;
}
the driver started working with pulseaudio, it doesn't crash, and I
even get sound though it still is a bit distorted.
More information about the Alsa-devel
mailing list