Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2019-07-14 11:33:41 +0200
committerJiri Slaby <jslaby@suse.cz>2019-07-14 11:33:57 +0200
commit284325edb1fda5a0466aeb50bf745be0563f7bce (patch)
tree4f0c05d17d5d29f769398a9a8bc14b0839e057a9
parent53226f8132ab27d1093d24e48b314b44ce28bb09 (diff)
staging: bcm2835-camera: Handle empty EOS buffers whilst
streaming (bnc#1012628).
-rw-r--r--patches.kernel.org/5.2.1-059-staging-bcm2835-camera-Handle-empty-EOS-buffers.patch99
-rw-r--r--series.conf1
2 files changed, 100 insertions, 0 deletions
diff --git a/patches.kernel.org/5.2.1-059-staging-bcm2835-camera-Handle-empty-EOS-buffers.patch b/patches.kernel.org/5.2.1-059-staging-bcm2835-camera-Handle-empty-EOS-buffers.patch
new file mode 100644
index 0000000000..69982b3ddf
--- /dev/null
+++ b/patches.kernel.org/5.2.1-059-staging-bcm2835-camera-Handle-empty-EOS-buffers.patch
@@ -0,0 +1,99 @@
+From: Dave Stevenson <dave.stevenson@raspberrypi.org>
+Date: Sat, 29 Jun 2019 14:48:23 +0200
+Subject: [PATCH] staging: bcm2835-camera: Handle empty EOS buffers whilst
+ streaming
+References: bnc#1012628
+Patch-mainline: 5.2.1
+Git-commit: a26be06d6d96c10a9ab005e99d93fbb5d3babd98
+
+commit a26be06d6d96c10a9ab005e99d93fbb5d3babd98 upstream.
+
+The change to mapping V4L2 to MMAL buffers 1:1 didn't handle
+the condition we get with raw pixel buffers (eg YUV and RGB)
+direct from the camera's stills port. That sends the pixel buffer
+and then an empty buffer with the EOS flag set. The EOS buffer
+wasn't handled and returned an error up the stack.
+
+Handle the condition correctly by returning it to the component
+if streaming, or returning with an error if stopping streaming.
+
+Fixes: 938416707071 ("staging: bcm2835-camera: Remove V4L2/MMAL buffer remapping")
+Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
+Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
+Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Acked-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ .../bcm2835-camera/bcm2835-camera.c | 21 +++++++++++--------
+ .../vc04_services/bcm2835-camera/mmal-vchiq.c | 5 +++--
+ 2 files changed, 15 insertions(+), 11 deletions(-)
+
+diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
+index bc6ff83ddb01..5e9187edeef4 100644
+--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
++++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
+@@ -336,16 +336,13 @@ static void buffer_cb(struct vchiq_mmal_instance *instance,
+ return;
+ } else if (length == 0) {
+ /* stream ended */
+- if (buf) {
+- /* this should only ever happen if the port is
+- * disabled and there are buffers still queued
++ if (dev->capture.frame_count) {
++ /* empty buffer whilst capturing - expected to be an
++ * EOS, so grab another frame
+ */
+- vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
+- pr_debug("Empty buffer");
+- } else if (dev->capture.frame_count) {
+- /* grab another frame */
+ if (is_capturing(dev)) {
+- pr_debug("Grab another frame");
++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
++ "Grab another frame");
+ vchiq_mmal_port_parameter_set(
+ instance,
+ dev->capture.camera_port,
+@@ -353,8 +350,14 @@ static void buffer_cb(struct vchiq_mmal_instance *instance,
+ &dev->capture.frame_count,
+ sizeof(dev->capture.frame_count));
+ }
++ if (vchiq_mmal_submit_buffer(instance, port, buf))
++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
++ "Failed to return EOS buffer");
+ } else {
+- /* signal frame completion */
++ /* stopping streaming.
++ * return buffer, and signal frame completion
++ */
++ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
+ complete(&dev->capture.frame_cmplt);
+ }
+ } else {
+diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
+index 0f7de34eb5db..29761f6c3b55 100644
+--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
++++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
+@@ -290,8 +290,6 @@ static int bulk_receive(struct vchiq_mmal_instance *instance,
+
+ /* store length */
+ msg_context->u.bulk.buffer_used = rd_len;
+- msg_context->u.bulk.mmal_flags =
+- msg->u.buffer_from_host.buffer_header.flags;
+ msg_context->u.bulk.dts = msg->u.buffer_from_host.buffer_header.dts;
+ msg_context->u.bulk.pts = msg->u.buffer_from_host.buffer_header.pts;
+
+@@ -452,6 +450,9 @@ static void buffer_to_host_cb(struct vchiq_mmal_instance *instance,
+ return;
+ }
+
++ msg_context->u.bulk.mmal_flags =
++ msg->u.buffer_from_host.buffer_header.flags;
++
+ if (msg->h.status != MMAL_MSG_STATUS_SUCCESS) {
+ /* message reception had an error */
+ pr_warn("error %d in reply\n", msg->h.status);
+--
+2.22.0
+
diff --git a/series.conf b/series.conf
index 09af4b7e7d..105a5822f3 100644
--- a/series.conf
+++ b/series.conf
@@ -85,6 +85,7 @@
patches.kernel.org/5.2.1-056-staging-bcm2835-camera-Replace-spinlock-protect.patch
patches.kernel.org/5.2.1-057-staging-bcm2835-camera-Ensure-all-buffers-are-r.patch
patches.kernel.org/5.2.1-058-staging-bcm2835-camera-Remove-check-of-the-numb.patch
+ patches.kernel.org/5.2.1-059-staging-bcm2835-camera-Handle-empty-EOS-buffers.patch
########################################################
# Build fixes that apply to the vanilla kernel too.