linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/13] media: rockchip: rga: add support for multi-planar formats
@ 2023-10-13 11:00 Michael Tretter
  2023-10-13 11:00 ` [PATCH v2 01/13] media: rockchip: rga: fix swizzling for RGB formats Michael Tretter
                   ` (14 more replies)
  0 siblings, 15 replies; 19+ messages in thread
From: Michael Tretter @ 2023-10-13 11:00 UTC (permalink / raw)
  To: Jacob Chen, Ezequiel Garcia, Mauro Carvalho Chehab,
	Heiko Stuebner, Shengyu Qu, Nicolas Frattaroli, Robin Murphy,
	Diederik de Haas, Hans Verkuil
  Cc: linux-media, linux-rockchip, linux-arm-kernel, kernel,
	Michael Tretter

This is v2 of the series that adds support for the V4L2 multi-planar API
to the Rockchip RGA driver. Once the RGA driver supports the
multi-planar API, it is easier to share buffers with other V4L2 drivers
that also support the multi-planar API and may not expose planar formats
with contiguous planes.

v2 fixes the smatch warnings and compile errors of v1. Furthermore, now
the DMA mask is set to 32 bits for coherent, too, and the gfp_flags are
configured to ensure that buffers are allocated in the lower 4GB area.

With non-contiguous planes, the U and V planes may not start at the same
offset as with the continuous planes. Therefore, the RGA driver cannot
rely on its calculation of the plane offsets based on the format and
frame size anymore, but must remember the offsets when it created the
mapping. Therefore, I also reworked how the DMA mapping is handled.

As a bonus, the RGA driver should now work correctly on devices with
more than 4 GB of memory. Video buffers should now be allocated within
the 4 GB boundary and an import of buffers that have higher addresses
into the driver should fail.

Patch 1 fixes the swizzling of RGA formats. While testing all formats of
the driver on rk3568, I discovered that the color channels of the RGB
formats are wrong when converting to NV12. I didn't test this on other
SoCs with an RGA and I am not sure, if they behave differently regarding
the color channels. Please report, if this breaks the color conversion
on other SoCs, and I will make this SoC-specific.

Patches 2 to 6 are the rework the DMA descriptor handling for the RGA
MMU. The patches clean up, how the driver uses the DMA API, and make the
creation of the descriptor list more explicit. Furthermore, the driver
is changed to keep the mapping per video buffer instead of using a
single mapping that is updated with every buffer.

Patches 7 to 11 prepare the driver for the multi-planar API including a
cleanup of the format handling in the buffer, and finally switch to the
multi-planar API.

Patch 12 updates the code that creates the DMA-descriptor mapping to
correctly handle buffers with multiple planes. The driver has to iterate
all planes and make them the continuous for the RGA.

Patch 13 enables the NV12M format, which is the multi-planar variant of
the NV12 format.

Michael

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
Changes in v2:
- Fix smatch warnings
- Fix cast to dst_mmu_pages/src_mmu_pages to fix compile error in Patch 2
- Remove check for upper_32_bits when filling the DMA descriptor table
- Remove useless dma_sync_single_for_device()
- Set DMA mask for DMA coherent
- Set gfp_flags to __GFP_DMA32
- Link to v1: https://lore.kernel.org/r/20230914-rockchip-rga-multiplanar-v1-0-abfd77260ae3@pengutronix.de

---
Michael Tretter (13):
      media: rockchip: rga: fix swizzling for RGB formats
      media: rockchip: rga: extract helper to fill descriptors
      media: rockchip: rga: allocate DMA descriptors per buffer
      media: rockchip: rga: split src and dst buffer setup
      media: rockchip: rga: pre-calculate plane offsets
      media: rockchip: rga: set dma mask to 32 bits
      media: rockchip: rga: use clamp() to clamp size to limits
      media: rockchip: rga: use pixelformat to find format
      media: rockchip: rga: add local variable for pix_format
      media: rockchip: rga: use macros for testing buffer type
      media: rockchip: rga: switch to multi-planar API
      media: rockchip: rga: rework buffer handling for multi-planar formats
      media: rockchip: rga: add NV12M support

 drivers/media/platform/rockchip/rga/rga-buf.c | 162 ++++++++++++++++------
 drivers/media/platform/rockchip/rga/rga-hw.c  | 146 ++++++++++++--------
 drivers/media/platform/rockchip/rga/rga.c     | 189 ++++++++++++--------------
 drivers/media/platform/rockchip/rga/rga.h     |  35 ++++-
 4 files changed, 328 insertions(+), 204 deletions(-)
---
base-commit: 2c1bae27df787c9535e48cc27bbd11c3c3e0a235
change-id: 20230914-rockchip-rga-multiplanar-0d7c79b1ba93

Best regards,
-- 
Michael Tretter <m.tretter@pengutronix.de>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2023-11-25  8:23 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-13 11:00 [PATCH v2 00/13] media: rockchip: rga: add support for multi-planar formats Michael Tretter
2023-10-13 11:00 ` [PATCH v2 01/13] media: rockchip: rga: fix swizzling for RGB formats Michael Tretter
2023-11-25  0:39   ` Deborah Brouwer
2023-10-13 11:00 ` [PATCH v2 02/13] media: rockchip: rga: extract helper to fill descriptors Michael Tretter
2023-10-13 11:00 ` [PATCH v2 03/13] media: rockchip: rga: allocate DMA descriptors per buffer Michael Tretter
2023-10-13 11:00 ` [PATCH v2 04/13] media: rockchip: rga: split src and dst buffer setup Michael Tretter
2023-10-13 11:00 ` [PATCH v2 05/13] media: rockchip: rga: pre-calculate plane offsets Michael Tretter
2023-10-13 11:00 ` [PATCH v2 06/13] media: rockchip: rga: set dma mask to 32 bits Michael Tretter
2023-10-13 11:00 ` [PATCH v2 07/13] media: rockchip: rga: use clamp() to clamp size to limits Michael Tretter
2023-10-13 11:00 ` [PATCH v2 08/13] media: rockchip: rga: use pixelformat to find format Michael Tretter
2023-10-13 11:00 ` [PATCH v2 09/13] media: rockchip: rga: add local variable for pix_format Michael Tretter
2023-10-13 11:00 ` [PATCH v2 10/13] media: rockchip: rga: use macros for testing buffer type Michael Tretter
2023-10-13 11:00 ` [PATCH v2 11/13] media: rockchip: rga: switch to multi-planar API Michael Tretter
2023-10-13 11:00 ` [PATCH v2 12/13] media: rockchip: rga: rework buffer handling for multi-planar formats Michael Tretter
2023-10-13 11:00 ` [PATCH v2 13/13] media: rockchip: rga: add NV12M support Michael Tretter
2023-11-23 15:11 ` [PATCH v2 00/13] media: rockchip: rga: add support for multi-planar formats Michael Tretter
2023-11-24 13:39 ` Hans Verkuil
2023-11-24 15:31   ` Michael Tretter
2023-11-25  8:22     ` Hans Verkuil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).