]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[media] s5p-mfc: use MFC_BUF_FLAG_EOS to identify last buffers in decoder capture...
authorAndrzej Hajda <a.hajda@samsung.com>
Wed, 7 Oct 2015 10:13:45 +0000 (07:13 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 20 Oct 2015 16:40:16 +0000 (14:40 -0200)
MFC driver never delivered EOS event to apps feeding constantly its capture
buffer with fresh buffers. The patch fixes it by marking last buffers
returned by MFC with MFC_BUF_FLAG_EOS flag and firing EOS event on
de-queuing such buffers.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/platform/s5p-mfc/s5p_mfc.c
drivers/media/platform/s5p-mfc/s5p_mfc_dec.c

index 05a31ee0789d30cc3f86d9721b3bdba9702f1963..3ffe2ecfd5efe37649750c64636c91c042f57a47 100644 (file)
@@ -196,6 +196,7 @@ static void s5p_mfc_handle_frame_all_extracted(struct s5p_mfc_ctx *ctx)
                vb2_set_plane_payload(&dst_buf->b->vb2_buf, 0, 0);
                vb2_set_plane_payload(&dst_buf->b->vb2_buf, 1, 0);
                list_del(&dst_buf->list);
+               dst_buf->flags |= MFC_BUF_FLAG_EOS;
                ctx->dst_queue_cnt--;
                dst_buf->b->sequence = (ctx->sequence++);
 
index 1734775a63e64c9c82b1531f9b9653428f8063f8..8d3d40cc93265db1f78afe3b96c2e6ff6cde5942 100644 (file)
@@ -645,17 +645,22 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
                mfc_err("Call on DQBUF after unrecoverable error\n");
                return -EIO;
        }
-       if (buf->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
-               ret = vb2_dqbuf(&ctx->vq_src, buf, file->f_flags & O_NONBLOCK);
-       else if (buf->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
+
+       switch (buf->type) {
+       case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
+               return vb2_dqbuf(&ctx->vq_src, buf, file->f_flags & O_NONBLOCK);
+       case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
                ret = vb2_dqbuf(&ctx->vq_dst, buf, file->f_flags & O_NONBLOCK);
-               if (ret == 0 && ctx->state == MFCINST_FINISHED &&
-                               list_empty(&ctx->vq_dst.done_list))
+               if (ret)
+                       return ret;
+
+               if (ctx->state == MFCINST_FINISHED &&
+                   (ctx->dst_bufs[buf->index].flags & MFC_BUF_FLAG_EOS))
                        v4l2_event_queue_fh(&ctx->fh, &ev);
-       } else {
-               ret = -EINVAL;
+               return 0;
+       default:
+               return -EINVAL;
        }
-       return ret;
 }
 
 /* Export DMA buffer */