media: test-drivers: vivid: Increase max supported buffers for capture queues
authorBenjamin Gaignard <benjamin.gaignard@collabora.com>
Thu, 9 Nov 2023 16:35:01 +0000 (17:35 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Thu, 23 Nov 2023 11:41:51 +0000 (12:41 +0100)
Change the maximum number of buffers of some capture queues in order
to test max_num_buffers field.

Allow to allocate up to:
- 64 buffers for video capture queue.
- 1024 buffers for sdr capture queue.
- 32768 buffers for vbi capture queue.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/test-drivers/vivid/vivid-core.c

index 394c9f81ea727db2cb399b81011916efb08f0905..353f035fcd1930eff3b10b7fdb2c3334d4829061 100644 (file)
@@ -876,6 +876,20 @@ static int vivid_create_queue(struct vivid_dev *dev,
        q->type = buf_type;
        q->io_modes = VB2_MMAP | VB2_DMABUF;
        q->io_modes |= V4L2_TYPE_IS_OUTPUT(buf_type) ?  VB2_WRITE : VB2_READ;
+
+       /*
+        * The maximum number of buffers is 32768 if PAGE_SHIFT == 12,
+        * see also MAX_BUFFER_INDEX in videobuf2-core.c. It will be less if
+        * PAGE_SHIFT > 12, but then max_num_buffers will be clamped by
+        * videobuf2-core.c to MAX_BUFFER_INDEX.
+        */
+       if (buf_type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
+               q->max_num_buffers = 64;
+       if (buf_type == V4L2_BUF_TYPE_SDR_CAPTURE)
+               q->max_num_buffers = 1024;
+       if (buf_type == V4L2_BUF_TYPE_VBI_CAPTURE)
+               q->max_num_buffers = 32768;
+
        if (allocators[dev->inst] != 1)
                q->io_modes |= VB2_USERPTR;
        q->drv_priv = dev;