Re: [PATCH v3 6/9] drm/exynos: fimc: Convert driver to IPP v2 core API

2017-10-19 Thread Tobias Jakobi
Marek Szyprowski wrote:
> This patch adapts Exynos DRM rotator driver to new IPP v2 core API.
"DRM FIMC driver"

- Tobias


> The side effect of this conversion is a switch to driver component API
> to register properly in the Exynos DRM core.
> 
> Signed-off-by: Marek Szyprowski 
> ---
>  drivers/gpu/drm/exynos/Kconfig   |   2 +-
>  drivers/gpu/drm/exynos/exynos_drm_drv.c  |   1 +
>  drivers/gpu/drm/exynos/exynos_drm_fimc.c | 930 
> ++-
>  drivers/gpu/drm/exynos/exynos_drm_fimc.h |  23 -
>  4 files changed, 282 insertions(+), 674 deletions(-)
>  delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_fimc.h
> 
> diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig
> index 4bb9edb00601..33ef84be2d7f 100644
> --- a/drivers/gpu/drm/exynos/Kconfig
> +++ b/drivers/gpu/drm/exynos/Kconfig
> @@ -99,7 +99,7 @@ config DRM_EXYNOS_IPP
>  
>  config DRM_EXYNOS_FIMC
>   bool "FIMC"
> - depends on BROKEN && MFD_SYSCON
> + select DRM_EXYNOS_IPP
>   help
> Choose this option if you want to use Exynos FIMC for DRM.
>  
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
> b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> index 60ae6ae06eb2..4afeffa024f3 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> @@ -256,6 +256,7 @@ static struct exynos_drm_driver_info exynos_drm_drivers[] 
> = {
>   DRV_PTR(g2d_driver, CONFIG_DRM_EXYNOS_G2D),
>   }, {
>   DRV_PTR(fimc_driver, CONFIG_DRM_EXYNOS_FIMC),
> + DRM_COMPONENT_DRIVER | DRM_SHARED_DEVICE,
>   }, {
>   DRV_PTR(rotator_driver, CONFIG_DRM_EXYNOS_ROTATOR),
>   DRM_COMPONENT_DRIVER
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c 
> b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
> index 5b18b5c5fdf2..870f14b775b5 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
> @@ -12,6 +12,7 @@
>   *
>   */
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -24,8 +25,9 @@
>  #include 
>  #include "regs-fimc.h"
>  #include "exynos_drm_drv.h"
> +#include "exynos_drm_iommu.h"
>  #include "exynos_drm_ipp.h"
> -#include "exynos_drm_fimc.h"
> +
>  
>  /*
>   * FIMC stands for Fully Interactive Mobile Camera and
> @@ -33,23 +35,6 @@
>   * input DMA reads image data from the memory.
>   * output DMA writes image data to memory.
>   * FIMC supports image rotation and image effect functions.
> - *
> - * M2M operation : supports crop/scale/rotation/csc so on.
> - * Memory > FIMC H/W > Memory.
> - * Writeback operation : supports cloned screen with FIMD.
> - * FIMD > FIMC H/W > Memory.
> - * Output operation : supports direct display using local path.
> - * Memory > FIMC H/W > FIMD.
> - */
> -
> -/*
> - * TODO
> - * 1. check suspend/resume api if needed.
> - * 2. need to check use case platform_device_id.
> - * 3. check src/dst size with, height.
> - * 4. added check_prepare api for right register.
> - * 5. need to add supported list in prop_list.
> - * 6. check prescaler/scaler optimization.
>   */
>  
>  #define FIMC_MAX_DEVS4
> @@ -59,29 +44,15 @@
>  #define FIMC_BUF_STOP1
>  #define FIMC_BUF_START   2
>  #define FIMC_WIDTH_ITU_709   1280
> -#define FIMC_REFRESH_MAX 60
> -#define FIMC_REFRESH_MIN 12
> -#define FIMC_CROP_MAX8192
> -#define FIMC_CROP_MIN32
> -#define FIMC_SCALE_MAX   4224
> -#define FIMC_SCALE_MIN   32
> +#define FIMC_AUTOSUSPEND_DELAY   2000
>  
>  #define get_fimc_context(dev)
> platform_get_drvdata(to_platform_device(dev))
> -#define get_ctx_from_ippdrv(ippdrv)  container_of(ippdrv,\
> - struct fimc_context, ippdrv);
> -enum fimc_wb {
> - FIMC_WB_NONE,
> - FIMC_WB_A,
> - FIMC_WB_B,
> -};
>  
>  enum {
>   FIMC_CLK_LCLK,
>   FIMC_CLK_GATE,
>   FIMC_CLK_WB_A,
>   FIMC_CLK_WB_B,
> - FIMC_CLK_MUX,
> - FIMC_CLK_PARENT,
>   FIMC_CLKS_MAX
>  };
>  
> @@ -90,8 +61,6 @@ static const char * const fimc_clock_names[] = {
>   [FIMC_CLK_GATE]   = "fimc",
>   [FIMC_CLK_WB_A]   = "pxl_async0",
>   [FIMC_CLK_WB_B]   = "pxl_async1",
> - [FIMC_CLK_MUX]= "mux",
> - [FIMC_CLK_PARENT] = "parent",
>  };
>  
>  #define FIMC_DEFAULT_LCLK_FREQUENCY 13300UL
> @@ -141,31 +110,29 @@ struct fimc_capability {
>  /*
>   * A structure of fimc context.
>   *
> - * @ippdrv: prepare initialization using ippdrv.
>   * @regs_res: register resources.
>   * @regs: memory mapped io registers.
>   * @lock: locking of operations.
>   * @clocks: fimc clocks.
> - * @clk_frequency: LCLK clock frequency.
> - * @sysreg: handle to SYSREG block regmap.
>   * @sc: scaler infomations.
>   * @pol: porarity of writeback.
>   * @id: fimc id.
>   * @irq: irq number.
> - * @suspended: qos operations.
>   */
>  struct fimc_context {
> - struct 

Re: [PATCH v3 6/9] drm/exynos: fimc: Convert driver to IPP v2 core API

2017-10-18 Thread kbuild test robot
Hi Marek,

[auto build test ERROR on robh/for-next]
[also build test ERROR on v4.14-rc5 next-20171017]
[cannot apply to drm-exynos/exynos-drm/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/Marek-Szyprowski/Exynos-DRM-rewrite-IPP-subsystem-and-userspace-API/20171017-211928
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: arm-allyesconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
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=arm 

Note: the 
linux-review/Marek-Szyprowski/Exynos-DRM-rewrite-IPP-subsystem-and-userspace-API/20171017-211928
 HEAD 57651df66b6c59b10ecb5e6a2048c05cc273afa9 builds fine.
  It only hurts bisectibility.

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/exynos/exynos_drm_fimc.c:1255:4: error: implicit declaration 
>> of function 'IPP_SCALE_LIMIT' [-Werror=implicit-function-declaration]
 { IPP_SCALE_LIMIT(.h = { (1 << 16) / 64, (1 << 16) * 64},
   ^~~
>> drivers/gpu/drm/exynos/exynos_drm_fimc.c:1255:20: error: expected expression 
>> before '.' token
 { IPP_SCALE_LIMIT(.h = { (1 << 16) / 64, (1 << 16) * 64},
   ^
   drivers/gpu/drm/exynos/exynos_drm_fimc.c:1264:20: error: expected expression 
before '.' token
 { IPP_SCALE_LIMIT(.h = { (1 << 16) / 64, (1 << 16) * 64},
   ^
>> drivers/gpu/drm/exynos/exynos_drm_fimc.c:1264:20: error: '(const struct 
>> drm_exynos_ipp_limit *)&' is a pointer; did you mean 
>> to use '->'?
>> drivers/gpu/drm/exynos/exynos_drm_fimc.c:1264:4: error: initializer element 
>> is not constant
 { IPP_SCALE_LIMIT(.h = { (1 << 16) / 64, (1 << 16) * 64},
   ^~~
   drivers/gpu/drm/exynos/exynos_drm_fimc.c:1264:4: note: (near initialization 
for 'fimc_4210_limits_v2[3].type')
   cc1: some warnings being treated as errors

vim +/IPP_SCALE_LIMIT +1255 drivers/gpu/drm/exynos/exynos_drm_fimc.c

  1250  
  1251  static const struct drm_exynos_ipp_limit fimc_4210_limits_v1[] = {
  1252  { IPP_SIZE_LIMIT(BUFFER, .h = {32, 8192, 8}, .v = {32, 8192, 
2}) },
  1253  { IPP_SIZE_LIMIT(AREA, .h = {32, 4224, 2}, .v = {32, 0, 2}) },
  1254  { IPP_SIZE_LIMIT(ROTATED, .h = {128, 1920}, .v = {128, 0}) },
> 1255  { IPP_SCALE_LIMIT(.h = { (1 << 16) / 64, (1 << 16) * 64},
  1256.v = { (1 << 16) / 64, (1 << 16) * 64}) },
  1257  { }
  1258  };
  1259  
  1260  static const struct drm_exynos_ipp_limit fimc_4210_limits_v2[] = {
  1261  { IPP_SIZE_LIMIT(BUFFER, .h = {32, 8192, 8}, .v = {32, 8192, 
2}) },
  1262  { IPP_SIZE_LIMIT(AREA, .h = {32, 1920, 2}, .v = {32, 0, 2}) },
  1263  { IPP_SIZE_LIMIT(ROTATED, .h = {128, 1366}, .v = {128, 0}) },
> 1264  { IPP_SCALE_LIMIT(.h = { (1 << 16) / 64, (1 << 16) * 64},
  1265.v = { (1 << 16) / 64, (1 << 16) * 64}) },
  1266  { }
  1267  };
  1268  

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


.config.gz
Description: application/gzip
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 6/9] drm/exynos: fimc: Convert driver to IPP v2 core API

2017-10-17 Thread Marek Szyprowski
This patch adapts Exynos DRM rotator driver to new IPP v2 core API.
The side effect of this conversion is a switch to driver component API
to register properly in the Exynos DRM core.

Signed-off-by: Marek Szyprowski 
---
 drivers/gpu/drm/exynos/Kconfig   |   2 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.c  |   1 +
 drivers/gpu/drm/exynos/exynos_drm_fimc.c | 930 ++-
 drivers/gpu/drm/exynos/exynos_drm_fimc.h |  23 -
 4 files changed, 282 insertions(+), 674 deletions(-)
 delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_fimc.h

diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig
index 4bb9edb00601..33ef84be2d7f 100644
--- a/drivers/gpu/drm/exynos/Kconfig
+++ b/drivers/gpu/drm/exynos/Kconfig
@@ -99,7 +99,7 @@ config DRM_EXYNOS_IPP
 
 config DRM_EXYNOS_FIMC
bool "FIMC"
-   depends on BROKEN && MFD_SYSCON
+   select DRM_EXYNOS_IPP
help
  Choose this option if you want to use Exynos FIMC for DRM.
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 60ae6ae06eb2..4afeffa024f3 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -256,6 +256,7 @@ static struct exynos_drm_driver_info exynos_drm_drivers[] = 
{
DRV_PTR(g2d_driver, CONFIG_DRM_EXYNOS_G2D),
}, {
DRV_PTR(fimc_driver, CONFIG_DRM_EXYNOS_FIMC),
+   DRM_COMPONENT_DRIVER | DRM_SHARED_DEVICE,
}, {
DRV_PTR(rotator_driver, CONFIG_DRM_EXYNOS_ROTATOR),
DRM_COMPONENT_DRIVER
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
index 5b18b5c5fdf2..870f14b775b5 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
@@ -12,6 +12,7 @@
  *
  */
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -24,8 +25,9 @@
 #include 
 #include "regs-fimc.h"
 #include "exynos_drm_drv.h"
+#include "exynos_drm_iommu.h"
 #include "exynos_drm_ipp.h"
-#include "exynos_drm_fimc.h"
+
 
 /*
  * FIMC stands for Fully Interactive Mobile Camera and
@@ -33,23 +35,6 @@
  * input DMA reads image data from the memory.
  * output DMA writes image data to memory.
  * FIMC supports image rotation and image effect functions.
- *
- * M2M operation : supports crop/scale/rotation/csc so on.
- * Memory > FIMC H/W > Memory.
- * Writeback operation : supports cloned screen with FIMD.
- * FIMD > FIMC H/W > Memory.
- * Output operation : supports direct display using local path.
- * Memory > FIMC H/W > FIMD.
- */
-
-/*
- * TODO
- * 1. check suspend/resume api if needed.
- * 2. need to check use case platform_device_id.
- * 3. check src/dst size with, height.
- * 4. added check_prepare api for right register.
- * 5. need to add supported list in prop_list.
- * 6. check prescaler/scaler optimization.
  */
 
 #define FIMC_MAX_DEVS  4
@@ -59,29 +44,15 @@
 #define FIMC_BUF_STOP  1
 #define FIMC_BUF_START 2
 #define FIMC_WIDTH_ITU_709 1280
-#define FIMC_REFRESH_MAX   60
-#define FIMC_REFRESH_MIN   12
-#define FIMC_CROP_MAX  8192
-#define FIMC_CROP_MIN  32
-#define FIMC_SCALE_MAX 4224
-#define FIMC_SCALE_MIN 32
+#define FIMC_AUTOSUSPEND_DELAY 2000
 
 #define get_fimc_context(dev)  platform_get_drvdata(to_platform_device(dev))
-#define get_ctx_from_ippdrv(ippdrv)container_of(ippdrv,\
-   struct fimc_context, ippdrv);
-enum fimc_wb {
-   FIMC_WB_NONE,
-   FIMC_WB_A,
-   FIMC_WB_B,
-};
 
 enum {
FIMC_CLK_LCLK,
FIMC_CLK_GATE,
FIMC_CLK_WB_A,
FIMC_CLK_WB_B,
-   FIMC_CLK_MUX,
-   FIMC_CLK_PARENT,
FIMC_CLKS_MAX
 };
 
@@ -90,8 +61,6 @@ static const char * const fimc_clock_names[] = {
[FIMC_CLK_GATE]   = "fimc",
[FIMC_CLK_WB_A]   = "pxl_async0",
[FIMC_CLK_WB_B]   = "pxl_async1",
-   [FIMC_CLK_MUX]= "mux",
-   [FIMC_CLK_PARENT] = "parent",
 };
 
 #define FIMC_DEFAULT_LCLK_FREQUENCY 13300UL
@@ -141,31 +110,29 @@ struct fimc_capability {
 /*
  * A structure of fimc context.
  *
- * @ippdrv: prepare initialization using ippdrv.
  * @regs_res: register resources.
  * @regs: memory mapped io registers.
  * @lock: locking of operations.
  * @clocks: fimc clocks.
- * @clk_frequency: LCLK clock frequency.
- * @sysreg: handle to SYSREG block regmap.
  * @sc: scaler infomations.
  * @pol: porarity of writeback.
  * @id: fimc id.
  * @irq: irq number.
- * @suspended: qos operations.
  */
 struct fimc_context {
-   struct exynos_drm_ippdrvippdrv;
+   struct exynos_drm_ipp ipp;
+   struct drm_device *drm_dev;
+   struct device   *dev;
+   struct exynos_drm_ipp_task  *task;
+   struct exynos_drm_ipp_formats   *formats;
+
struct resource *regs_res;
void __iomem*regs;
spinlock_t  lock;
struct clk