Add Rockchip RGA V4l2 support
Subsystems (3)
v8 cover Add Rockchip RGA V4l2 support
This patch series add a v4l2 m2m drvier for rockchip RGA direct rendering based 2d graphics acceleration module.
Recently I tried to add protduff support for gstreamer on rockchip platform, and i found that API were not very suitable for my purpose.
It shouldn't go upstream until we can figure out what people need,
change in V8:
- remove protduff things
change in V6,V7:
- correct warning in checkpatch.pl
change in V5:
- v4l2-compliance: handle invalid pxielformat
- v4l2-compliance: add subscribe_event
- add colorspace support
change in V4:
- document the controls.
- change according to Hans's comments
change in V3:
- rename the controls.
- add pm_runtime support.
- enable node by default.
- correct spelling in documents.
change in V2:
- generalize the controls.
- map buffers (10-50 us) in every cmd-run rather than in buffer-import to avoid get_free_pages failed on actively used systems.
- remove status in dt-bindings examples.
Jacob Chen (4):
rockchip/rga: v4l2 m2m support
ARM: dts: rockchip: add RGA device node for RK3288
arm64: dts: rockchip: add RGA device node for RK3399
dt-bindings: Document the Rockchip RGA bindings
.../devicetree/bindings/media/rockchip-rga.txt | 33 + arch/arm/boot/dts/rk3288.dtsi | 11 + arch/arm64/boot/dts/rockchip/rk3399.dtsi | 11 + drivers/media/platform/Kconfig | 11 + drivers/media/platform/Makefile | 2 + drivers/media/platform/rockchip-rga/Makefile | 3 + drivers/media/platform/rockchip-rga/rga-buf.c | 156 +++ drivers/media/platform/rockchip-rga/rga-hw.c | 435 ++++++++ drivers/media/platform/rockchip-rga/rga-hw.h | 437 +++++++++ drivers/media/platform/rockchip-rga/rga.c | 1035 ++++++++++++++++++++ drivers/media/platform/rockchip-rga/rga.h | 110 +++ 11 files changed, 2244 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/rockchip-rga.txt create mode 100644 drivers/media/platform/rockchip-rga/Makefile create mode 100644 drivers/media/platform/rockchip-rga/rga-buf.c create mode 100644 drivers/media/platform/rockchip-rga/rga-hw.c create mode 100644 drivers/media/platform/rockchip-rga/rga-hw.h create mode 100644 drivers/media/platform/rockchip-rga/rga.c create mode 100644 drivers/media/platform/rockchip-rga/rga.h
Signature · 1 line
2.7.4
PATCH v8 1/4 rockchip/rga: v4l2 m2m support
Rockchip RGA is a separate 2D raster graphic acceleration unit. It accelerates 2D graphics operations, such as point/line drawing, image scaling, rotation, BitBLT, alpha blending and image blur/sharpness
The drvier is mostly based on s5p-g2d v4l2 m2m driver And supports various operations from the rendering pipeline.
- copy
- fast solid color fill
- rotation
- flip
unsupported features:
- alpha blending
The code in rga-hw.c is used to configure regs according to operations The code in rga-buf.c is used to create private mmu table for RGA.
changes in V7:
- fix some warning reported by "checkpatch --strict"
--- drivers/media/platform/Kconfig | 11 + drivers/media/platform/Makefile | 2 + drivers/media/platform/rockchip-rga/Makefile | 3 + drivers/media/platform/rockchip-rga/rga-buf.c | 156 ++++ drivers/media/platform/rockchip-rga/rga-hw.c | 435 +++++++++++ drivers/media/platform/rockchip-rga/rga-hw.h | 437 +++++++++++ drivers/media/platform/rockchip-rga/rga.c | 1035 +++++++++++++++++++++++++ drivers/media/platform/rockchip-rga/rga.h | 110 +++ 8 files changed, 2189 insertions(+) create mode 100644 drivers/media/platform/rockchip-rga/Makefile create mode 100644 drivers/media/platform/rockchip-rga/rga-buf.c create mode 100644 drivers/media/platform/rockchip-rga/rga-hw.c create mode 100644 drivers/media/platform/rockchip-rga/rga-hw.h create mode 100644 drivers/media/platform/rockchip-rga/rga.c create mode 100644 drivers/media/platform/rockchip-rga/rga.h
drivers/media/platform/Kconfig +11 -0
@@ -458,6 +458,17 @@ config VIDEO_RENESAS_VSP1 To compile this driver as a module, choose M here: the module will be called vsp1. +config VIDEO_ROCKCHIP_RGA + tristate "Rockchip Raster 2d Grapphic Acceleration Unit" + depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA + depends on ARCH_ROCKCHIP || COMPILE_TEST + select VIDEOBUF2_DMA_SG + select V4L2_MEM2MEM_DEV + default n + ---help--- + This is a v4l2 driver for Rockchip SOC RGA2 + 2d graphics accelerator. + config VIDEO_TI_VPE tristate "TI VPE (Video Processing Engine) driver" depends on VIDEO_DEV && VIDEO_V4L2
drivers/media/platform/Makefile +2 -0
@@ -62,6 +62,8 @@ obj-$(CONFIG_VIDEO_RENESAS_FDP1) += rcar_fdp1.o obj-$(CONFIG_VIDEO_RENESAS_JPU) += rcar_jpu.o obj-$(CONFIG_VIDEO_RENESAS_VSP1) += vsp1/ +obj-$(CONFIG_VIDEO_ROCKCHIP_RGA) += rockchip-rga/ + obj-y += omap/ obj-$(CONFIG_VIDEO_AM437X_VPFE) += am437x/
drivers/media/platform/rockchip-rga/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +rockchip-rga-objs := rga.o rga-hw.o rga-buf.o + +obj-$(CONFIG_VIDEO_ROCKCHIP_RGA) += rockchip-rga.o
drivers/media/platform/rockchip-rga/rga-buf.c new file +156 -0
156 lines not on this page · raw message
drivers/media/platform/rockchip-rga/rga-hw.c new file +435 -0
435 lines not on this page · raw message
drivers/media/platform/rockchip-rga/rga-hw.h new file +437 -0
437 lines not on this page · raw message
drivers/media/platform/rockchip-rga/rga.c new file +1035 -0
1,035 lines not on this page · raw message
drivers/media/platform/rockchip-rga/rga.h new file +110 -0
110 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v8 2/4 ARM: dts: rockchip: add RGA device node for RK3288
In reply to Jacob ChenThis patch add the RGA dt config of rk3288 SoC.
--- arch/arm/boot/dts/rk3288.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/arm/boot/dts/rk3288.dtsi +11 -0
@@ -953,6 +953,17 @@ status = "okay"; }; + rga: rga at ff920000 { + compatible = "rockchip,rk3288-rga"; + reg = <0xff920000 0x180>; + interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru ACLK_RGA>, <&cru HCLK_RGA>, <&cru SCLK_RGA>; + clock-names = "aclk", "hclk", "sclk"; + power-domains = <&power RK3288_PD_VIO>; + resets = <&cru SRST_RGA_CORE>, <&cru SRST_RGA_AXI>, <&cru SRST_RGA_AHB>; + reset-names = "core", "axi", "ahb"; + }; + vopb: vop at ff930000 { compatible = "rockchip,rk3288-vop"; reg = <0xff930000 0x19c>;
Signature · 1 line
2.7.4
PATCH v8 3/4 arm64: dts: rockchip: add RGA device node for RK3399
In reply to Jacob ChenThis patch add the RGA dt config of RK3399 SoC.
--- arch/arm64/boot/dts/rockchip/rk3399.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/arm64/boot/dts/rockchip/rk3399.dtsi +11 -0
@@ -1153,6 +1153,17 @@ status = "disabled"; }; + rga: rga at ff680000 { + compatible = "rockchip,rk3399-rga"; + reg = <0x0 0xff680000 0x0 0x10000>; + interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH 0>; + clocks = <&cru ACLK_RGA>, <&cru HCLK_RGA>, <&cru SCLK_RGA_CORE>; + clock-names = "aclk", "hclk", "sclk"; + resets = <&cru SRST_RGA_CORE>, <&cru SRST_A_RGA>, <&cru SRST_H_RGA>; + reset-names = "core", "axi", "ahb"; + power-domains = <&power RK3399_PD_RGA>; + }; + efuse0: efuse at ff690000 { compatible = "rockchip,rk3399-efuse"; reg = <0x0 0xff690000 0x0 0x80>;
Signature · 1 line
2.7.4
PATCH v8 4/4 dt-bindings: Document the Rockchip RGA bindings
In reply to Jacob ChenAdd DT bindings documentation for Rockchip RGA
--- .../devicetree/bindings/media/rockchip-rga.txt | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/rockchip-rga.txt
Documentation/devicetree/bindings/media/rockchip-rga.txt new file +33 -0
@@ -0,0 +1,33 @@ +device-tree bindings for rockchip 2D raster graphic acceleration controller (RGA) + +RGA is a standalone 2D raster graphic acceleration unit. It accelerates 2D +graphics operations, such as point/line drawing, image scaling, rotation, +BitBLT, alpha blending and image blur/sharpness. + +Required properties: +- compatible: value should be one of the following + "rockchip,rk3288-rga"; + "rockchip,rk3399-rga"; + +- interrupts: RGA interrupt specifier. + +- clocks: phandle to RGA sclk/hclk/aclk clocks + +- clock-names: should be "aclk", "hclk" and "sclk" + +- resets: Must contain an entry for each entry in reset-names. + See ../reset/reset.txt for details. +- reset-names: should be "core", "axi" and "ahb" + +Example: +SoC-specific DT entry: + rga: rga at ff680000 { + compatible = "rockchip,rk3399-rga"; + reg = <0xff680000 0x10000>; + interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru ACLK_RGA>, <&cru HCLK_RGA>, <&cru SCLK_RGA_CORE>; + clock-names = "aclk", "hclk", "sclk"; + + resets = <&cru SRST_RGA_CORE>, <&cru SRST_A_RGA>, <&cru SRST_H_RGA>; + reset-names = "core, "axi", "ahb"; + };
Signature · 1 line
2.7.4
Hi Hans,
v4l2-compliance result:
v4l2-compliance SHA : not available
Driver Info:
Driver name : rockchip-rga
Card type : rockchip-rga
Bus info : platform:rga
Driver version: 4.13.0
Capabilities : 0x84208000
Video Memory-to-Memory
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04208000
Video Memory-to-Memory
Streaming
Extended Pix FormatCompliance test for device /dev/video0 (not using libv4l2):
Required ioctls:
test VIDIOC_QUERYCAP: OK
Allow for multiple opens:
test second video open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK
Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK (Not Supported)
Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0
Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0
Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)
Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 7 Private Controls: 0
Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK (Not Supported) test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
fail: v4l2-test-formats.cpp(779):fmt_cap.g_colorspace() != col
test VIDIOC_S_FMT: FAIL
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
fail: v4l2-test-formats.cpp(1273): doioctl(node,VIDIOC_G_SELECTION, &sel) != EI
NVAL
test Cropping: OK (Not Supported)
fail: v4l2-test-formats.cpp(1273): doioctl(node,VIDIOC_G_SELECTION, &sel) != EI
NVAL
test Composing: FAIL
test Scaling: OK
Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test VIDIOC_EXPBUF: OK
Test input 0:
Total: 43, Succeeded: 41, Failed: 2, Warnings: 0
root at linaro-alip:~#
kbuild test robot
build botRe: [PATCH v8 1/4] rockchip/rga: v4l2 m2m support
In reply to Jacob Chenreproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross…
Hi Jacob,
[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v4.13 next-20170913]
[cannot apply to rockchip/for-next]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Jacob-Chen/Add-Rockchip-RGA-V4l2-support/20170913-171106 base: git://linuxtv.org/media_tree.git master config: ia64-allyesconfig (attached as .config) compiler: ia64-linux-gcc (GCC) 6.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=ia64
All errors (new ones prefixed by >>):
drivers/media/platform/rockchip-rga/rga.c: In function 'rga_setup_ctrls':
>> drivers/media/platform/rockchip-rga/rga.c:190:11: error: 'V4L2_CID_PORTER_DUFF_MODE' undeclared (first use in this function)
V4L2_CID_PORTER_DUFF_MODE,
^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/rockchip-rga/rga.c:190:11: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/media/platform/rockchip-rga/rga.c:191:11: error: 'V4L2_PORTER_DUFF_CLEAR' undeclared (first use in this function)
V4L2_PORTER_DUFF_CLEAR, 0,
^~~~~~~~~~~~~~~~~~~~~~
>> drivers/media/platform/rockchip-rga/rga.c:192:11: error: 'V4L2_PORTER_DUFF_SRC' undeclared (first use in this function)
V4L2_PORTER_DUFF_SRC);
^~~~~~~~~~~~~~~~~~~~vim +/V4L2_CID_PORTER_DUFF_MODE +190 drivers/media/platform/rockchip-rga/rga.c
182
183 static int rga_setup_ctrls(struct rga_ctx *ctx)
184 {
185 struct rockchip_rga *rga = ctx->rga;
186
187 v4l2_ctrl_handler_init(&ctx->ctrl_handler, 5);
188
189 v4l2_ctrl_new_std_menu(&ctx->ctrl_handler, &rga_ctrl_ops,
> 190 V4L2_CID_PORTER_DUFF_MODE, > 191 V4L2_PORTER_DUFF_CLEAR, 0, > 192 V4L2_PORTER_DUFF_SRC);
193
194 v4l2_ctrl_new_std(&ctx->ctrl_handler, &rga_ctrl_ops,
195 V4L2_CID_HFLIP, 0, 1, 1, 0);
196
197 v4l2_ctrl_new_std(&ctx->ctrl_handler, &rga_ctrl_ops,
198 V4L2_CID_VFLIP, 0, 1, 1, 0);
199
200 v4l2_ctrl_new_std(&ctx->ctrl_handler, &rga_ctrl_ops,
201 V4L2_CID_ROTATE, 0, 270, 90, 0);
202
203 v4l2_ctrl_new_std(&ctx->ctrl_handler, &rga_ctrl_ops,
204 V4L2_CID_BG_COLOR, 0, 0xffffffff, 1, 0);
205
206 if (ctx->ctrl_handler.error) {
207 int err = ctx->ctrl_handler.error;
208
209 v4l2_err(&rga->v4l2_dev, "%s failed\n", __func__);
210 v4l2_ctrl_handler_free(&ctx->ctrl_handler);
211 return err;
212 }
213
214 return 0;
215 }
216
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 51534 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170913/5180f18c/attachment-0001.gz>