From: Hans Verkuil <hverkuil@xs4all.nl>
To: Archit Taneja <archit@ti.com>, linux-media@vger.kernel.org
Cc: pawel@osciak.com, sakari.ailus@iki.fi, m.szyprowski@samsung.com,
s.nawrocki@samsung.com, Hans Verkuil <hans.verkuil@cisco.com>
Subject: Re: [REVIEWv3 PATCH 07/13] vb2: reject output buffers with V4L2_FIELD_ALTERNATE
Date: Fri, 11 Apr 2014 10:58:45 +0200 [thread overview]
Message-ID: <5347AEC5.6050700@xs4all.nl> (raw)
In-Reply-To: <5347AAF5.30704@ti.com>
On 04/11/2014 10:42 AM, Archit Taneja wrote:
> On Friday 11 April 2014 01:41 PM, Hans Verkuil wrote:
>> From: Hans Verkuil <hans.verkuil@cisco.com>
>>
>> This is not allowed by the spec and does in fact not make any sense.
>> Return -EINVAL if this is the case.
>>
>> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
>> Acked-by: Pawel Osciak <pawel@osciak.com>
>> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
>> ---
>> drivers/media/v4l2-core/videobuf2-core.c | 13 +++++++++++++
>> 1 file changed, 13 insertions(+)
>>
>> diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
>> index 6e05495..f8c0247 100644
>> --- a/drivers/media/v4l2-core/videobuf2-core.c
>> +++ b/drivers/media/v4l2-core/videobuf2-core.c
>> @@ -1511,6 +1511,19 @@ static int __buf_prepare(struct vb2_buffer *vb, const struct v4l2_buffer *b)
>> dprintk(1, "plane parameters verification failed: %d\n", ret);
>> return ret;
>> }
>> + if (b->field == V4L2_FIELD_ALTERNATE && V4L2_TYPE_IS_OUTPUT(q->type)) {
>> + /*
>> + * If the format's field is ALTERNATE, then the buffer's field
>> + * should be either TOP or BOTTOM, not ALTERNATE since that
>> + * makes no sense. The driver has to know whether the
>> + * buffer represents a top or a bottom field in order to
>> + * program any DMA correctly. Using ALTERNATE is wrong, since
>> + * that just says that it is either a top or a bottom field,
>> + * but not which of the two it is.
>> + */
>> + dprintk(1, "the field is incorrectly set to ALTERNATE for an output buffer\n");
>> + return -EINVAL;
>> + }
>
> If vb2_queue had a field parameter, which tells the format's field type.
> We could have returned an error if the field format was ALTERNATE, and
> the buffer field was not TOP or BOTTOM.
>
> I don't know whether having a field parameter in vb2_queue is a good
> idea or not.
The predecessor of vb2, videobuf, had that actually.
I am not sure myself if it is a good idea or not to do the same for vb2.
For now I think we should leave it as is. There are very few drivers that
support FIELD_ALTERNATE although this should become more common for
drivers supporting interlaced HDTV formats. When we see more drivers that
support this, then we can see if it makes sense to move part of the handling
to vb2.
Regards,
Hans
next prev parent reply other threads:[~2014-04-11 8:59 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-11 8:11 [REVIEWv3 PATCH 00/13] vb2: various small fixes/improvements Hans Verkuil
2014-04-11 8:11 ` [REVIEWv3 PATCH 01/13] vb2: stop_streaming should return void Hans Verkuil
2014-04-16 21:38 ` Mauro Carvalho Chehab
2014-04-17 2:26 ` Mauro Carvalho Chehab
2014-04-11 8:11 ` [REVIEWv3 PATCH 02/13] vb2: fix handling of data_offset and v4l2_plane.reserved[] Hans Verkuil
2014-04-11 8:11 ` [REVIEWv3 PATCH 03/13] vb2: if bytesused is 0, then fill with output buffer length Hans Verkuil
2014-04-11 8:11 ` [REVIEWv3 PATCH 04/13] vb2: use correct prefix Hans Verkuil
2014-04-11 8:11 ` [REVIEWv3 PATCH 05/13] vb2: move __qbuf_mmap before __qbuf_userptr Hans Verkuil
2014-04-11 8:11 ` [REVIEWv3 PATCH 06/13] vb2: set timestamp when using write() Hans Verkuil
2014-04-11 8:11 ` [REVIEWv3 PATCH 07/13] vb2: reject output buffers with V4L2_FIELD_ALTERNATE Hans Verkuil
2014-04-11 8:42 ` Archit Taneja
2014-04-11 8:58 ` Hans Verkuil [this message]
2014-04-11 9:02 ` Archit Taneja
2014-04-11 8:11 ` [REVIEWv3 PATCH 08/13] vb2: simplify a confusing condition Hans Verkuil
2014-04-11 8:11 ` [REVIEWv3 PATCH 09/13] vb2: add vb2_fileio_is_active and check it more often Hans Verkuil
2014-04-11 13:05 ` Tomasz Stanislawski
2014-04-11 13:22 ` Hans Verkuil
2014-04-11 8:11 ` [REVIEWv3 PATCH 10/13] vb2: allow read/write as long as the format is single planar Hans Verkuil
2014-04-11 8:11 ` [REVIEWv3 PATCH 11/13] vb2: start messages with a lower-case for consistency Hans Verkuil
2014-04-11 8:11 ` [REVIEWv3 PATCH 12/13] DocBook media: update bytesused field description Hans Verkuil
2014-04-11 8:11 ` [REVIEWv3 PATCH 13/13] v4l2-pci-skeleton.c: fix alternate field handling Hans Verkuil
2014-04-11 9:39 ` [REVIEWv3 PATCH 00/13] vb2: various small fixes/improvements Sakari Ailus
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=5347AEC5.6050700@xs4all.nl \
--to=hverkuil@xs4all.nl \
--cc=archit@ti.com \
--cc=hans.verkuil@cisco.com \
--cc=linux-media@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=pawel@osciak.com \
--cc=s.nawrocki@samsung.com \
--cc=sakari.ailus@iki.fi \
/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