From: Takashi Iwai Subject: Re: Miscellaneous ioplug questions Date: Wed, 15 Aug 2018 11:47:11 +0200 Message-ID: References: Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 0924E2675DA for ; Wed, 15 Aug 2018 11:47:11 +0200 (CEST) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Rob Duncan Cc: "'alsa-devel@alsa-project.org'" List-Id: alsa-devel@alsa-project.org On Tue, 14 Aug 2018 18:25:15 +0200, Rob Duncan wrote: > > Hi Takashi, > > >> - Should the poll FD be made writeable as soon as data is available, or > >> only when at least avail_min is available? > > > > The latter. Again, ioplug emulates the hardware driver, so the poll > > should behave same as the hardware driver does. > > (Though, admittedly, not all plugin implementations follow this > > strictly....) > > So, the poll FD must be readable while there is at least avail_min in > the buffer, and must NOT be readable if there is less than avail_min. > Is that right? Yes. > To labor the point a bit, if exactly avail_min becomes available the > poll FD must be made readable. If a single frame is now transferred, so > the buffer has (avail_min - 1) available, what must the state of the > poll FD be? The driver sipmly doesn't set POLLIN|POLLRDNORM bits (or POLLOUT|POLLWRNORM) unless avail >= avail_min. > A couple more questions: > > If we are configured to do blocking operations must the read and write > callbacks always transfer the full requested size, or can they do > partial transfers? In general, a partial transfer is always allowed no matter whether blocking or non-blocking mode is. Takashi > On the other hand, what if we are configured to do non-blocking > operations? > > Or does the caller guarantee not to request a transfer larger than what > the ioplugin reports as available? > > Thanks, > > Rob. >