From: Hans Verkuil <hverkuil@xs4all.nl>
To: Florian Echtler <floe@butterbrot.org>
Cc: linux-input <linux-input@vger.kernel.org>, linux-media@vger.kernel.org
Subject: Re: [RFC] [Patch] implement video driver for sur40
Date: Tue, 06 Jan 2015 11:23:25 +0100 [thread overview]
Message-ID: <54ABB79D.7010700@xs4all.nl> (raw)
In-Reply-To: <54ABB641.7050002@butterbrot.org>
On 01/06/2015 11:17 AM, Florian Echtler wrote:
> On 06.01.2015 10:36, Hans Verkuil wrote:
>> On 01/06/2015 10:29 AM, Florian Echtler wrote:
>>> There's only one failing test left, which is this one:
>>>
>>> Streaming ioctls:
>>> test read/write: OK
>>> fail: v4l2-test-buffers.cpp(284): g_field() == V4L2_FIELD_ANY
>>
>> You're not filling in the 'field' field of struct v4l2_buffer when returning a
>> frame. It should most likely be FIELD_NONE in your case.
>>> fail: v4l2-test-buffers.cpp(611): buf.check(q, last_seq)
>>> fail: v4l2-test-buffers.cpp(884): captureBufs(node, q, m2m_q, frame_count, false)
> OK, easy to fix. This will also influence the other two warnings, I assume?
Most likely, yes.
>
>>> On a different note, I'm getting occasional warnings in syslog when I run
>>> a regular video streaming application (e.g. cheese):
>>>
>>> ------------[ cut here ]------------
> ...
>>> ---[ end trace 451ed974170f6e44 ]---
>>>
>>> Does this mean the driver consumes too much CPU resources?
>>
>> No, it means that your driver is not returning all buffers to vb2. Most
>> likely this is missing in the vb2 stop_streaming op. When that is called
>> your driver must return all buffers it has back to vb2 by calling
>> vb2_buffer_done with state ERROR. The same can happen in the start_streaming
>> op if that returns an error for some reason. In that case all buffers owned
>> by the driver should be returned to vb2 with state QUEUED. See also
>> Documentation/video4linux/v4l2-pci-skeleton.c as reference code.
> I did actually build my driver code based on v4l2-pci-skeleton.c, and
> I'm calling the exact same return_all_buffers function (see below) with
> VB2_BUF_STATE_ERROR from my stop_streaming ioctl.
>
> static void return_all_buffers(struct sur40_state *sur40,
> enum vb2_buffer_state state)
> {
> struct sur40_buffer *buf, *node;
>
> spin_lock(&sur40->qlock);
> list_for_each_entry_safe(buf, node, &sur40->buf_list, list) {
> vb2_buffer_done(&buf->vb, state);
> list_del(&buf->list);
> }
> spin_unlock(&sur40->qlock);
> }
>
> Is there another possible explanation?
No :-)
You are still missing a buffer somewhere. I'd have to see your latest source code
to see what's wrong.
Some drivers (esp. USB drivers) use a separate pointer to the active buffer, so that
buffer is no longer part of the buf_list, but still needs to be returned in stop_streaming.
Could that be the cause perhaps?
Regards,
Hans
next prev parent reply other threads:[~2015-01-06 10:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-18 13:34 [RFC] [Patch] implement video driver for sur40 Florian Echtler
2014-12-18 14:11 ` Hans Verkuil
2014-12-19 14:30 ` Florian Echtler
2014-12-19 14:36 ` Hans Verkuil
2014-12-19 14:57 ` Florian Echtler
2014-12-19 15:27 ` Hans Verkuil
2015-01-06 9:29 ` Florian Echtler
2015-01-06 9:36 ` Hans Verkuil
2015-01-06 10:17 ` Florian Echtler
2015-01-06 10:23 ` Hans Verkuil [this message]
2015-01-06 12:09 ` Florian Echtler
2015-01-06 13:01 ` 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=54ABB79D.7010700@xs4all.nl \
--to=hverkuil@xs4all.nl \
--cc=floe@butterbrot.org \
--cc=linux-input@vger.kernel.org \
--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.