staging: vc04_services: codec: Fix incorrect buffer cleanup 07/249307/1
authorDave Stevenson <dave.stevenson@raspberrypi.com>
Thu, 13 Aug 2020 15:58:18 +0000 (16:58 +0100)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Thu, 10 Dec 2020 04:12:32 +0000 (13:12 +0900)
The allocated input and output buffers are initialised in
buf_init and should only be cleared up in buf_cleanup.
stop_streaming was (incorrectly) cleaning up the buffers to
avoid an issue in videobuf2 that had been fixed by the orphaned
buffer support.

Remove the erroneous cleanup.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
[sw0312.kim: cherry-pick rpi-5.4.y commit to fix video decoding seek issue]
Ref: https://github.com/raspberrypi/linux/pull/3790
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I38e3a257a941753b02e448d6d5dd1c8486b648f1

drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c

index 3fe8197..b6c5a66 100644 (file)
@@ -2320,10 +2320,7 @@ static void bcm2835_codec_stop_streaming(struct vb2_queue *q)
        struct bcm2835_codec_q_data *q_data = get_q_data(ctx, q->type);
        struct vchiq_mmal_port *port = get_port_data(ctx, q->type);
        struct vb2_v4l2_buffer *vbuf;
-       struct vb2_v4l2_buffer *vb2;
-       struct v4l2_m2m_buffer *m2m;
-       struct m2m_mmal_buffer *buf;
-       int ret, i;
+       int ret;
 
        v4l2_dbg(1, debug, &ctx->dev->v4l2_dev, "%s: type: %d - return buffers\n",
                 __func__, q->type);
@@ -2363,18 +2360,6 @@ static void bcm2835_codec_stop_streaming(struct vb2_queue *q)
                }
        }
 
-       /*
-        * Release the VCSM handle here as otherwise REQBUFS(0) aborts because
-        * someone is using the dmabuf before giving the driver a chance to do
-        * anything about it.
-        */
-       for (i = 0; i < q->num_buffers; i++) {
-               vb2 = to_vb2_v4l2_buffer(q->bufs[i]);
-               m2m = container_of(vb2, struct v4l2_m2m_buffer, vb);
-               buf = container_of(m2m, struct m2m_mmal_buffer, m2m);
-
-               bcm2835_codec_mmal_buf_cleanup(&buf->mmal);
-       }
 
        /* If both ports disabled, then disable the component */
        if (!ctx->component->input[0].enabled &&