media: s5p-mfc: set src_bufs_cnt with requested buffer for DMABUF and USERPTR
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Sat, 31 Oct 2015 08:24:54 +0000 (17:24 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 14 Dec 2016 04:48:22 +0000 (13:48 +0900)
During start_streaming of output, it checks src_bufs_cnt compared
with pb_count. But it is only meaningful for MMAP memory. So this
patch fixes to set src_bufs_cnt with requested buffer for non MMAP
memory.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
drivers/media/platform/s5p-mfc/s5p_mfc_enc.c

index 1d1c5ea..8b4d1a8 100644 (file)
@@ -1200,6 +1200,8 @@ static int vidioc_reqbufs(struct file *file, void *priv,
                        mfc_err("error in vb2_reqbufs() for E(S)\n");
                        return ret;
                }
+               if (reqbufs->memory != V4L2_MEMORY_MMAP)
+                       ctx->src_bufs_cnt = reqbufs->count;
                ctx->output_state = QUEUE_BUFS_REQUESTED;
        } else {
                mfc_err("invalid buf type\n");
@@ -1892,7 +1894,8 @@ static int s5p_mfc_buf_init(struct vb2_buffer *vb)
                                        vb2_dma_contig_plane_dma_addr(vb, 0);
                ctx->src_bufs[i].cookie.raw.chroma =
                                        vb2_dma_contig_plane_dma_addr(vb, 1);
-               ctx->src_bufs_cnt++;
+               if (vb->v4l2_buf.memory == V4L2_MEMORY_MMAP)
+                       ctx->src_bufs_cnt++;
        } else {
                mfc_err("invalid queue type: %d\n", vq->type);
                return -EINVAL;