From: Hans de Goede <hdegoede@redhat.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Nicolas Dufresne <nicolas.dufresne@collabora.co.uk>,
Linux Media Mailing List <linux-media@vger.kernel.org>,
Marek Szyprowski <m.szyprowski@samsung.com>
Subject: Re: [PATCH] videobuf: Allow reqbufs(0) to free current buffers
Date: Mon, 01 Sep 2014 17:36:08 +0200 [thread overview]
Message-ID: <54049268.3060004@redhat.com> (raw)
In-Reply-To: <540474AE.4070706@xs4all.nl>
Hi,
On 09/01/2014 03:29 PM, Hans Verkuil wrote:
> Hi Hans,
>
> At first glance this looks fine. But making changes in videobuf is always scary :-)
> so I hope Marek can look at this as well.
>
> How well was this tested?
I ran some tests on bttv which all ran well.
Note that the code already allowed for going from say 4 buffers to 1,
and the old code path for reqbufs was already calling __videobuf_free()
before re-allocating the buffers again. So in essence this just changes
things to allow the 4 buffers to 1 case to also be 4 buffers to 0.
Regards,
Hans
>
> I'll try do test this as well.
>
> Regards,
>
> Hans
>
> On 08/31/2014 12:19 PM, Hans de Goede wrote:
>> All the infrastructure for this is already there, and despite our desires for
>> the old videobuf code to go away, it is currently still in use in 18 drivers.
>>
>> Allowing reqbufs(0) makes these drivers behave consistent with modern drivers,
>> making live easier for userspace, see e.g. :
>> https://bugzilla.gnome.org/show_bug.cgi?id=735660
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>> drivers/media/v4l2-core/videobuf-core.c | 11 ++++++-----
>> 1 file changed, 6 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/media/v4l2-core/videobuf-core.c b/drivers/media/v4l2-core/videobuf-core.c
>> index fb5ee5d..b91a266 100644
>> --- a/drivers/media/v4l2-core/videobuf-core.c
>> +++ b/drivers/media/v4l2-core/videobuf-core.c
>> @@ -441,11 +441,6 @@ int videobuf_reqbufs(struct videobuf_queue *q,
>> unsigned int size, count;
>> int retval;
>>
>> - if (req->count < 1) {
>> - dprintk(1, "reqbufs: count invalid (%d)\n", req->count);
>> - return -EINVAL;
>> - }
>> -
>> if (req->memory != V4L2_MEMORY_MMAP &&
>> req->memory != V4L2_MEMORY_USERPTR &&
>> req->memory != V4L2_MEMORY_OVERLAY) {
>> @@ -471,6 +466,12 @@ int videobuf_reqbufs(struct videobuf_queue *q,
>> goto done;
>> }
>>
>> + if (req->count == 0) {
>> + dprintk(1, "reqbufs: count invalid (%d)\n", req->count);
>> + retval = __videobuf_free(q);
>> + goto done;
>> + }
>> +
>> count = req->count;
>> if (count > VIDEO_MAX_FRAME)
>> count = VIDEO_MAX_FRAME;
>>
>
next prev parent reply other threads:[~2014-09-01 15:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-31 10:19 [PATCH] videobuf: Allow reqbufs(0) to free current buffers Hans de Goede
2014-09-01 13:29 ` Hans Verkuil
2014-09-01 15:36 ` Hans de Goede [this message]
2014-09-02 7:36 ` Marek Szyprowski
2014-09-02 7:41 ` 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=54049268.3060004@redhat.com \
--to=hdegoede@redhat.com \
--cc=hverkuil@xs4all.nl \
--cc=linux-media@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=nicolas.dufresne@collabora.co.uk \
/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;
as well as URLs for NNTP newsgroup(s).