Re: [PATCH v8 1/4] rockchip/rga: v4l2 m2m support

2017-09-13 Thread kbuild test robot
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,
   195V4L2_CID_HFLIP, 0, 1, 1, 0);
   196  
   197  v4l2_ctrl_new_std(&ctx->ctrl_handler, &rga_ctrl_ops,
   198V4L2_CID_VFLIP, 0, 1, 1, 0);
   199  
   200  v4l2_ctrl_new_std(&ctx->ctrl_handler, &rga_ctrl_ops,
   201V4L2_CID_ROTATE, 0, 270, 90, 0);
   202  
   203  v4l2_ctrl_new_std(&ctx->ctrl_handler, &rga_ctrl_ops,
   204V4L2_CID_BG_COLOR, 0, 0x, 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 infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


[PATCH v8 1/4] rockchip/rga: v4l2 m2m support

2017-09-11 Thread 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 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"

Signed-off-by: Jacob Chen 
---
 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

diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 7e7cc49..9b79350 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -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
diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile
index c1ef946..06039c3 100644
--- a/drivers/media/platform/Makefile
+++ b/drivers/media/platform/Makefile
@@ -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/
diff --git a/drivers/media/platform/rockchip-rga/Makefile 
b/drivers/media/platform/rockchip-rga/Makefile
new file mode 100644
index 000..92fe254
--- /dev/null
+++ b/drivers/media/platform/rockchip-rga/Makefile
@@ -0,0 +1,3 @@
+rockchip-rga-objs := rga.o rga-hw.o rga-buf.o
+
+obj-$(CONFIG_VIDEO_ROCKCHIP_RGA) += rockchip-rga.o
diff --git a/drivers/media/platform/rockchip-rga/rga-buf.c 
b/drivers/media/platform/rockchip-rga/rga-buf.c
new file mode 100644
index 000..373c36f
--- /dev/null
+++ b/drivers/media/platform/rockchip-rga/rga-buf.c
@@ -0,0 +1,156 @@
+/*
+ * Copyright (C) 2017 Fuzhou Rockchip Electronics Co.Ltd
+ * Author: Jacob Chen 
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "rga-hw.h"
+#include "rga.h"
+
+static int
+rga_queue_setup(struct vb2_queue *vq,
+   unsigned int *nbuffers, unsigned int *nplanes,
+   unsigned int sizes[], struct device *alloc_devs[])
+{
+   struct rga_ctx *ctx = vb2_get_drv_priv(vq);
+   struct rga_frame *f = rga_get_frame(ctx, vq->type);
+
+   if (IS_ERR(f))
+   return PTR_ERR(f);
+
+   if (*nplanes)
+   return sizes[0] < f->size ? -EINVAL : 0;
+
+   sizes[0] = f->size;
+   *nplanes = 1;
+
+   return 0;
+}
+
+static int rga_buf_prepare(struct vb2_buffer *vb)
+{
+   struct rga_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
+   struct rga_frame *f = rga_get_frame(ctx, vb->vb2_queue->type);
+
+   if (IS_ERR(f))
+   return PTR_ERR(f);
+
+   vb2_set_plane_payload(vb, 0, f->size);
+
+   return 0;
+}
+
+static v