]> git.ipfire.org Git - thirdparty/linux.git/commit
media: v4l2-mem2mem: Don't copy frame flags in v4l2_m2m_buf_copy_metadata()
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Wed, 15 Oct 2025 10:01:16 +0000 (13:01 +0300)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Fri, 17 Oct 2025 09:31:16 +0000 (11:31 +0200)
commit1fdb55ed40fa5ebe6934bd6b93036c714ebb5ef8
tree6bb2f2ce0925497488189466937cefbeae053390
parentd5ddab0cf001fb2ac56fb03d1393077287b9cc03
media: v4l2-mem2mem: Don't copy frame flags in v4l2_m2m_buf_copy_metadata()

The v4l2_m2m_buf_copy_metadata() function takes a boolean
copy_frame_flags argument. When true, it causes the function to copy the
V4L2_BUF_FLAG_KEYFRAME, V4L2_BUF_FLAG_BFRAME and V4L2_BUF_FLAG_PFRAME
flags from the output buffer to the capture buffer.

There is no use cases in any upstream driver for copying the flags.
KEY/P/B frames are properties of the bitstream buffer in some formats.
Once decoded, this is no longer a property of the video frame and should
be discarded.

It was considered useful to know if an uncompressed frame was decoded
from a KEY/P/B compressed frame, and to preserve that information if
that same uncompressed frame was passed through another M2M device (e.g.
a scaler). However, the V4L2 documentation makes it clear that the flags
are meant for compressed frames only.

Drop the copy_frame_flags argument from v4l2_m2m_buf_copy_metadata().
The change to drivers was performed with the following Coccinelle
semantic patch:

@@
expression src;
expression dst;
expression flag;
@@
-       v4l2_m2m_buf_copy_metadata(src, dst, flag);
+       v4l2_m2m_buf_copy_metadata(src, dst);

include/media/v4l2-mem2mem.h and drivers/media/v4l2-core/v4l2-mem2mem.c
have been updated manually.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
33 files changed:
drivers/media/platform/allegro-dvt/allegro-core.c
drivers/media/platform/amphion/vdec.c
drivers/media/platform/amphion/venc.c
drivers/media/platform/chips-media/coda/coda-bit.c
drivers/media/platform/chips-media/coda/coda-jpeg.c
drivers/media/platform/imagination/e5010-jpeg-enc.c
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
drivers/media/platform/mediatek/jpeg/mtk_jpeg_dec_hw.c
drivers/media/platform/mediatek/jpeg/mtk_jpeg_enc_hw.c
drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c
drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_req_lat_if.c
drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_if.c
drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c
drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_hevc_req_multi_if.c
drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_req_if.c
drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c
drivers/media/platform/nvidia/tegra-vde/h264.c
drivers/media/platform/nxp/dw100/dw100.c
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c
drivers/media/platform/rockchip/rga/rga.c
drivers/media/platform/rockchip/rkvdec/rkvdec.c
drivers/media/platform/st/stm32/dma2d/dma2d.c
drivers/media/platform/sunxi/sun8i-di/sun8i-di.c
drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c
drivers/media/platform/verisilicon/hantro_drv.c
drivers/media/test-drivers/vicodec/vicodec-core.c
drivers/media/test-drivers/vim2m.c
drivers/media/test-drivers/visl/visl-dec.c
drivers/media/v4l2-core/v4l2-mem2mem.c
drivers/staging/media/imx/imx-media-csc-scaler.c
drivers/staging/media/sunxi/cedrus/cedrus_dec.c
include/media/v4l2-mem2mem.h