All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Revell <rlrevell@joe-job.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: Driver design question
Date: Fri, 29 Sep 2006 22:03:09 -0400	[thread overview]
Message-ID: <1159581790.7086.141.camel@mindpipe> (raw)
In-Reply-To: <s5hhcytp6sy.wl%tiwai@suse.de>

On Wed, 2006-09-27 at 19:18 +0200, Takashi Iwai wrote:
> At Mon, 25 Sep 2006 15:54:22 -0400,
> Lee Revell wrote:
> > Here is the code - can you see anything wrong with it?  It's derived
> > from the ALSA dummy driver and still uses the dummy driver's hardware
> > pointer and timer scheme for calling pcm_period_elapsed() - could this
> > be the problem?  My attempts to track the hardware pointer more
> > accurately and call pcm_period_elapsed from the copy callback have not
> > been successful.
> > 
> > Most of the work is done in the workqueue dream_handle_pcm_queue() and
> > the copy callback.
> 
> Well, when you have an intermediate buffer (allocated via
> snd_pcm_lib_malloc(), you don't need copy and silent callbacks.  The
> data is written on the intermediate buffer.  Then, the workq copies
> the data again from this buffer to the hardware in the background.
> 
> As I mentioned, the helpers in pcm-indirect.h might make things eaiser
> for such an implementation.  In your case, a pseudo code would look
> like below.

OK, I've implemented this, but it's still not quite working.

I've noticed that with the PCM indirect implementation, the pointer
callback invokes the ack callback every time:

pcm-indirect.h:

 90  */
 91 static inline snd_pcm_uframes_t
 92 snd_pcm_indirect_playback_pointer(snd_pcm_substream_t *substream,
 93                                   snd_pcm_indirect_t *rec, unsigned int ptr)
 94 {

[ ... ]

103         if (substream->ops->ack)
104                 substream->ops->ack(substream);

But, this cannot work with our hardware, if the ack callback always
transfers 0x2000 words from the hardware, because the pointer callback
is invoked many times per period.

What are the exact rules/semantics for when the ack callback is invoked?

Also, how should I know when to invoke snd_pcm_period_elapsed?  It only
seems to work if I call it from a timer - if I move it to the ack or
copy callback, playback hangs after the first chunk of audio is played.

Lee


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

  parent reply	other threads:[~2006-09-30  2:03 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-14 11:29 Driver design question Takashi Iwai
2006-09-15 14:47 ` Lee Revell
2006-09-19 15:15   ` Takashi Iwai
2006-09-25 19:54     ` Lee Revell
2006-09-27 17:18       ` Takashi Iwai
2006-09-27 17:38         ` Lee Revell
2006-09-30  2:03         ` Lee Revell [this message]
2006-10-03 15:35           ` Lee Revell
2006-10-04  9:17             ` Takashi Iwai
2006-10-19 22:12               ` Lee Revell
2006-10-20 12:55                 ` Takashi Iwai
2006-10-20 20:12                   ` Lee Revell
2006-10-23 13:09                     ` Takashi Iwai
2006-10-23 17:46                       ` Lee Revell
2006-10-24 15:01                         ` Takashi Iwai
2006-10-24 15:30                           ` Lee Revell
2006-10-24 23:54                           ` Lee Revell
2006-10-04  9:07           ` Takashi Iwai
2006-09-27 13:58     ` Lee Revell
2006-09-27 16:52       ` Takashi Iwai
  -- strict thread matches above, loose matches on Subject: below --
2013-10-22  7:02 Driver Design Question Johannes Thumshirn
2013-10-23  3:10 ` Guenter Roeck
2013-10-23  7:29   ` Johannes Thumshirn
2006-09-12 20:27 Driver design question Lee Revell
2005-05-19  6:24 driver " Jean Delvare
2005-05-19  6:24 ` Philip Edelbrock
2005-05-19  6:24 ` Jean Delvare
2005-05-19  6:24 ` Philip Edelbrock
2005-05-19  6:24 ` Philip Edelbrock
2005-05-19  6:24 ` Jean Delvare
2005-05-19  6:24 ` Jean Delvare
2005-05-19  6:24 ` Philip Pokorny
2005-05-19  6:24 ` Mark M. Hoffman
2005-05-19  6:24 ` Philip Pokorny
2005-05-19  6:24 ` Mark D. Studebaker 

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1159581790.7086.141.camel@mindpipe \
    --to=rlrevell@joe-job.com \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.