All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: linux-media@vger.kernel.org
Cc: pawel@osciak.com, Hans Verkuil <hans.verkuil@cisco.com>
Subject: [REVIEWv2 PATCH 07/13] vb2: reject output buffers with V4L2_FIELD_ALTERNATE
Date: Mon,  7 Apr 2014 15:11:06 +0200	[thread overview]
Message-ID: <1396876272-18222-8-git-send-email-hverkuil@xs4all.nl> (raw)
In-Reply-To: <1396876272-18222-1-git-send-email-hverkuil@xs4all.nl>

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>
---
 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 b7de6be..c662ad9 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;
+	}
 
 	vb->state = VB2_BUF_STATE_PREPARING;
 	vb->v4l2_buf.timestamp.tv_sec = 0;
-- 
1.9.1


  parent reply	other threads:[~2014-04-07 13:11 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-07 13:10 [REVIEWv2 PATCH 00/13] vb2: various small fixes/improvements Hans Verkuil
2014-04-07 13:11 ` [REVIEWv2 PATCH 01/13] vb2: stop_streaming should return void Hans Verkuil
2014-04-07 13:11 ` [REVIEWv2 PATCH 02/13] vb2: fix handling of data_offset and v4l2_plane.reserved[] Hans Verkuil
2014-04-10  0:46   ` Pawel Osciak
2014-04-10  6:40     ` Hans Verkuil
2014-04-11 12:48   ` Tomasz Stanislawski
2014-04-11 13:03     ` Hans Verkuil
2014-04-11 13:48       ` Tomasz Stanislawski
2014-04-11 14:07         ` Hans Verkuil
2014-04-07 13:11 ` [REVIEWv2 PATCH 03/13] vb2: if bytesused is 0, then fill with output buffer length Hans Verkuil
2014-04-07 13:11 ` [REVIEWv2 PATCH 04/13] vb2: use correct prefix Hans Verkuil
2014-04-10  0:51   ` Pawel Osciak
2014-04-10  0:52   ` Pawel Osciak
2014-04-07 13:11 ` [REVIEWv2 PATCH 05/13] vb2: move __qbuf_mmap before __qbuf_userptr Hans Verkuil
2014-04-07 13:11 ` [REVIEWv2 PATCH 06/13] vb2: set timestamp when using write() Hans Verkuil
2014-04-10  0:55   ` Pawel Osciak
2014-04-07 13:11 ` Hans Verkuil [this message]
2014-04-10  0:57   ` [REVIEWv2 PATCH 07/13] vb2: reject output buffers with V4L2_FIELD_ALTERNATE Pawel Osciak
2014-04-07 13:11 ` [REVIEWv2 PATCH 08/13] vb2: simplify a confusing condition Hans Verkuil
2014-04-07 13:11 ` [REVIEWv2 PATCH 09/13] vb2: add vb2_fileio_is_active and check it more often Hans Verkuil
2014-04-10  1:06   ` Pawel Osciak
2014-04-07 13:11 ` [REVIEWv2 PATCH 10/13] vb2: set v4l2_buffer.bytesused to 0 for mp buffers Hans Verkuil
2014-04-10  1:08   ` Pawel Osciak
2014-04-10  1:10     ` Pawel Osciak
2014-04-07 13:11 ` [REVIEWv2 PATCH 11/13] vb2: allow read/write as long as the format is single planar Hans Verkuil
2014-04-07 13:11 ` [REVIEWv2 PATCH 12/13] vb2: start messages with a lower-case for consistency Hans Verkuil
2014-04-10  1:11   ` Pawel Osciak
2014-04-07 13:11 ` [REVIEWv2 PATCH 13/13] DocBook media: update bytesused field description 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=1396876272-18222-8-git-send-email-hverkuil@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=hans.verkuil@cisco.com \
    --cc=linux-media@vger.kernel.org \
    --cc=pawel@osciak.com \
    /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.