On Friday, April 08, 2011 09:00:55 Marek Szyprowski wrote: > Hello, > > On Monday, April 04, 2011 1:52 PM Hans Verkuil wrote: > > > The vb2_poll function would start read DMA if called without any streaming > > in progress. This unfortunately does not work if the application just wants > > to poll for exceptions. This information of what the application is polling > > for is sadly unavailable in the driver. > > > > Andy Walls suggested to just return POLLIN | POLLRDNORM and let the first > > call to read start the DMA. This initial read() call will return EAGAIN > > since no actual data is available yet, but it does start the DMA. > > The current implementation of vb2_read() will just start streaming on first > call without returning EAGAIN. Do you think this should be changed? In the non-blocking case vb2_read will also return EAGAIN. Which is what I meant. So nothing needs to be changed. Regards, Hans > > > > > Application are supposed to handle EAGAIN. MythTV does handle this > > correctly. > > > > Signed-off-by: Hans Verkuil <hans.verkuil@xxxxxxxxx> > > --- > > drivers/media/video/videobuf2-core.c | 16 +++------------- > > 1 files changed, 3 insertions(+), 13 deletions(-) > > > > diff --git a/drivers/media/video/videobuf2-core.c > > b/drivers/media/video/videobuf2-core.c > > index 6698c77..2dea57a 100644 > > --- a/drivers/media/video/videobuf2-core.c > > +++ b/drivers/media/video/videobuf2-core.c > > @@ -1372,20 +1372,10 @@ unsigned int vb2_poll(struct vb2_queue *q, struct > > file *file, poll_table *wait) > > * Start file I/O emulator only if streaming API has not been used > > yet. > > */ > > if (q->num_buffers == 0 && q->fileio == NULL) { > > - if (!V4L2_TYPE_IS_OUTPUT(q->type) && (q->io_modes & VB2_READ)) > > { > > - ret = __vb2_init_fileio(q, 1); > > - if (ret) > > - return POLLERR; > > - } > > - if (V4L2_TYPE_IS_OUTPUT(q->type) && (q->io_modes & VB2_WRITE)) > > { > > - ret = __vb2_init_fileio(q, 0); > > - if (ret) > > - return POLLERR; > > - /* > > - * Write to OUTPUT queue can be done immediately. > > - */ > > + if (!V4L2_TYPE_IS_OUTPUT(q->type) && (q->io_modes & VB2_READ)) > > + return POLLIN | POLLRDNORM; > > + if (V4L2_TYPE_IS_OUTPUT(q->type) && (q->io_modes & VB2_WRITE)) > > return POLLOUT | POLLWRNORM; > > - } > > } > > > > /* > > -- > > Best regards > -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html