]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 6 Oct 2014 15:43:22 +0000 (08:43 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 6 Oct 2014 15:43:22 +0000 (08:43 -0700)
added patches:
media-vb2-fix-vbi-poll-regression.patch

queue-3.14/media-vb2-fix-vbi-poll-regression.patch [new file with mode: 0644]
queue-3.14/series

diff --git a/queue-3.14/media-vb2-fix-vbi-poll-regression.patch b/queue-3.14/media-vb2-fix-vbi-poll-regression.patch
new file mode 100644 (file)
index 0000000..4289adb
--- /dev/null
@@ -0,0 +1,105 @@
+From 58d75f4b1ce26324b4d809b18f94819843a98731 Mon Sep 17 00:00:00 2001
+From: Hans Verkuil <hans.verkuil@cisco.com>
+Date: Sat, 20 Sep 2014 16:16:35 -0300
+Subject: media: vb2: fix VBI/poll regression
+
+From: Hans Verkuil <hans.verkuil@cisco.com>
+
+commit 58d75f4b1ce26324b4d809b18f94819843a98731 upstream.
+
+The recent conversion of saa7134 to vb2 unconvered a poll() bug that
+broke the teletext applications alevt and mtt. These applications
+expect that calling poll() without having called VIDIOC_STREAMON will
+cause poll() to return POLLERR. That did not happen in vb2.
+
+This patch fixes that behavior. It also fixes what should happen when
+poll() is called when STREAMON is called but no buffers have been
+queued. In that case poll() will also return POLLERR, but only for
+capture queues since output queues will always return POLLOUT
+anyway in that situation.
+
+This brings the vb2 behavior in line with the old videobuf behavior.
+
+Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/media/v4l2-core/videobuf2-core.c |   15 +++++++++++++--
+ include/media/videobuf2-core.h           |    4 ++++
+ 2 files changed, 17 insertions(+), 2 deletions(-)
+
+--- a/drivers/media/v4l2-core/videobuf2-core.c
++++ b/drivers/media/v4l2-core/videobuf2-core.c
+@@ -745,6 +745,7 @@ static int __reqbufs(struct vb2_queue *q
+        * to the userspace.
+        */
+       req->count = allocated_buffers;
++      q->waiting_for_buffers = !V4L2_TYPE_IS_OUTPUT(q->type);
+       return 0;
+ }
+@@ -793,6 +794,7 @@ static int __create_bufs(struct vb2_queu
+               memset(q->plane_sizes, 0, sizeof(q->plane_sizes));
+               memset(q->alloc_ctx, 0, sizeof(q->alloc_ctx));
+               q->memory = create->memory;
++              q->waiting_for_buffers = !V4L2_TYPE_IS_OUTPUT(q->type);
+       }
+       num_buffers = min(create->count, VIDEO_MAX_FRAME - q->num_buffers);
+@@ -1447,6 +1449,7 @@ static int vb2_internal_qbuf(struct vb2_
+        * dequeued in dqbuf.
+        */
+       list_add_tail(&vb->queued_entry, &q->queued_list);
++      q->waiting_for_buffers = false;
+       vb->state = VB2_BUF_STATE_QUEUED;
+       /*
+@@ -1841,6 +1844,7 @@ static int vb2_internal_streamoff(struct
+        * and videobuf, effectively returning control over them to userspace.
+        */
+       __vb2_queue_cancel(q);
++      q->waiting_for_buffers = !V4L2_TYPE_IS_OUTPUT(q->type);
+       dprintk(3, "Streamoff successful\n");
+       return 0;
+@@ -2150,9 +2154,16 @@ unsigned int vb2_poll(struct vb2_queue *
+       }
+       /*
+-       * There is nothing to wait for if no buffers have already been queued.
++       * There is nothing to wait for if the queue isn't streaming.
+        */
+-      if (list_empty(&q->queued_list))
++      if (!vb2_is_streaming(q))
++              return res | POLLERR;
++      /*
++       * For compatibility with vb1: if QBUF hasn't been called yet, then
++       * return POLLERR as well. This only affects capture queues, output
++       * queues will always initialize waiting_for_buffers to false.
++       */
++      if (q->waiting_for_buffers)
+               return res | POLLERR;
+       if (list_empty(&q->done_list))
+--- a/include/media/videobuf2-core.h
++++ b/include/media/videobuf2-core.h
+@@ -329,6 +329,9 @@ struct v4l2_fh;
+  * @retry_start_streaming: start_streaming() was called, but there were not enough
+  *            buffers queued. If set, then retry calling start_streaming when
+  *            queuing a new buffer.
++ * @waiting_for_buffers: used in poll() to check if vb2 is still waiting for
++ *            buffers. Only set for capture queues if qbuf has not yet been
++ *            called since poll() needs to return POLLERR in that situation.
+  * @fileio:   file io emulator internal data, used only if emulator is active
+  */
+ struct vb2_queue {
+@@ -362,6 +365,7 @@ struct vb2_queue {
+       unsigned int                    streaming:1;
+       unsigned int                    retry_start_streaming:1;
++      unsigned int                    waiting_for_buffers:1;
+       struct vb2_fileio_data          *fileio;
+ };
index 40bb85b20b2009e96c98e340ca039e59afd82f89..e1db0fa166fa02414b66fb65c6a32545aaebacd1 100644 (file)
@@ -11,3 +11,4 @@ cifs-fix-smb2-readdir-error-handling.patch
 hugetlb-ensure-hugepage-access-is-denied-if-hugepages-are-not-supported.patch
 mm-thp-move-invariant-bug-check-out-of-loop-in-__split_huge_page_map.patch
 mm-numa-do-not-mark-ptes-pte_numa-when-splitting-huge-pages.patch
+media-vb2-fix-vbi-poll-regression.patch