the sb16, quake and mmap saga

Daniel J. Rodriksson (djr@dit.upm.es)
Sat, 28 Nov 1998 13:11:04 +0100


This is a multi-part message in MIME format.
--------------812780F5237CF1DC5CBBA746
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

1. mmap is catched for sb16 and quake

2. But a strange glitch appears on second and further quake
executions.

I have traced the problem to sound_alloc_dmap and sound_free_dmap
When you mmap a dma buffer it is not freed upon exit.
It should make no difference when you reopen the device and
mmap it again, but it makes it.

I'm learning how dmabuf works to see where the difference is.

The small attached patch should do the trick for now with no
side effects ( just freeing mmapped buffers upon exit which
later implies buffer allocation when opening the device )

Have a nice weekend

-- 
---------------------------------------------------------------|
|         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                           |
|--------------------------------------------------------------|
--------------812780F5237CF1DC5CBBA746
Content-Type: text/plain; charset=us-ascii; name="dmabuf.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="dmabuf.diff"

--- linux-2.1.130.orig/drivers/sound/dmabuf.c Sun Nov 8 22:56:10 1998 +++ linux-2.1.130/drivers/sound/dmabuf.c Sat Nov 28 13:08:32 1998 @@ -121,8 +121,17 @@ if (dmap->raw_buf == NULL) return; +/* + * djr@dit.upm.es + * No freeing mmapped buffers will make quake have a glitch effect + * after first execution. + * This shouldn't harm, :-), as a new buffer will be reallocated next time + * the device is opened + */ +#if 0 if (dmap->mapping_flags & DMA_MAP_MAPPED) return; /* Don't free mmapped buffer. Will use it next time */ +#endif for (sz = 0, size = PAGE_SIZE; size < dmap->buffsize; sz++, size <<= 1); start_addr = (unsigned long) dmap->raw_buf;

--------------812780F5237CF1DC5CBBA746--

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/