Messages in this thread Patches in this message | | | Date | Mon, 30 Nov 1998 16:15:11 +0100 | From | "Daniel J. Rodriksson" <> | Subject | fix for sb16 and mmap and dmabuf |
| |
1. Patch one cures the sb16, quake and mmap sound-glitch
sound-glitch.diff
It seems that the original dma juggling performed in the sb16 ( and clones ) code was not consistent with the duplex behaviour expected in dmabuf so at closing time the dmap structs must be reverted if switching from 8 to 16 bit.
Simply moving the MMAPED flag from dmap_in to dmap_out or viceversa does not work, but swapping both dmap structs does.
2. Patch 2 is a fix for what I believe to be a bug in dmabuf.c
dmabuf-bug.diff
At closing time, DMAbuf_release checks if dmap_in ( ?? ) is mapped to perform a DMA_sync. I think it should check dmap_out ( it checks if dmap_out->mode == DMAP_OUTPUT, hence I think checking for dmap_in mapping is a mistake ).
Enjoy
-- ---------------------------------------------------------------| | Remember Scotch: 'THERE CAN BE ONLY ONE' | ---------------------------------------------------------------| | Daniel J. Rodriksson | B-204.1,ETSI Telecomunicaciones | | djr@dit.upm.es | Avda Paraninfo S/N | | http://www.dit.upm.es/~djr | 28040 Madrid | | +34-1-3367366 + ext 442 | SPAIN | |--------------------------------------------------------------|--- linux-2.1.130.orig/drivers/sound/sb_audio.c Sun Nov 8 22:56:10 1998 +++ linux-2.1.130/drivers/sound/sb_audio.c Mon Nov 30 16:03:17 1998 @@ -91,6 +91,14 @@ { sb_devc *devc = audio_devs[dev]->devc; + /* if we did dma juggling put the right dmap in the right place */ + if(devc->duplex && audio_devs[dev]->dmap_out->dma != devc->dma8) + { + struct dma_buffparms *dmap_temp; + dmap_temp = audio_devs[dev]->dmap_out; + audio_devs[dev]->dmap_out = audio_devs[dev]->dmap_in; + audio_devs[dev]->dmap_in = dmap_temp; + } audio_devs[dev]->dmap_out->dma = devc->dma8; audio_devs[dev]->dmap_in->dma = ( devc->duplex ) ? devc->dma16 : devc->dma8;--- linux-2.1.130.orig/drivers/sound/dmabuf.c Sun Nov 8 22:56:10 1998 +++ linux-2.1.130/drivers/sound/dmabuf.c Mon Nov 30 16:06:17 1998 @@ -474,7 +474,7 @@ adev->dmap_in->closing = 1; if (adev->open_mode & OPEN_WRITE) - if (!(adev->dmap_in->mapping_flags & DMA_MAP_MAPPED)) + if (!(adev->dmap_out->mapping_flags & DMA_MAP_MAPPED)) if (!signal_pending(current) && (adev->dmap_out->dma_mode == DMODE_OUTPUT)) DMAbuf_sync(dev); if (adev->dmap_out->dma_mode == DMODE_OUTPUT) | |