From: Benjamin Gaignard <benjamin.gaignard@collabora.com>
To: mchehab@kernel.org, tfiga@chromium.org, m.szyprowski@samsung.com,
ming.qian@nxp.com, ezequiel@vanguardiasur.com.ar,
p.zabel@pengutronix.de, gregkh@linuxfoundation.org,
hverkuil-cisco@xs4all.nl, nicolas.dufresne@collabora.com
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org,
linux-arm-msm@vger.kernel.org,
linux-rockchip@lists.infradead.org,
linux-staging@lists.linux.dev, kernel@collabora.com,
Benjamin Gaignard <benjamin.gaignard@collabora.com>
Subject: [PATCH v7 00/49] Add DELETE_BUF ioctl
Date: Thu, 14 Sep 2023 15:32:34 +0200 [thread overview]
Message-ID: <20230914133323.198857-1-benjamin.gaignard@collabora.com> (raw)
Unlike when resolution change on keyframes, dynamic resolution change
on inter frames doesn't allow to do a stream off/on sequence because
it is need to keep all previous references alive to decode inter frames.
This constraint have two main problems:
- more memory consumption.
- more buffers in use.
To solve these issue this series introduce DELETE_BUFS ioctl and remove
the 32 buffers limit per queue.
VP9 conformance tests using fluster give a score of 210/305.
The 24 resize inter tests (vp90-2-21-resize_inter_* files) are ok
but require to use postprocessor.
Kernel branch is available here:
https://gitlab.collabora.com/benjamin.gaignard/for-upstream/-/commits/remove_vb2_queue_limit_v7
GStreamer branch to use DELETE_BUF ioctl and testing dynamic resolution
change is here:
https://gitlab.freedesktop.org/benjamin.gaignard1/gstreamer/-/commits/VP9_drc
changes in version 7:
- Use a bitmap to know which entries are valid in queue bufs array.
The number of buffers in the queue could must calculated from the
bitmap so num_buffers becomes useless. This led to add quite few
patches to remove it from all the drivers.
Note: despiste my attention I may have miss some calls to
num_buffers...
- Split patches to make them more readable.
- Run v4l2-compliance with additional delete-bufs tests.
- Run ./test-media -kmemleak vivid and no more failures.
Note: I had to remove USERPTR streaming test because they to much
frequentely hit get_framevec bug. It is not related to my series
since this happens all the time on master branch.
- Fix Hans remarks on v6
changes in version 6:
- Get a patch per driver to use vb2_get_buffer() instead of directly access
to queue buffers array.
- Add lock in vb2_core_delete_buf()
- Use vb2_buffer instead of index
- Fix various comments
- Change buffer index name to BUFFER_INDEX_MASK
- Stop spamming kernel log with unbalanced counters
changes in version 5:
- Rework offset cookie encoding pattern is n ow the first patch of the
serie.
- Use static array instead of allocated one for postprocessor buffers.
changes in version 4:
- Stop using Xarray, instead let queues decide about their own maximum
number of buffer and allocate bufs array given that value.
- Rework offset cookie encoding pattern.
- Change DELETE_BUF to DELETE_BUFS because it now usable for
range of buffer to be symetrical of CREATE_BUFS.
- Add fixes tags on couple of Verisilicon related patches.
- Be smarter in Verisilicon postprocessor buffers management.
- Rebase on top of v6.4
changes in version 3:
- Use Xarray API to store allocated video buffers.
- No module parameter to limit the number of buffer per queue.
- Use Xarray inside Verisilicon driver to store postprocessor buffers
and remove VB2_MAX_FRAME limit.
- Allow Versilicon driver to change of resolution while streaming
- Various fixes the Verisilicon VP9 code to improve fluster score.
changes in version 2:
- Use a dynamic array and not a list to keep trace of allocated buffers.
Not use IDR interface because it is marked as deprecated in kernel
documentation.
- Add a module parameter to limit the number of buffer per queue.
- Add DELETE_BUF ioctl and m2m helpers.
Regards,
Benjamin
Benjamin Gaignard (49):
media: videobuf2: Rework offset 'cookie' encoding pattern
media: videobuf2: Stop spamming kernel log with all queue counter
media: videobuf2: Use vb2_buffer instead of index
media: amphion: Use vb2_get_buffer() instead of directly access to
buffers array
media: mediatek: jpeg: Use vb2_get_buffer() instead of directly access
to buffers array
media: mediatek: vdec: Use vb2_get_buffer() instead of directly access
to buffers array
media: sti: hva: Use vb2_get_buffer() instead of directly access to
buffers array
media: visl: Use vb2_get_buffer() instead of directly access to
buffers array
media: atomisp: Use vb2_get_buffer() instead of directly access to
buffers array
media: dvb-core: Use vb2_get_buffer() instead of directly access to
buffers array
media: videobuf2: Access vb2_queue bufs array through helper functions
media: videobuf2: Be more flexible on the number of queue stored
buffers
media: verisilicon: Refactor postprocessor to store more buffers
media: verisilicon: Store chroma and motion vectors offset
media: verisilicon: g2: Use common helpers to compute chroma and mv
offsets
media: verisilicon: postproc: Fix down scale test
media: verisilicon: vp9: Allow to change resolution while streaming
media: Remove duplicated index vs q->num_buffers check
media: core: Add helper to get queue number of buffers
media: core: Rework how create_buf index returned value is computed
media: dvb: Stop direct calls to queue num_buffers field
media: i2c: Stop direct calls to queue num_buffers field
media: pci: cx18: Stop direct calls to queue num_buffers field
media: pci: dt3155: Stop direct calls to queue num_buffers field
media: pci: netup_unidvb: Stop direct calls to queue num_buffers field
media: pci: tw68: Stop direct calls to queue num_buffers field
media: pci: tw686x: Stop direct calls to queue num_buffers field
media: amphion: Stop direct calls to queue num_buffers field
media: coda: Stop direct calls to queue num_buffers field
media: mediatek: vcodec: Stop direct calls to queue num_buffers field
media: nxp: Stop direct calls to queue num_buffers field
media: renesas: Stop direct calls to queue num_buffers field
media: sti: hva: Stop direct calls to queue num_buffers field
media: ti: Stop direct calls to queue num_buffers field
media: verisilicon: Stop direct calls to queue num_buffers field
media: test-drivers: Stop direct calls to queue num_buffers field
media: usb: airspy: Stop direct calls to queue num_buffers field
media: usb: cx231xx: Stop direct calls to queue num_buffers field
media: usb: hackrf: Stop direct calls to queue num_buffers field
media: usb: usbtv: Stop direct calls to queue num_buffers field
media: atomisp: Stop direct calls to queue num_buffers field
media: imx: Stop direct calls to queue num_buffers field
media: meson: vdec: Stop direct calls to queue num_buffers field
media: cedrus: Stop direct calls to queue num_buffers field
media: core: Add bitmap manage bufs array entries
media: core: Free range of buffers
media: v4l2: Add DELETE_BUFS ioctl
media: v4l2: Add mem2mem helpers for DELETE_BUFS ioctl
media: test-drivers: Use helper for DELETE_BUFS ioctl
.../userspace-api/media/v4l/user-func.rst | 1 +
.../media/v4l/vidioc-delete-bufs.rst | 77 +++
.../media/common/videobuf2/videobuf2-core.c | 583 ++++++++++++------
.../media/common/videobuf2/videobuf2-v4l2.c | 107 +++-
drivers/media/dvb-core/dvb_vb2.c | 17 +-
drivers/media/dvb-frontends/rtl2832_sdr.c | 5 +-
drivers/media/i2c/video-i2c.c | 2 +-
drivers/media/pci/cx18/cx18-streams.c | 5 +-
drivers/media/pci/dt3155/dt3155.c | 5 +-
.../pci/netup_unidvb/netup_unidvb_core.c | 5 +-
drivers/media/pci/tw68/tw68-video.c | 4 +-
drivers/media/pci/tw686x/tw686x-video.c | 5 +-
drivers/media/platform/amphion/vpu_dbg.c | 30 +-
drivers/media/platform/amphion/vpu_v4l2.c | 4 +-
.../media/platform/chips-media/coda-common.c | 2 +-
.../platform/mediatek/jpeg/mtk_jpeg_core.c | 7 +-
.../vcodec/decoder/vdec/vdec_vp9_req_lat_if.c | 4 +-
.../mediatek/vcodec/encoder/mtk_vcodec_enc.c | 2 +-
drivers/media/platform/nxp/imx7-media-csi.c | 7 +-
drivers/media/platform/renesas/rcar_drif.c | 5 +-
drivers/media/platform/st/sti/hva/hva-v4l2.c | 9 +-
.../media/platform/ti/am437x/am437x-vpfe.c | 5 +-
drivers/media/platform/ti/cal/cal-video.c | 5 +-
.../media/platform/ti/davinci/vpif_capture.c | 5 +-
.../media/platform/ti/davinci/vpif_display.c | 5 +-
drivers/media/platform/ti/omap/omap_vout.c | 5 +-
drivers/media/platform/verisilicon/hantro.h | 9 +-
.../media/platform/verisilicon/hantro_drv.c | 4 +-
.../media/platform/verisilicon/hantro_g2.c | 14 +
.../platform/verisilicon/hantro_g2_hevc_dec.c | 18 +-
.../platform/verisilicon/hantro_g2_vp9_dec.c | 28 +-
.../media/platform/verisilicon/hantro_hw.h | 7 +-
.../platform/verisilicon/hantro_postproc.c | 95 ++-
.../media/platform/verisilicon/hantro_v4l2.c | 27 +-
.../media/test-drivers/vicodec/vicodec-core.c | 1 +
drivers/media/test-drivers/vim2m.c | 1 +
.../media/test-drivers/vimc/vimc-capture.c | 1 +
drivers/media/test-drivers/visl/visl-dec.c | 32 +-
drivers/media/test-drivers/visl/visl-video.c | 1 +
drivers/media/test-drivers/vivid/vivid-core.c | 1 +
.../media/test-drivers/vivid/vivid-meta-cap.c | 5 +-
.../media/test-drivers/vivid/vivid-meta-out.c | 5 +-
.../test-drivers/vivid/vivid-touch-cap.c | 5 +-
.../media/test-drivers/vivid/vivid-vbi-cap.c | 5 +-
.../media/test-drivers/vivid/vivid-vbi-out.c | 5 +-
.../media/test-drivers/vivid/vivid-vid-cap.c | 5 +-
.../media/test-drivers/vivid/vivid-vid-out.c | 5 +-
drivers/media/usb/airspy/airspy.c | 5 +-
drivers/media/usb/cx231xx/cx231xx-417.c | 5 +-
drivers/media/usb/cx231xx/cx231xx-video.c | 5 +-
drivers/media/usb/hackrf/hackrf.c | 5 +-
drivers/media/usb/usbtv/usbtv-video.c | 5 +-
drivers/media/v4l2-core/v4l2-dev.c | 1 +
drivers/media/v4l2-core/v4l2-ioctl.c | 17 +
drivers/media/v4l2-core/v4l2-mem2mem.c | 20 +
.../staging/media/atomisp/pci/atomisp_ioctl.c | 4 +-
drivers/staging/media/imx/imx-media-capture.c | 7 +-
drivers/staging/media/meson/vdec/vdec.c | 13 +-
.../staging/media/sunxi/cedrus/cedrus_h264.c | 4 +-
.../staging/media/sunxi/cedrus/cedrus_h265.c | 4 +-
include/media/v4l2-ioctl.h | 4 +
include/media/v4l2-mem2mem.h | 12 +
include/media/videobuf2-core.h | 57 +-
include/media/videobuf2-v4l2.h | 13 +
include/uapi/linux/videodev2.h | 16 +
65 files changed, 955 insertions(+), 427 deletions(-)
create mode 100644 Documentation/userspace-api/media/v4l/vidioc-delete-bufs.rst
--
2.39.2
next reply other threads:[~2023-09-14 13:34 UTC|newest]
Thread overview: 98+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-14 13:32 Benjamin Gaignard [this message]
2023-09-14 13:32 ` [PATCH v7 01/49] media: videobuf2: Rework offset 'cookie' encoding pattern Benjamin Gaignard
2023-09-19 9:15 ` Hans Verkuil
2023-09-14 13:32 ` [PATCH v7 02/49] media: videobuf2: Stop spamming kernel log with all queue counter Benjamin Gaignard
2023-09-19 9:22 ` Hans Verkuil
2023-09-14 13:32 ` [PATCH v7 03/49] media: videobuf2: Use vb2_buffer instead of index Benjamin Gaignard
2023-09-14 13:32 ` [PATCH v7 04/49] media: amphion: Use vb2_get_buffer() instead of directly access to buffers array Benjamin Gaignard
2023-09-14 13:32 ` [PATCH v7 05/49] media: mediatek: jpeg: " Benjamin Gaignard
2023-09-14 13:32 ` [PATCH v7 06/49] media: mediatek: vdec: " Benjamin Gaignard
2023-09-19 9:37 ` Hans Verkuil
2023-09-14 13:32 ` [PATCH v7 07/49] media: sti: hva: " Benjamin Gaignard
2023-09-19 9:31 ` Hans Verkuil
2023-09-19 10:26 ` Benjamin Gaignard
2023-09-19 11:20 ` Hans Verkuil
2023-09-14 13:32 ` [PATCH v7 08/49] media: visl: " Benjamin Gaignard
2023-09-14 13:32 ` [PATCH v7 09/49] media: atomisp: " Benjamin Gaignard
2023-09-19 9:41 ` Hans Verkuil
2023-09-14 13:32 ` [PATCH v7 10/49] media: dvb-core: " Benjamin Gaignard
2023-09-14 13:32 ` [PATCH v7 11/49] media: videobuf2: Access vb2_queue bufs array through helper functions Benjamin Gaignard
2023-09-19 10:33 ` Hans Verkuil
2023-09-14 13:32 ` [PATCH v7 12/49] media: videobuf2: Be more flexible on the number of queue stored buffers Benjamin Gaignard
2023-09-19 10:55 ` Hans Verkuil
2023-09-19 12:42 ` Hans Verkuil
2023-09-20 8:56 ` Hans Verkuil
2023-09-14 13:32 ` [PATCH v7 13/49] media: verisilicon: Refactor postprocessor to store more buffers Benjamin Gaignard
2023-09-19 10:57 ` Hans Verkuil
2023-09-14 13:32 ` [PATCH v7 14/49] media: verisilicon: Store chroma and motion vectors offset Benjamin Gaignard
2023-09-14 13:32 ` [PATCH v7 15/49] media: verisilicon: g2: Use common helpers to compute chroma and mv offsets Benjamin Gaignard
2023-09-14 13:32 ` [PATCH v7 16/49] media: verisilicon: postproc: Fix down scale test Benjamin Gaignard
2023-09-19 11:16 ` Hans Verkuil
2023-09-20 7:44 ` Benjamin Gaignard
2023-09-14 13:32 ` [PATCH v7 17/49] media: verisilicon: vp9: Allow to change resolution while streaming Benjamin Gaignard
2023-09-14 13:32 ` [PATCH v7 18/49] media: Remove duplicated index vs q->num_buffers check Benjamin Gaignard
2023-09-19 12:21 ` Hans Verkuil
2023-09-14 13:32 ` [PATCH v7 19/49] media: core: Add helper to get queue number of buffers Benjamin Gaignard
2023-09-14 13:32 ` [PATCH v7 20/49] media: core: Rework how create_buf index returned value is computed Benjamin Gaignard
2023-09-19 12:34 ` Hans Verkuil
2023-09-19 14:50 ` Hans Verkuil
2023-09-14 13:32 ` [PATCH v7 21/49] media: dvb: Stop direct calls to queue num_buffers field Benjamin Gaignard
2023-09-19 13:40 ` Hans Verkuil
2023-09-14 13:32 ` [PATCH v7 22/49] media: i2c: " Benjamin Gaignard
2023-09-19 9:27 ` Hans Verkuil
2023-09-19 13:42 ` Hans Verkuil
2023-09-14 13:32 ` [PATCH v7 23/49] media: pci: cx18: " Benjamin Gaignard
2023-09-19 13:42 ` Hans Verkuil
2023-09-14 13:32 ` [PATCH v7 24/49] media: pci: dt3155: " Benjamin Gaignard
2023-09-19 13:43 ` Hans Verkuil
2023-09-14 13:32 ` [PATCH v7 25/49] media: pci: netup_unidvb: " Benjamin Gaignard
2023-09-19 13:52 ` Hans Verkuil
2023-09-14 13:33 ` [PATCH v7 26/49] media: pci: tw68: " Benjamin Gaignard
2023-09-19 13:56 ` Hans Verkuil
2023-09-14 13:33 ` [PATCH v7 27/49] media: pci: tw686x: " Benjamin Gaignard
2023-09-19 13:57 ` Hans Verkuil
2023-09-14 13:33 ` [PATCH v7 28/49] media: amphion: " Benjamin Gaignard
2023-09-14 13:33 ` [PATCH v7 29/49] media: coda: " Benjamin Gaignard
2023-09-14 13:33 ` [PATCH v7 30/49] media: mediatek: vcodec: " Benjamin Gaignard
2023-09-14 13:33 ` [PATCH v7 31/49] media: nxp: " Benjamin Gaignard
2023-09-14 13:33 ` [PATCH v7 32/49] media: renesas: " Benjamin Gaignard
2023-09-19 14:05 ` Hans Verkuil
2023-09-14 13:33 ` [PATCH v7 33/49] media: sti: hva: " Benjamin Gaignard
2023-09-14 13:33 ` [PATCH v7 34/49] media: ti: " Benjamin Gaignard
2023-09-19 14:10 ` Hans Verkuil
2023-09-14 13:33 ` [PATCH v7 35/49] media: verisilicon: " Benjamin Gaignard
2023-09-14 13:33 ` [PATCH v7 36/49] media: test-drivers: " Benjamin Gaignard
2023-09-19 14:15 ` Hans Verkuil
2023-09-14 13:33 ` [PATCH v7 37/49] media: usb: airspy: " Benjamin Gaignard
2023-09-19 14:16 ` Hans Verkuil
2023-09-14 13:33 ` [PATCH v7 38/49] media: usb: cx231xx: " Benjamin Gaignard
2023-09-19 14:19 ` Hans Verkuil
2023-09-14 13:33 ` [PATCH v7 39/49] media: usb: hackrf: " Benjamin Gaignard
2023-09-19 14:20 ` Hans Verkuil
2023-09-14 13:33 ` [PATCH v7 40/49] media: usb: usbtv: " Benjamin Gaignard
2023-09-19 14:21 ` Hans Verkuil
2023-09-14 13:33 ` [PATCH v7 41/49] media: atomisp: " Benjamin Gaignard
2023-09-14 13:33 ` [PATCH v7 42/49] media: imx: " Benjamin Gaignard
2023-09-14 13:33 ` [PATCH v7 43/49] media: meson: vdec: " Benjamin Gaignard
2023-09-14 13:33 ` [PATCH v7 44/49] media: cedrus: " Benjamin Gaignard
2023-09-19 14:26 ` Hans Verkuil
2023-09-14 13:33 ` [PATCH v7 45/49] media: core: Add bitmap manage bufs array entries Benjamin Gaignard
2023-09-15 0:47 ` kernel test robot
2023-09-15 13:02 ` Benjamin Gaignard
2023-09-19 15:00 ` Hans Verkuil
2023-09-20 14:30 ` Benjamin Gaignard
2023-09-20 14:56 ` Hans Verkuil
2023-09-20 15:17 ` Benjamin Gaignard
2023-09-21 9:28 ` Benjamin Gaignard
2023-09-21 10:24 ` Hans Verkuil
2023-09-21 12:05 ` Benjamin Gaignard
2023-09-21 12:13 ` Hans Verkuil
2023-09-21 12:46 ` Benjamin Gaignard
2023-09-21 13:07 ` Benjamin Gaignard
2023-09-21 13:48 ` Hans Verkuil
2023-09-14 13:33 ` [PATCH v7 46/49] media: core: Free range of buffers Benjamin Gaignard
2023-09-19 15:09 ` Hans Verkuil
2023-09-14 13:33 ` [PATCH v7 47/49] media: v4l2: Add DELETE_BUFS ioctl Benjamin Gaignard
2023-09-19 15:14 ` Hans Verkuil
2023-09-14 13:33 ` [PATCH v7 48/49] media: v4l2: Add mem2mem helpers for " Benjamin Gaignard
2023-09-14 13:33 ` [PATCH v7 49/49] media: test-drivers: Use helper " Benjamin Gaignard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230914133323.198857-1-benjamin.gaignard@collabora.com \
--to=benjamin.gaignard@collabora.com \
--cc=ezequiel@vanguardiasur.com.ar \
--cc=gregkh@linuxfoundation.org \
--cc=hverkuil-cisco@xs4all.nl \
--cc=kernel@collabora.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-staging@lists.linux.dev \
--cc=m.szyprowski@samsung.com \
--cc=mchehab@kernel.org \
--cc=ming.qian@nxp.com \
--cc=nicolas.dufresne@collabora.com \
--cc=p.zabel@pengutronix.de \
--cc=tfiga@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox