]> git.baikalelectronics.ru Git - kernel.git/commitdiff
media: amphion: ensure the buffer count is not less than min_buffer
authorMing Qian <ming.qian@nxp.com>
Tue, 22 Mar 2022 08:28:59 +0000 (09:28 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Fri, 13 May 2022 09:02:20 +0000 (11:02 +0200)
the output buffer count should >= min_buffer_out
the capture buffer count should >= min_buffer_cap

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/platform/amphion/vpu_v4l2.c

index 801bd08749d9d9ab4a6228c6cabed40d9444148f..34ab941460df5319de293e240d517dbf20bfd98e 100644 (file)
@@ -398,6 +398,10 @@ static int vpu_vb2_queue_setup(struct vb2_queue *vq,
                return 0;
        }
 
+       if (V4L2_TYPE_IS_OUTPUT(vq->type))
+               *buf_count = max_t(unsigned int, *buf_count, inst->min_buffer_out);
+       else
+               *buf_count = max_t(unsigned int, *buf_count, inst->min_buffer_cap);
        *plane_count = cur_fmt->num_planes;
        for (i = 0; i < cur_fmt->num_planes; i++)
                psize[i] = cur_fmt->sizeimage[i];