Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci round_blocksize must return a multiple of the fr...



details:   https://anonhg.NetBSD.org/src/rev/3822355cba41
branches:  trunk
changeset: 849360:3822355cba41
user:      isaki <isaki%NetBSD.org@localhost>
date:      Sat Feb 29 06:34:30 2020 +0000

description:
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.

diffstat:

 sys/dev/pci/auacer.c |  15 ++-------------
 sys/dev/pci/auich.c  |  17 ++---------------
 sys/dev/pci/auixp.c  |  13 +++++--------
 3 files changed, 9 insertions(+), 36 deletions(-)

diffs (140 lines):

diff -r 5a5ff739f519 -r 3822355cba41 sys/dev/pci/auacer.c
--- a/sys/dev/pci/auacer.c      Sat Feb 29 06:25:33 2020 +0000
+++ b/sys/dev/pci/auacer.c      Sat Feb 29 06:34:30 2020 +0000
@@ -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_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 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 @@
        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)
 {
diff -r 5a5ff739f519 -r 3822355cba41 sys/dev/pci/auich.c
--- a/sys/dev/pci/auich.c       Sat Feb 29 06:25:33 2020 +0000
+++ b/sys/dev/pci/auich.c       Sat Feb 29 06:34:30 2020 +0000
@@ -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_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 @@
        .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 @@
        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)
 {
diff -r 5a5ff739f519 -r 3822355cba41 sys/dev/pci/auixp.c
--- a/sys/dev/pci/auixp.c       Sat Feb 29 06:25:33 2020 +0000
+++ b/sys/dev/pci/auixp.c       Sat Feb 29 06:34:30 2020 +0000
@@ -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 <reinoud%netbsd.org@localhost>
@@ -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 @@
 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;
 }
 
 



Home | Main Index | Thread Index | Old Index