Module Name:    src
Committed By:   nat
Date:           Fri Nov  3 21:15:18 UTC 2017

Modified Files:
        src/sys/dev: audio.c

Log Message:
Blocksizes sould be rounded to a power of 2 as OSS applications need this.

Tested by martin@.


To generate a diff of this commit:
cvs rdiff -u -r1.427 -r1.428 src/sys/dev/audio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/audio.c
diff -u src/sys/dev/audio.c:1.427 src/sys/dev/audio.c:1.428
--- src/sys/dev/audio.c:1.427	Fri Nov  3 21:12:44 2017
+++ src/sys/dev/audio.c	Fri Nov  3 21:15:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.427 2017/11/03 21:12:44 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.428 2017/11/03 21:15:18 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss <nathanialsl...@yahoo.com.au>
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.427 2017/11/03 21:12:44 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.428 2017/11/03 21:15:18 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -2020,6 +2020,12 @@ audio_init_ringbuffer(struct audio_softc
 				hwblksize = sc->sc_hwvc->sc_mrr.blksize;
 		}
 
+		int tmpblksize = 1; 	 
+		/* round blocksize to a power of 2 */ 	 
+		while (tmpblksize < blksize) 	 
+			tmpblksize <<= 1; 	 
+
+		blksize = tmpblksize;
 		if (blksize > hwblksize)
 			blksize = hwblksize;
 	}

Reply via email to