media: amphion: Support dmabuf and v4l2 buffer without binding
authorMing Qian <ming.qian@oss.nxp.com>
Thu, 24 Apr 2025 10:33:24 +0000 (18:33 +0800)
committerHans Verkuil <hverkuil@xs4all.nl>
Sat, 12 Jul 2025 06:34:48 +0000 (08:34 +0200)
commit77ce8e4d6de72a4b8b8c4595a8c1c2305f3ac469
tree6f2b1248ce6a6e7633254a9ff528685206a17d77
parent3f6702e1be8a06e70c60720162a77c8b3a4b69d3
media: amphion: Support dmabuf and v4l2 buffer without binding

When using VB2_DMABUF, the relationship between dma-buf and v4l2 buffer
may not one-to-one, a single dma-buf may be queued via different
v4l2 buffers, and different dma-bufs may be queued via the same
v4l2 buffer, so it's not appropriate to use the v4l2 buffer index
as the frame store id.

We can generate a frame store id according to the dma address.
Then for a given dma-buf, the id is fixed.

Driver now manages the frame store and vb2-buffer states independently.

When a dmabuf is queued via another v4l2 buffer before the buffer is
released by firmware, need to pend it until firmware release it.

Signed-off-by: Ming Qian <ming.qian@oss.nxp.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
drivers/media/platform/amphion/vdec.c
drivers/media/platform/amphion/vpu.h
drivers/media/platform/amphion/vpu_dbg.c
drivers/media/platform/amphion/vpu_v4l2.c