kernel_optimize_test/drivers/media/v4l2-core
Chen-Yu Tsai 8a83731a09 media: v4l2-mem2mem: Apply DST_QUEUE_OFF_BASE on MMAP buffers across ioctls
[ Upstream commit 8310ca94075e784bbb06593cd6c068ee6b6e4ca6 ]

DST_QUEUE_OFF_BASE is applied to offset/mem_offset on MMAP capture buffers
only for the VIDIOC_QUERYBUF ioctl, while the userspace fields (including
offset/mem_offset) are filled in for VIDIOC_{QUERY,PREPARE,Q,DQ}BUF
ioctls. This leads to differences in the values presented to userspace.
If userspace attempts to mmap the capture buffer directly using values
from DQBUF, it will fail.

Move the code that applies the magic offset into a helper, and call
that helper from all four ioctl entry points.

[hverkuil: drop unnecessary '= 0' in v4l2_m2m_querybuf() for ret]

Fixes: 7f98639def ("V4L/DVB: add memory-to-memory device helper framework for videobuf")
Fixes: 908a0d7c58 ("[media] v4l: mem2mem: port to videobuf2")
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-08 14:40:05 +02:00
..
Kconfig
Makefile
tuner-core.c
v4l2-async.c media: v4l2-async: Clean v4l2_async_notifier_add_fwnode_remote_subdev 2021-07-14 16:56:11 +02:00
v4l2-clk.c
v4l2-common.c
v4l2-compat-ioctl32.c
v4l2-ctrls.c
v4l2-dev.c
v4l2-device.c
v4l2-dv-timings.c media: v4l2-dv-timings.c: fix wrong condition in two for-loops 2021-09-18 13:40:24 +02:00
v4l2-event.c
v4l2-fh.c
v4l2-flash-led-class.c
v4l2-fwnode.c
v4l2-h264.c
v4l2-i2c.c
v4l2-ioctl.c media: v4l2-ioctl.c: readbuffers depends on V4L2_CAP_READWRITE 2022-01-27 10:53:42 +01:00
v4l2-jpeg.c
v4l2-mc.c
v4l2-mem2mem.c media: v4l2-mem2mem: Apply DST_QUEUE_OFF_BASE on MMAP buffers across ioctls 2022-04-08 14:40:05 +02:00
v4l2-spi.c
v4l2-subdev.c
v4l2-trace.c
videobuf-core.c
videobuf-dma-contig.c
videobuf-dma-sg.c
videobuf-vmalloc.c