media: rockchip: rga: allocate DMA descriptors per buffer
authorMichael Tretter <m.tretter@pengutronix.de>
Fri, 13 Oct 2023 11:00:24 +0000 (13:00 +0200)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Thu, 7 Dec 2023 07:56:13 +0000 (08:56 +0100)
commit6040702ade234c8212dcfdef85e2f5549aa2f0f5
treee2b467594e27bb0f2df5798a91fcb2890752d206
parent77f2e2b255ce05b9d63566e5290ac66c49913abd
media: rockchip: rga: allocate DMA descriptors per buffer

The RGA driver allocates two buffers for the DMA descriptors of the
input and output buffers. Whenever a new job is processed, the
descriptor list is updated for the current buffers.

By updating the descriptor list during buf_prepare, it is possible to
correctly fail DMABUF imports if the buffers that shall be imported are
not within the 32 bit address range that can be addressed by the RGA.

Managing the DMA descriptor list with the buffer also makes it easier to
track the buffer mapping and the plane offsets into this mapping.

The cost is that the driver now requires DMA coherent memory per buffer
for the descriptor list. However, the size scales with the size of the
video buffers and is not allocated if the RGA is not used.

While at it, use dma_alloc_coherent to allocate the descriptors and get
rid of the virt_to_phys calls to get the physical addresses.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/platform/rockchip/rga/rga-buf.c
drivers/media/platform/rockchip/rga/rga-hw.c
drivers/media/platform/rockchip/rga/rga.c
drivers/media/platform/rockchip/rga/rga.h