Add Rockchip RGA V4l2 support
Subsystems (4)
Jacob Chen
maintainerv11 cover Add Rockchip RGA V4l2 support
change in V11:
- fix compile warning
change in V10:
- move to rockchip/rga
- changes according to comments
- some style changes
change in V9:
- remove protduff things
- test with the latest v4l2-compliance
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 | 15 + drivers/media/platform/Makefile | 2 + drivers/media/platform/rockchip/rga/Makefile | 3 + drivers/media/platform/rockchip/rga/rga-buf.c | 154 +++ drivers/media/platform/rockchip/rga/rga-hw.c | 421 ++++++++ drivers/media/platform/rockchip/rga/rga-hw.h | 437 +++++++++ drivers/media/platform/rockchip/rga/rga.c | 1012 ++++++++++++++++++++ drivers/media/platform/rockchip/rga/rga.h | 123 +++ 11 files changed, 2222 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.14.1
Jacob Chen
maintainerPATCH v11 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 driver supports various operations from the rendering pipeline.
- copy
- fast solid color fill
- rotation
- flip
- 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.
--- drivers/media/platform/Kconfig | 15 + drivers/media/platform/Makefile | 2 + drivers/media/platform/rockchip/rga/Makefile | 3 + drivers/media/platform/rockchip/rga/rga-buf.c | 154 ++++ drivers/media/platform/rockchip/rga/rga-hw.c | 421 ++++++++++ drivers/media/platform/rockchip/rga/rga-hw.h | 437 +++++++++++ drivers/media/platform/rockchip/rga/rga.c | 1012 +++++++++++++++++++++++++ drivers/media/platform/rockchip/rga/rga.h | 123 +++ 8 files changed, 2167 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 +15 -0
@@ -458,6 +458,21 @@ 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 RGA 2d graphics accelerator. + 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. + + To compile this driver as a module choose m here. + 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 +154 -0
154 lines not on this page · raw message
drivers/media/platform/rockchip/rga/rga-hw.c new file +421 -0
421 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 +1012 -0
1,012 lines not on this page · raw message
drivers/media/platform/rockchip/rga/rga.h new file +123 -0
123 lines not on this page · raw message
Signature · 1 line
2.14.1
Re: [PATCH v11 1/4] rockchip/rga: v4l2 m2m support
Quoted 11 lines · Jacob Chen
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 driver supports various operations from the rendering pipeline.
- copy
- fast solid color fill
- rotation
- flip
- alpha blending
Quoted 4 lines
The code in
rga-hw.cis used to configure regs according to operations The code inrga-buf.cis used to create private mmu table for RGA.Signed-off-by Jacob Chen <[email protected]>
I ran checkpatch --strict on this patch and I found a few small issues:
WARNING: Avoid crashing the kernel - try using WARN_ON & recovery code rather than BUG() or BUG_ON() #1222: FILE: drivers/media/platform/rockchip/rga/rga.c:89:
+ BUG_ON(!ctx);
WARNING: Avoid crashing the kernel - try using WARN_ON & recovery code rather than BUG() or BUG_ON() #1229: FILE: drivers/media/platform/rockchip/rga/rga.c:96:
+ BUG_ON(!src);
WARNING: Avoid crashing the kernel - try using WARN_ON & recovery code rather than BUG() or BUG_ON() #1230: FILE: drivers/media/platform/rockchip/rga/rga.c:97:
+ BUG_ON(!dst);
I think you can use WARN_ON here and just return.
CHECK: struct mutex definition without comment #2235: FILE: drivers/media/platform/rockchip/rga/rga.h:84:
+ struct mutex mutex;
CHECK: spinlock_t definition without comment #2236: FILE: drivers/media/platform/rockchip/rga/rga.h:85:
+ spinlock_t ctrl_lock;
These two fields need a comment describing what the locks protect.
Also move patch 4/4 to the beginning of the patch series. The bindings patch should come before the driver.
If I have a v12 with these issues fixed and a MAINTAINERS patch, then I'll take it on Friday.
Do you want me to take the dts patches or will they go through another tree?
Regards,
Hans
Heiko Stübner
maintainerRe: [PATCH v11 1/4] rockchip/rga: v4l2 m2m support
Hi Hans,
Am Montag, 9. Oktober 2017, 14:48:13 CEST schrieb Hans Verkuil:
Quoted 47 lines · Jacob Chen
Quoted 12 lines
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 driver supports various operations from the rendering pipeline.
- copy
- fast solid color fill
- rotation
- flip
- alpha blendingQuoted 4 lines
The code in
rga-hw.cis used to configure regs according to operations The code inrga-buf.cis used to create private mmu table for RGA.Signed-off-by Jacob Chen <[email protected]>I ran checkpatch --strict on this patch and I found a few small issues:
WARNING: Avoid crashing the kernel - try using
WARN_ON& recovery code rather thanBUG()orBUG_ON()#1222: FILE:drivers/media/platform/rockchip/rga/rga.c:89:
+BUG_ON(!ctx);WARNING: Avoid crashing the kernel - try using
WARN_ON& recovery code rather thanBUG()orBUG_ON()#1229: FILE:drivers/media/platform/rockchip/rga/rga.c:96:
+BUG_ON(!src);WARNING: Avoid crashing the kernel - try using
WARN_ON& recovery code rather thanBUG()orBUG_ON()#1230: FILE:drivers/media/platform/rockchip/rga/rga.c:97:
+BUG_ON(!dst);I think you can use
WARN_ONhere and just return.CHECK: struct mutex definition without comment #2235: FILE:
drivers/media/platform/rockchip/rga/rga.h:84:
+ struct mutex mutex;CHECK:
spinlock_tdefinition without comment #2236: FILE:drivers/media/platform/rockchip/rga/rga.h:85:
+spinlock_tctrl_lock;These two fields need a comment describing what the locks protect.
Quoted 7 lines
Also move patch 4/4 to the beginning of the patch series. The bindings patch should come before the driver.
If I have a v12 with these issues fixed and a
MAINTAINERSpatch, then I'll take it on Friday.Do you want me to take the dts patches or will they go through another tree?
I'd prefer for me to pick up the dts patches ("ARM: dts" and "arm64: dts:"), as otherwise we always get conflicts and confusion :-)
I'm monitoring this series, so after you pick the binding + driver, I can just pick the other two.
Thanks
Heiko
Jacob Chen
maintainerPATCH v11 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
@@ -972,6 +972,17 @@ status = "disabled"; }; + rga: rga at ff920000 { + compatible = "rockchip,rk3288-rga"; + reg = <0x0 0xff920000 0x0 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 = <0x0 0xff930000 0x0 0x19c>;
Signature · 1 line
2.14.1
Jacob Chen
maintainerPATCH v11 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
@@ -1204,6 +1204,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.14.1
Jacob Chen
maintainerPATCH v11 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.14.1
Hi Jacob,
A patch adding an entry to MAINTAINERS is still missing.
Just post a separate patch for that.
Regards,
Hans
Quoted 65 lines · Jacob Chen
change in V11:
- fix compile warningchange in V10:
- move to rockchip/rga
- changes according to comments
- some style changeschange in V9:
- remove protduff things
- test with the latest v4l2-compliancechange in V8:
- remove protduff thingschange in V6,V7:
- correct warning in checkpatch.plchange in V5:
- v4l2-compliance: handle invalid pxielformat
- v4l2-compliance: addsubscribe_event
- add colorspace supportchange in V4:
- document the controls.
- change according to Hans's commentschange in V3:
- rename the controls.
- addpm_runtimesupport.
- 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 avoidget_free_pagesfailed 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 | 15 + drivers/media/platform/Makefile | 2 + drivers/media/platform/rockchip/rga/Makefile | 3 + drivers/media/platform/rockchip/rga/rga-buf.c | 154 +++ drivers/media/platform/rockchip/rga/rga-hw.c | 421 ++++++++ drivers/media/platform/rockchip/rga/rga-hw.h | 437 +++++++++ drivers/media/platform/rockchip/rga/rga.c | 1012 ++++++++++++++++++++ drivers/media/platform/rockchip/rga/rga.h | 123 +++ 11 files changed, 2222 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