2001-02-08 23:00:38

by Pete Zaitcev

[permalink] [raw]
Subject: Patch for ymfpci and xmms

Courtesy of Manish Singh, little bit extended
(I hope I did not break it too badly).
Supposedly it fixes bad skipping with xmms.

-- Pete

diff -ur -X dontdiff linux-2.4.1/drivers/sound/ymfpci.c linux-2.4.1-p3/drivers/sound/ymfpci.c
--- linux-2.4.1/drivers/sound/ymfpci.c Fri Jan 26 23:31:16 2001
+++ linux-2.4.1-p3/drivers/sound/ymfpci.c Thu Feb 8 11:29:45 2001
@@ -370,16 +370,14 @@

/*
* Create fake fragment sizes and numbers for OSS ioctls.
+ * Import what Doom might have set with SNDCTL_DSP_SETFRAGMENT.
*/
bufsize = PAGE_SIZE << dmabuf->buforder;
- if (dmabuf->ossfragshift) {
- if ((1000 << dmabuf->ossfragshift) < bytepersec)
- dmabuf->fragshift = ld2(bytepersec/1000);
- else
- dmabuf->fragshift = dmabuf->ossfragshift;
- } else {
- /* lets hand out reasonable big ass buffers by default */
- dmabuf->fragshift = (dmabuf->buforder + PAGE_SHIFT -2);
+ /* lets hand out reasonable big ass buffers by default */
+ dmabuf->fragshift = (dmabuf->buforder + PAGE_SHIFT -2);
+ if (dmabuf->ossfragshift > 3 &&
+ dmabuf->ossfragshift < dmabuf->fragshift) {
+ dmabuf->fragshift = dmabuf->ossfragshift;
}
dmabuf->numfrag = bufsize >> dmabuf->fragshift;
while (dmabuf->numfrag < 4 && dmabuf->fragshift > 3) {
@@ -389,9 +387,6 @@
dmabuf->fragsize = 1 << dmabuf->fragshift;
dmabuf->dmasize = dmabuf->numfrag << dmabuf->fragshift;

- /*
- * Import what Doom might have set with SNDCTL_DSD_SETFRAGMENT.
- */
if (dmabuf->ossmaxfrags >= 2 && dmabuf->ossmaxfrags < dmabuf->numfrag) { dmabuf->numfrag = dmabuf->ossmaxfrags;
dmabuf->dmasize = dmabuf->numfrag << dmabuf->fragshift;
@@ -1718,21 +1713,13 @@
case SNDCTL_DSP_SETFRAGMENT:
if (get_user(val, (int *)arg))
return -EFAULT;
- /* P3: these frags are for Doom. Amasingly, it sets [2,2**11]. */
- /* P3 */ // printk("ymfpci: ioctl SNDCTL_DSP_SETFRAGMENT 0x%x\n", val);
-
dmabuf = &state->wpcm.dmabuf;
dmabuf->ossfragshift = val & 0xffff;
dmabuf->ossmaxfrags = (val >> 16) & 0xffff;
- switch (dmabuf->ossmaxfrags) {
- case 1:
- dmabuf->ossfragshift = 12;
- return 0;
- default:
- /* Fragments must be 2K long */
- dmabuf->ossfragshift = 11;
- dmabuf->ossmaxfrags = 2;
- }
+ if (dmabuf->ossfragshift < 4)
+ dmabuf->ossfragshift = 4;
+ if (dmabuf->ossfragshift > 15)
+ dmabuf->ossfragshift = 15;
return 0;

case SNDCTL_DSP_GETOSPACE: