Skip to contentSkip to conversation

rockchip/rga: v4l2 m2m support

PATCH Superseded Jacob Chen 2 participants 2 messages Aug 2, 2017 – Aug 3, 2017

Subsystems (2)

v6 of 12 Superseded Latest is v12 →

lore
Share & tools
lore

Jacob Chen

author
#0 lore raw

PATCH v6 1/1 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
- 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 v6:
- correct a log order

---
 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 |  155 ++++
 drivers/media/platform/rockchip-rga/rga-hw.c  |  671 ++++++++++++++++
 drivers/media/platform/rockchip-rga/rga-hw.h  |  437 +++++++++++
 drivers/media/platform/rockchip-rga/rga.c     | 1026 +++++++++++++++++++++++++
 drivers/media/platform/rockchip-rga/rga.h     |  110 +++
 8 files changed, 2415 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
index 041cb80a..d0d1a21 100644
@@ -427,6 +427,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
index 63303d6..baf83060 100644
@@ -57,6 +57,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
new file mode 100644
index 0000000..92fe254
@@ -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 +155 -0

155 lines not on this page · raw message

drivers/media/platform/rockchip-rga/rga-hw.c new file +671 -0

671 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 +1026 -0

1,026 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
#1 lore raw
reproduce:

Hi Jacob,

[auto build test WARNING on rockchip/for-next]
[also build test WARNING on v4.13-rc3 next-20170803]
[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/rockchip-rga-v4l2-m2m-support/20170802-235943
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git for-next
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__

sparse warnings: (new ones prefixed by >>)

vim +/case +159 drivers/media/platform/rockchip-rga/rga.c

150
151 static int rga_s_ctrl(struct v4l2_ctrl *ctrl)
152 {
153 struct rga_ctx *ctx = container_of(ctrl->handler, struct rga_ctx,
154 ctrl_handler);
155 unsigned long flags;
156
157 spin_lock_irqsave(&ctx->rga->ctrl_lock, flags);
158 switch (ctrl->id) {

 > 159		case V4L2_CID_PORTER_DUFF_MODE:

160 ctx->op = ctrl->val;
161 break;
162 case V4L2_CID_HFLIP:
163 ctx->hflip = ctrl->val;
164 break;
165 case V4L2_CID_VFLIP:
166 ctx->vflip = ctrl->val;
167 break;
168 case V4L2_CID_ROTATE:
169 ctx->rotate = ctrl->val;
170 break;
171 case V4L2_CID_BG_COLOR:
172 ctx->fill_color = ctrl->val;
173 break;
174 }
175 spin_unlock_irqrestore(&ctx->rga->ctrl_lock, flags);
176 return 0;
177 }
178

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation