From: Hans de Goede <hdegoede@redhat.com>
To: Antonio Ospite <ao2@ao2.it>, Linux Media <linux-media@vger.kernel.org>
Cc: Hans Verkuil <hverkuil@xs4all.nl>
Subject: Re: [PATCH 6/7] [media] gspca: fix a v4l2-compliance failure during VIDIOC_REQBUFS
Date: Thu, 10 Mar 2016 15:54:37 +0100 [thread overview]
Message-ID: <56E18AAD.9010600@redhat.com> (raw)
In-Reply-To: <1457539401-11515-7-git-send-email-ao2@ao2.it>
Hi,
On 09-03-16 17:03, Antonio Ospite wrote:
> When calling VIDIOC_REQBUFS v4l2-compliance fails with this message:
>
> fail: v4l2-test-buffers.cpp(476): q.reqbufs(node, 1)
> test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL
>
> By looking at the v4l2-compliance code the failure happens when trying
> to request V4L2_MEMORY_USERPTR buffers without freeing explicitly the
> previously allocated V4L2_MEMORY_MMAP buffers.
>
> This would suggest that when changing the memory field in struct
> v4l2_requestbuffers the driver is supposed to free automatically any
> previous allocated buffers, and looking for inspiration at the code in
> drivers/media/v4l2-core/videobuf2-core.c::vb2_core_reqbufs() seems to
> confirm this interpretation; however gspca is just returning -EBUSY in
> this case.
>
> Removing the special handling for the case of a different memory value
> fixes the compliance failure.
>
> Signed-off-by: Antonio Ospite <ao2@ao2.it>
> ---
>
> This should be safe, but I'd really like a comment from someone with a more
> global knowledge of v4l2.
>
> If my interpretation about how drivers should behave when the value of the
> memory field changes is correct, I could send also a documentation update for
> Documentation/DocBook/media/v4l/vidioc-reqbufs.xml
>
> Just let me know.
>
> Thanks,
> Antonio
>
>
> drivers/media/usb/gspca/gspca.c | 7 -------
> 1 file changed, 7 deletions(-)
>
> diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c
> index 84b0d6a..915b6c7 100644
> --- a/drivers/media/usb/gspca/gspca.c
> +++ b/drivers/media/usb/gspca/gspca.c
> @@ -1402,13 +1402,6 @@ static int vidioc_reqbufs(struct file *file, void *priv,
> if (mutex_lock_interruptible(&gspca_dev->queue_lock))
> return -ERESTARTSYS;
>
> - if (gspca_dev->memory != GSPCA_MEMORY_NO
> - && gspca_dev->memory != GSPCA_MEMORY_READ
> - && gspca_dev->memory != rb->memory) {
> - ret = -EBUSY;
> - goto out;
> - }
> -
reqbufs is used internally and this change will allow changing
gspca_dev->memory from USERPTR / MMAP to GSPCA_MEMORY_READ
please replace this check with a check to only allow
rb->memory to be GSPCA_MEMORY_READ when coming from GSPCA_MEMORY_NO
or GSPCA_MEMORY_READ
Regards,
Hans
> /* only one file may do the capture */
> if (gspca_dev->capt_file != NULL
> && gspca_dev->capt_file != file) {
>
next prev parent reply other threads:[~2016-03-10 14:54 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-09 16:03 [PATCH 0/7] gspca: pass all v4l2-compliance tests + minor fixes Antonio Ospite
2016-03-09 16:03 ` [PATCH 1/7] [media] gspca: ov534/topro: use a define for the default framerate Antonio Ospite
2016-03-09 16:03 ` [PATCH 2/7] [media] gspca: fix setting frame interval type in vidioc_enum_frameintervals() Antonio Ospite
2016-03-09 16:03 ` [PATCH 3/7] [media] gspca: rename wxh_to_mode() to wxh_to_nearest_mode() Antonio Ospite
2016-03-09 16:03 ` [PATCH 4/7] [media] gspca: fix a v4l2-compliance failure about VIDIOC_ENUM_FRAMEINTERVALS Antonio Ospite
2016-03-09 16:03 ` [PATCH 5/7] [media] gspca: fix a v4l2-compliance failure about buffer timestamp Antonio Ospite
2016-03-09 16:03 ` [PATCH 6/7] [media] gspca: fix a v4l2-compliance failure during VIDIOC_REQBUFS Antonio Ospite
2016-03-09 16:10 ` Hans Verkuil
2016-03-10 14:54 ` Hans de Goede [this message]
2016-03-14 15:02 ` Antonio Ospite
2016-03-14 15:34 ` Hans de Goede
2016-03-09 16:03 ` [PATCH 7/7] [media] gspca: fix a v4l2-compliance failure during read() Antonio Ospite
2016-03-10 15:59 ` Hans de Goede
2016-03-14 15:11 ` Antonio Ospite
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=56E18AAD.9010600@redhat.com \
--to=hdegoede@redhat.com \
--cc=ao2@ao2.it \
--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 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.