]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
media: rockchip: rga: add rga3 support
authorSven Püschel <s.pueschel@pengutronix.de>
Wed, 20 May 2026 22:44:32 +0000 (00:44 +0200)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Thu, 21 May 2026 10:32:21 +0000 (12:32 +0200)
commit24a63d4c9d3ce3afc99f698cff62d79c457fc5ca
treecfa034b09c726797f04a575a01a57911adc818a3
parentbf0ee2589053b103426e1179b87f83ea512264df
media: rockchip: rga: add rga3 support

Add support for the RGA3 unit contained in the RK3588.

Only a basic feature set consisting of scaling and color conversion is
implemented. Currently unimplemented features include:
- Advanced formats like 10bit YUV, FBCE mode and Tile8x8 mode
- Background color (V4L2_CID_BG_COLOR)
- Configurable alpha value (V4L2_CID_ALPHA_COMPONENT)
- Image flipping (V4L2_CID_HFLIP and V4L2_CID_VFLIP)
- Image rotation (V4L2_CID_ROTATE)
- Image cropping/composing (VIDIOC_S_SELECTION)
  - Only very basic output cropping for 1088 -> 1080 cases is implemented

The register address defines were copied from the
vendor Rockchip kernel sources and slightly adjusted to not start at 0
again for the cmd registers.

During testing it has been noted that the scaling of the hardware is
slightly incorrect. A test conversion of 128x128 RGBA to 256x256 RGBA
causes a slightly larger scaling. The scaling is suddle, as it seems
that the image is scaled to a 2px larger version and then cropped to
it's final size. Trying to use the RGA2 scaling factor calculation
didn't work. As the calculation matches the vendor kernel driver, no
further research has been utilized to check if there may be some kind of
better scaling factor calculation.

Furthermore comparing the RGA3 conversion with the GStreamer
videoconvertscale element, the chroma-site is different. A quick testing
didn't reveal a chroma-site that creates the same image with the
GStreamer Element. Also when converting from YUV to RGB the RGB values
differ by 1 or 2. This doesn't seem to be a colorspace conversion issue
but rather a slightly different precision on the calculation.

Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Sven Püschel <s.pueschel@pengutronix.de>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/platform/rockchip/rga/Makefile
drivers/media/platform/rockchip/rga/rga.c
drivers/media/platform/rockchip/rga/rga.h
drivers/media/platform/rockchip/rga/rga3-hw.c [new file with mode: 0644]
drivers/media/platform/rockchip/rga/rga3-hw.h [new file with mode: 0644]