Hello,

Low level audio drivers using the upper layer audio driver's value
for buffer size don't need to declare a round_buffersize method.
The 3rd parameter of the method is the value provided by the
upper layer driver which is used if round_buffersize isn't defined:
https://github.com/openbsd/src/blob/master/sys/dev/audio.c#L203

- Michael


Index: auixp.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/auixp.c,v
retrieving revision 1.39
diff -u -p -u -r1.39 auixp.c
--- auixp.c     8 Sep 2017 05:36:52 -0000       1.39
+++ auixp.c     14 Aug 2018 06:13:43 -0000
@@ -124,7 +124,6 @@ int auixp_get_port(void *, mixer_ctrl_t 
 int    auixp_query_devinfo(void *, mixer_devinfo_t *);
 void * auixp_malloc(void *, int, size_t, int, int);
 void   auixp_free(void *, void *, int);
-size_t auixp_round_buffersize(void *, int, size_t);
 int    auixp_get_props(void *);
 int    auixp_intr(void *);
 int    auixp_allocmem(struct auixp_softc *, size_t, size_t,
@@ -181,7 +180,7 @@ struct audio_hw_if auixp_hw_if = {
        auixp_query_devinfo,
        auixp_malloc,
        auixp_free,
-       auixp_round_buffersize,
+       NULL,                   /* round_buffersize */
        auixp_get_props,
        auixp_trigger_output,
        auixp_trigger_input
@@ -452,16 +451,6 @@ auixp_query_devinfo(void *hdl, mixer_dev
        co = (struct auixp_codec *) hdl;
        return co->codec_if->vtbl->query_devinfo(co->codec_if, di);
 }
-
-
-size_t
-auixp_round_buffersize(void *hdl, int direction, size_t bufsize)
-{
-
-       /* XXX force maximum? i.e. 256 kb? */
-       return bufsize;
-}
-
 
 int
 auixp_get_props(void *hdl)
Index: cs4280.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/cs4280.c,v
retrieving revision 1.51
diff -u -p -u -r1.51 cs4280.c
--- cs4280.c    26 Dec 2016 17:38:14 -0000      1.51
+++ cs4280.c    14 Aug 2018 06:13:43 -0000
@@ -206,7 +206,6 @@ int cs4280_mixer_get_port(void *, mixer_
 int    cs4280_query_devinfo(void *addr, mixer_devinfo_t *dip);
 void   *cs4280_malloc(void *, int, size_t, int, int);
 void   cs4280_free(void *, void *, int);
-size_t cs4280_round_buffersize(void *, int, size_t);
 int    cs4280_get_props(void *);
 int    cs4280_trigger_output(void *, void *, void *, int, void (*)(void *),
            void *, struct audio_params *);
@@ -253,7 +252,7 @@ struct audio_hw_if cs4280_hw_if = {
        cs4280_query_devinfo,
        cs4280_malloc,
        cs4280_free,
-       cs4280_round_buffersize,
+       NULL,
        cs4280_get_props,
        cs4280_trigger_output,
        cs4280_trigger_input
@@ -1058,16 +1057,6 @@ int
 cs4280_round_blocksize(void *hdl, int blk)
 {
        return (blk < CS4280_ICHUNK ? CS4280_ICHUNK : blk & -CS4280_ICHUNK);
-}
-
-size_t
-cs4280_round_buffersize(void *addr, int direction, size_t size)
-{
-       /* although real dma buffer size is 4KB, 
-        * let the audio.c driver use a larger buffer.
-        * ( suggested by Lennart Augustsson. )
-        */
-       return (size);
 }
 
 int
Index: envy.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/envy.c,v
retrieving revision 1.72
diff -u -p -u -r1.72 envy.c
--- envy.c      17 Mar 2018 13:35:12 -0000      1.72
+++ envy.c      14 Aug 2018 06:13:43 -0000
@@ -102,7 +102,6 @@ void envy_freem(void *, void *, int);
 int envy_set_params(void *, int, int, struct audio_params *,
     struct audio_params *);
 int envy_round_blocksize(void *, int);
-size_t envy_round_buffersize(void *, int, size_t);
 int envy_trigger_output(void *, void *, void *, int,
     void (*)(void *), void *, struct audio_params *);
 int envy_trigger_input(void *, void *, void *, int,
@@ -196,7 +195,7 @@ struct audio_hw_if envy_hw_if = {
        envy_query_devinfo,     /* query_devinfo */
        envy_allocm,            /* malloc */
        envy_freem,             /* free */
-       envy_round_buffersize,  /* round_buffersize */
+       NULL,                   /* round_buffersize */
        envy_get_props,         /* get_props */
        envy_trigger_output,    /* trigger_output */
        envy_trigger_input      /* trigger_input */
@@ -1885,12 +1884,6 @@ int
 envy_round_blocksize(void *self, int blksz)
 {
        return (blksz + 0x1f) & ~0x1f;
-}
-
-size_t
-envy_round_buffersize(void *self, int dir, size_t bufsz)
-{
-       return bufsz;
 }
 
 #ifdef ENVY_DEBUG

Reply via email to