Module Name:    src
Committed By:   isaki
Date:           Sat Feb 29 06:34:30 UTC 2020

Modified Files:
        src/sys/dev/pci: auacer.c auich.c auixp.c

Log Message:
round_blocksize must return a multiple of the framesize
even if 6 channels mode.
I believe that keeping "good alignment" is just a wish, not constraint.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/pci/auacer.c
cvs rdiff -u -r1.158 -r1.159 src/sys/dev/pci/auich.c
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/pci/auixp.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/pci/auacer.c
diff -u src/sys/dev/pci/auacer.c:1.38 src/sys/dev/pci/auacer.c:1.39
--- src/sys/dev/pci/auacer.c:1.38	Sat Jun  8 08:02:38 2019
+++ src/sys/dev/pci/auacer.c	Sat Feb 29 06:34:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: auacer.c,v 1.38 2019/06/08 08:02:38 isaki Exp $	*/
+/*	$NetBSD: auacer.c,v 1.39 2020/02/29 06:34:30 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2008 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auacer.c,v 1.38 2019/06/08 08:02:38 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auacer.c,v 1.39 2020/02/29 06:34:30 isaki Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -154,8 +154,6 @@ static int	auacer_query_format(void *, a
 static int	auacer_set_format(void *, int,
 				 const audio_params_t *, const audio_params_t *,
 				 audio_filter_reg_t *, audio_filter_reg_t *);
-static int	auacer_round_blocksize(void *, int, int,
-				       const audio_params_t *);
 static int	auacer_halt_output(void *);
 static int	auacer_halt_input(void *);
 static int	auacer_getdev(void *, struct audio_device *);
@@ -188,7 +186,6 @@ static void auacer_reset(struct auacer_s
 static const struct audio_hw_if auacer_hw_if = {
 	.query_format		= auacer_query_format,
 	.set_format		= auacer_set_format,
-	.round_blocksize	= auacer_round_blocksize,
 	.halt_output		= auacer_halt_output,
 	.halt_input		= auacer_halt_input,
 	.getdev			= auacer_getdev,
@@ -562,14 +559,6 @@ auacer_set_format(void *v, int setmode,
 	return 0;
 }
 
-static int
-auacer_round_blocksize(void *v, int blk, int mode,
-    const audio_params_t *param)
-{
-
-	return blk & ~0x3f;		/* keep good alignment */
-}
-
 static void
 auacer_halt(struct auacer_softc *sc, struct auacer_chan *chan)
 {

Index: src/sys/dev/pci/auich.c
diff -u src/sys/dev/pci/auich.c:1.158 src/sys/dev/pci/auich.c:1.159
--- src/sys/dev/pci/auich.c:1.158	Fri Dec  6 07:27:07 2019
+++ src/sys/dev/pci/auich.c	Sat Feb 29 06:34:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: auich.c,v 1.158 2019/12/06 07:27:07 maxv Exp $	*/
+/*	$NetBSD: auich.c,v 1.159 2020/02/29 06:34:30 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2008 The NetBSD Foundation, Inc.
@@ -111,7 +111,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.158 2019/12/06 07:27:07 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.159 2020/02/29 06:34:30 isaki Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -259,7 +259,6 @@ static int	auich_query_format(void *, st
 static int	auich_set_format(void *, int,
 		    const audio_params_t *, const audio_params_t *,
 		    audio_filter_reg_t *, audio_filter_reg_t *);
-static int	auich_round_blocksize(void *, int, int, const audio_params_t *);
 static void	auich_halt_pipe(struct auich_softc *, int);
 static int	auich_halt_output(void *);
 static int	auich_halt_input(void *);
@@ -304,7 +303,6 @@ static const struct audio_hw_if auich_hw
 	.close			= auich_close,
 	.query_format		= auich_query_format,
 	.set_format		= auich_set_format,
-	.round_blocksize	= auich_round_blocksize,
 	.halt_output		= auich_halt_output,
 	.halt_input		= auich_halt_input,
 	.getdev			= auich_getdev,
@@ -1053,17 +1051,6 @@ auich_set_format(void *v, int setmode,
 	return 0;
 }
 
-static int
-auich_round_blocksize(void *v, int blk, int mode,
-    const audio_params_t *param)
-{
-
-	if (blk < 0x40)
-		return 0x40;		/* avoid 0 block size */
-
-	return blk & ~0x3f;		/* keep good alignment */
-}
-
 static void
 auich_halt_pipe(struct auich_softc *sc, int pipe)
 {

Index: src/sys/dev/pci/auixp.c
diff -u src/sys/dev/pci/auixp.c:1.48 src/sys/dev/pci/auixp.c:1.49
--- src/sys/dev/pci/auixp.c:1.48	Wed Oct 16 21:52:22 2019
+++ src/sys/dev/pci/auixp.c	Sat Feb 29 06:34:30 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: auixp.c,v 1.48 2019/10/16 21:52:22 maya Exp $ */
+/* $NetBSD: auixp.c,v 1.49 2020/02/29 06:34:30 isaki Exp $ */
 
 /*
  * Copyright (c) 2004, 2005 Reinoud Zandijk <rein...@netbsd.org>
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auixp.c,v 1.48 2019/10/16 21:52:22 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auixp.c,v 1.49 2020/02/29 06:34:30 isaki Exp $");
 
 #include <sys/types.h>
 #include <sys/errno.h>
@@ -422,16 +422,13 @@ static int
 auixp_round_blocksize(void *hdl, int bs, int mode,
     const audio_params_t *param)
 {
-	uint32_t new_bs;
 
-	new_bs = bs;
-	/* Be conservative; align to 32 bytes and maximise it to 64 kb */
 	/* 256 kb possible */
-	if (new_bs > 0x10000)
+	if (bs > 0x10000)
 		bs = 0x10000;			/* 64 kb max */
-	new_bs = (bs & ~0x20);			/* 32 bytes align */
+	bs = rounddown(bs, param->channels * param->precision / NBBY);
 
-	return new_bs;
+	return bs;
 }
 
 

Reply via email to