From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org, Hans Verkuil <hans.verkuil@cisco.com>
Subject: Re: [RFCv3 PATCH 12/18] vb2_poll: don't start DMA, leave that to the first read().
Date: Mon, 27 Jun 2011 18:52:37 -0300 [thread overview]
Message-ID: <4E08FBA5.5080006@redhat.com> (raw)
In-Reply-To: <f1a14e0985ddaa053e45522fe7bbdfae56057ec2.1307458245.git.hans.verkuil@cisco.com>
Em 07-06-2011 12:05, Hans Verkuil escreveu:
> From: Hans Verkuil <hans.verkuil@cisco.com>
>
> 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.
>
> Applications must handle EAGAIN in any case since there can be other reasons
> for EAGAIN as well.
>
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> ---
> drivers/media/video/videobuf2-core.c | 17 +++--------------
> 1 files changed, 3 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/media/video/videobuf2-core.c b/drivers/media/video/videobuf2-core.c
> index 6ba1461..ad75c95 100644
> --- a/drivers/media/video/videobuf2-core.c
> +++ b/drivers/media/video/videobuf2-core.c
> @@ -1372,27 +1372,16 @@ static int __vb2_cleanup_fileio(struct vb2_queue *q);
> unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait)
> {
> unsigned long flags;
> - unsigned int ret;
> struct vb2_buffer *vb = NULL;
>
> /*
> * 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;
> - }
> }
There is one behavior change on this patchset: __vb2_init_fileio() checks for some
troubles that may happen during device streaming initialization, returning POLLERR
if there is a problem there.
By moving this code to be called only at read, it means the poll() will not fail
anymore, but the first read() will fail. The man page for read() doesn't tell that
-EBUSY or -ENOMEM could happen there. The same happens with V4L2 specs. So, it is
clearly violating kernel ABI.
NACK.
Mauro.
next prev parent reply other threads:[~2011-06-27 21:52 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-07 15:05 [RFCv3 PATCH 00/18] Add Control Event and autofoo/foo support Hans Verkuil
2011-06-07 15:05 ` [RFCv3 PATCH 01/18] v4l2-ctrls: introduce call_op define Hans Verkuil
2011-06-07 15:05 ` [RFCv3 PATCH 02/18] v4l2-ctrls: simplify error_idx handling Hans Verkuil
2011-06-07 15:05 ` [RFCv3 PATCH 03/18] v4l2-ctrls: drivers should be able to ignore the READ_ONLY flag Hans Verkuil
2011-06-07 15:05 ` [RFCv3 PATCH 04/18] v4l2-ioctl: add ctrl_handler to v4l2_fh Hans Verkuil
2011-06-07 15:05 ` [RFCv3 PATCH 05/18] v4l2-subdev: implement per-filehandle control handlers Hans Verkuil
2011-06-07 15:05 ` [RFCv3 PATCH 06/18] v4l2-ctrls: fix and improve volatile control handling Hans Verkuil
2011-06-07 15:05 ` [RFCv3 PATCH 07/18] v4l2-controls.txt: update to latest v4l2-ctrl.c changes Hans Verkuil
2011-06-07 15:05 ` [RFCv3 PATCH 08/18] v4l2-ctrls: add v4l2_ctrl_auto_cluster to simplify autogain/gain scenarios Hans Verkuil
2011-06-20 13:05 ` Laurent Pinchart
2011-06-20 13:16 ` Hans Verkuil
2011-06-27 20:57 ` Mauro Carvalho Chehab
2011-06-28 6:08 ` Hans Verkuil
2011-06-28 10:25 ` Mauro Carvalho Chehab
2011-06-27 21:10 ` Mauro Carvalho Chehab
2011-06-28 6:11 ` Hans Verkuil
2011-06-07 15:05 ` [RFCv3 PATCH 09/18] DocBook: Improve cluster documentation and document the new autoclusters Hans Verkuil
2011-06-07 15:05 ` [RFCv3 PATCH 10/18] vivi: add autogain/gain support to test the autocluster functionality Hans Verkuil
2011-06-07 15:05 ` [RFCv3 PATCH 11/18] v4l2-ctrls: add v4l2_fh pointer to the set control functions Hans Verkuil
2011-06-27 21:20 ` Mauro Carvalho Chehab
2011-06-28 6:22 ` Hans Verkuil
2011-06-28 10:27 ` Mauro Carvalho Chehab
2011-06-07 15:05 ` [RFCv3 PATCH 12/18] vb2_poll: don't start DMA, leave that to the first read() Hans Verkuil
2011-06-27 21:52 ` Mauro Carvalho Chehab [this message]
2011-06-28 7:33 ` Hans Verkuil
2011-06-28 9:01 ` Hans Verkuil
2011-06-28 11:20 ` Mauro Carvalho Chehab
2011-06-28 12:21 ` Andy Walls
2011-06-28 12:43 ` Mauro Carvalho Chehab
2011-06-28 13:58 ` Hans Verkuil
2011-06-29 6:30 ` Hans Verkuil
2011-06-28 23:14 ` Andy Walls
2011-06-29 0:00 ` Mauro Carvalho Chehab
2011-06-29 5:08 ` Andy Walls
2011-06-29 11:37 ` Mauro Carvalho Chehab
2011-06-07 15:05 ` [RFCv3 PATCH 13/18] v4l2-ctrls: add control events Hans Verkuil
2011-06-20 13:33 ` Laurent Pinchart
2011-06-07 15:05 ` [RFCv3 PATCH 14/18] v4l2-ctrls: simplify event subscription Hans Verkuil
2011-06-07 15:05 ` [RFCv3 PATCH 15/18] V4L2 spec: document control events Hans Verkuil
2011-06-07 15:05 ` [RFCv3 PATCH 16/18] vivi: support " Hans Verkuil
2011-06-07 15:05 ` [RFCv3 PATCH 17/18] ivtv: add control event support Hans Verkuil
2011-06-07 15:05 ` [RFCv3 PATCH 18/18] v4l2-compat-ioctl32: add VIDIOC_DQEVENT support Hans Verkuil
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=4E08FBA5.5080006@redhat.com \
--to=mchehab@redhat.com \
--cc=hans.verkuil@cisco.com \
--cc=hverkuil@xs4all.nl \
--cc=linux-media@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox