mbox series

[v4,0/4] media: videobuf2-core: attach once if multiple planes share the same dbuf

Message ID 20240614073702.316810-1-yunkec@chromium.org (mailing list archive)
Headers show
Series media: videobuf2-core: attach once if multiple planes share the same dbuf | expand

Message

Yunke Cao June 14, 2024, 7:36 a.m. UTC
Hi,

This patch set avoids attaching and mapping a dma_buf multiple times when
several planes in one vb2 buffer share the same dma_buf.

1/4, 2/4 and 3/4 refactors __prepare_dmabuf()
4/4 adds a flag to avoid duplicated attaching

v4:
- Update patch 4/4, only set dbuf_duplicated when alloc_devs are equal.
v3:
- Add patch 1/4 to move clearing fields into __vb2_plane_dmabuf_put().
- Resolve review comments on v2. Detailed changelog in patch.
v2:
- Add patch 1/3 to refactor __prepare_dmabuf()
- Add patch 2/3 to resolve Tomasz's comment on __vb2_buf_dmabuf_put()'s
iteration order
- Fix mem_priv in patch 3/3
- Rename duplicated_dbuf to dbuf_duplicated

Yunke Cao (4):
  media: videobuf2-core: clear memory related fields in
    __vb2_plane_dmabuf_put()
  media: videobuf2-core: release all planes first in __prepare_dmabuf()
  media: videobuf2-core: reverse the iteration order in
    __vb2_buf_dmabuf_put
  media: videobuf2-core: attach once if multiple planes share the same
    dbuf

 .../media/common/videobuf2/videobuf2-core.c   | 153 ++++++++++--------
 include/media/videobuf2-core.h                |   3 +
 2 files changed, 92 insertions(+), 64 deletions(-)

Comments

Tomasz Figa June 18, 2024, 5:53 a.m. UTC | #1
On Fri, Jun 14, 2024 at 04:36:58PM +0900, Yunke Cao wrote:
> Hi,
> 
> This patch set avoids attaching and mapping a dma_buf multiple times when
> several planes in one vb2 buffer share the same dma_buf.
> 
> 1/4, 2/4 and 3/4 refactors __prepare_dmabuf()
> 4/4 adds a flag to avoid duplicated attaching
> 
> v4:
> - Update patch 4/4, only set dbuf_duplicated when alloc_devs are equal.
> v3:
> - Add patch 1/4 to move clearing fields into __vb2_plane_dmabuf_put().
> - Resolve review comments on v2. Detailed changelog in patch.
> v2:
> - Add patch 1/3 to refactor __prepare_dmabuf()
> - Add patch 2/3 to resolve Tomasz's comment on __vb2_buf_dmabuf_put()'s
> iteration order
> - Fix mem_priv in patch 3/3
> - Rename duplicated_dbuf to dbuf_duplicated
> 
> Yunke Cao (4):
>   media: videobuf2-core: clear memory related fields in
>     __vb2_plane_dmabuf_put()
>   media: videobuf2-core: release all planes first in __prepare_dmabuf()
>   media: videobuf2-core: reverse the iteration order in
>     __vb2_buf_dmabuf_put
>   media: videobuf2-core: attach once if multiple planes share the same
>     dbuf
> 
>  .../media/common/videobuf2/videobuf2-core.c   | 153 ++++++++++--------
>  include/media/videobuf2-core.h                |   3 +
>  2 files changed, 92 insertions(+), 64 deletions(-)
> 
> -- 
> 2.45.2.627.g7a2c4fd464-goog
>

The series looks good to me. Thanks for the nice work!

Acked-by: Tomasz Figa <tfiga@chromium.org>

Best regards,
Tomasz