aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/v4l2-core/videobuf2-core.c
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2014-04-07 08:20:39 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-04-16 17:46:35 -0400
commite35e41b57624b9a8c0014420cdfb24454e4773c5 (patch)
tree6e00a462572fd2aaf9575fd7dadbead65a0b5541 /drivers/media/v4l2-core/videobuf2-core.c
parentebd7c50510f4b56285bb9fb4ba56a501c9c8f7df (diff)
[media] vb2: reject output buffers with V4L2_FIELD_ALTERNATE
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> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/v4l2-core/videobuf2-core.c')
-rw-r--r--drivers/media/v4l2-core/videobuf2-core.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
index 07ab0677e259..2eef5ef93e93 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -1564,6 +1564,19 @@ static int __buf_prepare(struct vb2_buffer *vb, const struct v4l2_buffer *b)
1564 dprintk(1, "plane parameters verification failed: %d\n", ret); 1564 dprintk(1, "plane parameters verification failed: %d\n", ret);
1565 return ret; 1565 return ret;
1566 } 1566 }
1567 if (b->field == V4L2_FIELD_ALTERNATE && V4L2_TYPE_IS_OUTPUT(q->type)) {
1568 /*
1569 * If the format's field is ALTERNATE, then the buffer's field
1570 * should be either TOP or BOTTOM, not ALTERNATE since that
1571 * makes no sense. The driver has to know whether the
1572 * buffer represents a top or a bottom field in order to
1573 * program any DMA correctly. Using ALTERNATE is wrong, since
1574 * that just says that it is either a top or a bottom field,
1575 * but not which of the two it is.
1576 */
1577 dprintk(1, "the field is incorrectly set to ALTERNATE for an output buffer\n");
1578 return -EINVAL;
1579 }
1567 1580
1568 vb->state = VB2_BUF_STATE_PREPARING; 1581 vb->state = VB2_BUF_STATE_PREPARING;
1569 vb->v4l2_buf.timestamp.tv_sec = 0; 1582 vb->v4l2_buf.timestamp.tv_sec = 0;