media: videobuf2-core: attach once if multiple planes share the same dbuf
authorYunke Cao <yunkec@chromium.org>
Wed, 14 Aug 2024 02:06:43 +0000 (11:06 +0900)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Wed, 14 Aug 2024 08:05:32 +0000 (10:05 +0200)
commit03a979b74dc1ad5aeed8026a84d8771842cb1631
tree2b0b11358f539afb70f3f255c4a1cd8fedd5d9c7
parent1da4e16130d36c712e00bf045f09f194aac964b8
media: videobuf2-core: attach once if multiple planes share the same dbuf

When multiple planes use the same dma buf, each plane will have its own dma
buf attachment and mapping. It is a waste of IOVA space.

This patch adds a dbuf_duplicated boolean in vb2_plane. If a plane's dbuf
is the same as an existing plane, do not create another attachment and
mapping.

Signed-off-by: Yunke Cao <yunkec@chromium.org>
Acked-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/common/videobuf2/videobuf2-core.c
include/media/videobuf2-core.h