add ipp subsystem and each ipp drivers
Subsystems (4)
cover add ipp subsystem and each ipp drivers
Hi All.
I am responsible for a display part from Samsung Electronics Telecommunication Division. and I am going to add post-processing features in exynos drm.
If you have some opinion of this patch,
please give some comments about my patch.
IPP is stands for Image Post Processing and supports image scaler/rotator and input/output DMA operations using IPP drivers(FIMC, Rotator, GSC, SC, so on.) IPP is integration device driver of same attibute hardware.
IPP drivers supports Memory to Memory operations with various converting. and some drivers supports Writeback and Display output operations using local path. User can make converted image using this driver.
and also supports streaming concept for multimedia data processing.
And supports various operations
1. Scale operation generates various sizes of image.
2. CSC(Color Space Conversion) operation supports format converting.
3. Crop operation supports cutting the image.
4. Rotate operation supports to 90, 180, 270 degree.
5. Flip operation supports to vertical, horizontal, and both.
6. Writeback operation genertates cloned image from display controller(FIMD).
7. Display output operation support various format display to display controller(FIMD).
8. Input DMA reads image data from the memory.
9. Output DMA writes image data to memory.
10. Supports image effect functions.
Descriptions)
User should make property informations and set this property to registers.
and IPP subsystem manages property id using command node and make queue list using memory node. IPP subsystem supports register function of IPP drivers.
IPP driver manages input/output DMA with various operations. and some driver supports optional operations(writeback, output).
IPP driver needs various informations, so User set property information to IPP driver. and also IPP driver needs memory base address of image for various operations. User doesn't know its address, so fills the gem handle of that memory than address of image base. and than IPP driver start operation.
We adds four ioctls and one event for IPP subsystem.
Basic control flow is same as below
Open -> Get properties -> User choose IPP driver and set property information -> Set Property -> Create gem handle -> Queue buffer(Enqueue) of source/destination -> Command control(Play) -> Event occured to User
-> User handle converted image -> (Queue buffer(Enqueue) of source/destination -> Event occured to User)*N -> Queue buffer(Dequeue) of source/destination -> Command control(Stop) -> Free gem handle -> Close
- ioctlsDRM_EXYNOS_IPP_GET_PROPERTY : get ipp driver capabilitis and id. DRM_EXYNOS_IPP_SET_PROPERTY : set format, position, rotation, flip about source/destination. DRM_EXYNOS_IPP_QUEUE_BUF : enqueue/dequeue buffer and make event list. DRM_EXYNOS_IPP_CMD_CTRL : play/stop/pause/resume control.
- eventDRM_EXYNOS_IPP_EVENT : event to give notification completion of buffer DMA with buffer list
Eunchul Kim (4):
drm/exynos: add ipp subsystem
drm/exynos: add fimc ipp driver
drm/exynos: add rotator ipp driver
drm/exynos: add gsc ipp driver
drivers/gpu/drm/exynos/Kconfig | 24 + drivers/gpu/drm/exynos/Makefile | 4 + drivers/gpu/drm/exynos/exynos_drm_drv.c | 69 + drivers/gpu/drm/exynos/exynos_drm_drv.h | 10 + drivers/gpu/drm/exynos/exynos_drm_fimc.c | 2041 +++++++++++++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_fimc.h | 35 + drivers/gpu/drm/exynos/exynos_drm_gsc.c | 1476 +++++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_gsc.h | 35 + drivers/gpu/drm/exynos/exynos_drm_ipp.c | 1937 +++++++++++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_ipp.h | 268 ++++ drivers/gpu/drm/exynos/exynos_drm_rotator.c | 801 +++++++++++ drivers/gpu/drm/exynos/exynos_drm_rotator.h | 13 + drivers/gpu/drm/exynos/regs-fimc.h | 669 +++++++++ drivers/gpu/drm/exynos/regs-gsc.h | 295 ++++ drivers/gpu/drm/exynos/regs-rotator.h | 73 + include/drm/exynos_drm.h | 33 + include/uapi/drm/exynos_drm.h | 189 +++ 17 files changed, 7972 insertions(+), 0 deletions(-) create mode 100644 drivers/gpu/drm/exynos/exynos_drm_fimc.c create mode 100644 drivers/gpu/drm/exynos/exynos_drm_fimc.h create mode 100644 drivers/gpu/drm/exynos/exynos_drm_gsc.c create mode 100644 drivers/gpu/drm/exynos/exynos_drm_gsc.h create mode 100644 drivers/gpu/drm/exynos/exynos_drm_ipp.c create mode 100644 drivers/gpu/drm/exynos/exynos_drm_ipp.h create mode 100644 drivers/gpu/drm/exynos/exynos_drm_rotator.c create mode 100644 drivers/gpu/drm/exynos/exynos_drm_rotator.h create mode 100644 drivers/gpu/drm/exynos/regs-fimc.h create mode 100644 drivers/gpu/drm/exynos/regs-gsc.h create mode 100644 drivers/gpu/drm/exynos/regs-rotator.h
PATCH 1/4 drm/exynos: add ipp subsystem
IPP stand for Image Post Processing and supports image scaler/rotator /crop/flip/csc(color space conversion) and input/output DMA operations using ipp drivers. also supports writeback and display output operations.
ipp driver include FIMC, Rotator, GSC, SC, so on.
and ipp is integration device driver for each hardware.
--- drivers/gpu/drm/exynos/Kconfig | 6 + drivers/gpu/drm/exynos/Makefile | 1 + drivers/gpu/drm/exynos/exynos_drm_drv.c | 24 + drivers/gpu/drm/exynos/exynos_drm_drv.h | 7 + drivers/gpu/drm/exynos/exynos_drm_ipp.c | 1937 +++++++++++++++++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_ipp.h | 268 +++++ include/uapi/drm/exynos_drm.h | 189 +++ 7 files changed, 2432 insertions(+), 0 deletions(-) create mode 100644 drivers/gpu/drm/exynos/exynos_drm_ipp.c create mode 100644 drivers/gpu/drm/exynos/exynos_drm_ipp.h
drivers/gpu/drm/exynos/Kconfig +6 -0
@@ -39,3 +39,9 @@ config DRM_EXYNOS_G2D depends on DRM_EXYNOS && !VIDEO_SAMSUNG_S5P_G2D help Choose this option if you want to use Exynos G2D for DRM. + +config DRM_EXYNOS_IPP + bool "Exynos DRM IPP" + depends on DRM_EXYNOS + help + Choose this option if you want to use IPP feature for DRM.
drivers/gpu/drm/exynos/Makefile +1 -0
@@ -15,5 +15,6 @@ exynosdrm-$(CONFIG_DRM_EXYNOS_HDMI) += exynos_hdmi.o exynos_mixer.o \ exynos_drm_hdmi.o exynosdrm-$(CONFIG_DRM_EXYNOS_VIDI) += exynos_drm_vidi.o exynosdrm-$(CONFIG_DRM_EXYNOS_G2D) += exynos_drm_g2d.o +exynosdrm-$(CONFIG_DRM_EXYNOS_IPP) += exynos_drm_ipp.o obj-$(CONFIG_DRM_EXYNOS) += exynosdrm.o
drivers/gpu/drm/exynos/exynos_drm_drv.c +24 -0
@@ -40,6 +40,7 @@#include "exynos_drm_vidi.h" #include "exynos_drm_dmabuf.h" #include "exynos_drm_g2d.h" +#include "exynos_drm_ipp.h" #define DRIVER_NAME "exynos"#define DRIVER_DESC "Samsung SoC DRM"
@@ -232,6 +233,14 @@ static struct drm_ioctl_desc exynos_ioctls[] = { exynos_g2d_set_cmdlist_ioctl, DRM_UNLOCKED | DRM_AUTH),DRM_IOCTL_DEF_DRV (EXYNOS_G2D_EXEC , exynos_g2d_exec_ioctl,DRM_UNLOCKED |DRM_AUTH ), +DRM_IOCTL_DEF_DRV (EXYNOS_IPP_GET_PROPERTY , + exynos_drm_ipp_get_property,DRM_UNLOCKED |DRM_AUTH ), +DRM_IOCTL_DEF_DRV (EXYNOS_IPP_SET_PROPERTY , + exynos_drm_ipp_set_property,DRM_UNLOCKED |DRM_AUTH ), +DRM_IOCTL_DEF_DRV (EXYNOS_IPP_QUEUE_BUF , + exynos_drm_ipp_queue_buf,DRM_UNLOCKED |DRM_AUTH ), +DRM_IOCTL_DEF_DRV (EXYNOS_IPP_CMD_CTRL , + exynos_drm_ipp_cmd_ctrl, DRM_UNLOCKED | DRM_AUTH), }; static const struct file_operations exynos_drm_driver_fops = {
@@ -346,6 +355,12 @@ static int __init exynos_drm_init(void) goto out_g2d;#endif +#ifdef CONFIG_DRM_EXYNOS_IPP + ret =platform_driver_register (&ipp_driver); +if (ret <0 ) + goto out_ipp; +#endif + ret =platform_driver_register (&exynos_drm_platform_driver);if (ret <0 ) goto out_drm;
@@ -363,6 +378,11 @@ out:platform_driver_unregister (&exynos_drm_platform_driver); out_drm: +#ifdef CONFIG_DRM_EXYNOS_IPP +platform_driver_unregister (&ipp_driver); +out_ipp: +#endif +#ifdef CONFIG_DRM_EXYNOS_G2D platform_driver_unregister (&g2d_driver); out_g2d:
@@ -399,6 +419,10 @@ static void __exit exynos_drm_exit(void)platform_driver_unregister (&exynos_drm_platform_driver); +#ifdef CONFIG_DRM_EXYNOS_IPP +platform_driver_unregister (&ipp_driver); +#endif +#ifdef CONFIG_DRM_EXYNOS_G2D platform_driver_unregister (&g2d_driver);#endif
drivers/gpu/drm/exynos/exynos_drm_drv.h +7 -0
@@ -235,8 +235,14 @@ struct exynos_drm_g2d_private {unsigned int gem_nr; }; +struct exynos_drm_ipp_private { +struct device *dev; +struct list_head event_list; +}; +struct drm_exynos_file_private {struct exynos_drm_g2d_private *g2d_priv; +struct exynos_drm_ipp_private *ipp_priv; };/*
@@ -335,4 +341,5 @@ extern struct platform_driver mixer_driver;extern struct platform_driver exynos_drm_common_hdmi_driver;extern struct platform_driver vidi_driver;extern struct platform_driver g2d_driver; +extern struct platform_driver ipp_driver;#endif
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +1937 -0
1,937 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_drm_ipp.h new file +268 -0
268 lines not on this page · raw message
include/uapi/drm/exynos_drm.h +189 -0
213 lines not on this page · raw message
Signature · 1 line
1.7.0.4
Inki Dae
maintainerRe: [PATCH 1/4] drm/exynos: add ipp subsystem
below is quick review.
2012/10/18 Eunchul Kim <[email protected]>:
Quoted 222 lines
IPP stand for Image Post Processing and supports image scaler/rotator /crop/flip/csc(color space conversion) and input/output DMA operations using ipp drivers. also supports writeback and display output operations.
ipp driver include FIMC, Rotator, GSC, SC, so on.
and ipp is integration device driver for each hardware.Signed-off-by Eunchul Kim <[email protected]>Signed-off-by Jinyoung Jeon <[email protected]>--- drivers/gpu/drm/exynos/Kconfig | 6 + drivers/gpu/drm/exynos/Makefile | 1 + drivers/gpu/drm/exynos/exynos_drm_drv.c | 24 + drivers/gpu/drm/exynos/exynos_drm_drv.h | 7 + drivers/gpu/drm/exynos/exynos_drm_ipp.c | 1937 +++++++++++++++++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_ipp.h | 268 +++++ include/uapi/drm/exynos_drm.h | 189 +++ 7 files changed, 2432 insertions(+), 0 deletions(-) create mode 100644 drivers/gpu/drm/exynos/exynos_drm_ipp.c create mode 100644 drivers/gpu/drm/exynos/exynos_drm_ipp.hdrivers/gpu/drm/exynos/Kconfig +6
-0@@ -39,3 +39,9 @@ config DRM_EXYNOS_G2D depends on DRM_EXYNOS && !VIDEO_SAMSUNG_S5P_G2D help Choose this option if you want to use Exynos G2D for DRM. + +config DRM_EXYNOS_IPP + bool "Exynos DRM IPP" + depends on DRM_EXYNOS + help + Choose this option if you want to use IPP feature for DRM.drivers/gpu/drm/exynos/Makefile +1
-0@@ -15,5 +15,6 @@ exynosdrm-$(CONFIG_DRM_EXYNOS_HDMI) += exynos_hdmi.o exynos_mixer.o \ exynos_drm_hdmi.o exynosdrm-$(CONFIG_DRM_EXYNOS_VIDI) += exynos_drm_vidi.o exynosdrm-$(CONFIG_DRM_EXYNOS_G2D) += exynos_drm_g2d.o +exynosdrm-$(CONFIG_DRM_EXYNOS_IPP) += exynos_drm_ipp.o obj-$(CONFIG_DRM_EXYNOS) += exynosdrm.odrivers/gpu/drm/exynos/exynos_drm_drv.c +24
-0@@ -40,6 +40,7 @@#include "exynos_drm_vidi.h" #include "exynos_drm_dmabuf.h" #include "exynos_drm_g2d.h" +#include "exynos_drm_ipp.h" #define DRIVER_NAME "exynos"#define DRIVER_DESC "Samsung SoC DRM"@@ -232,6 +233,14 @@ static struct drm_ioctl_desc exynos_ioctls[] = { exynos_g2d_set_cmdlist_ioctl, DRM_UNLOCKED | DRM_AUTH),DRM_IOCTL_DEF_DRV (EXYNOS_G2D_EXEC , exynos_g2d_exec_ioctl,DRM_UNLOCKED |DRM_AUTH ), +DRM_IOCTL_DEF_DRV (EXYNOS_IPP_GET_PROPERTY , + exynos_drm_ipp_get_property,DRM_UNLOCKED |DRM_AUTH ), +DRM_IOCTL_DEF_DRV (EXYNOS_IPP_SET_PROPERTY , + exynos_drm_ipp_set_property,DRM_UNLOCKED |DRM_AUTH ), +DRM_IOCTL_DEF_DRV (EXYNOS_IPP_QUEUE_BUF , + exynos_drm_ipp_queue_buf,DRM_UNLOCKED |DRM_AUTH ), +DRM_IOCTL_DEF_DRV (EXYNOS_IPP_CMD_CTRL , + exynos_drm_ipp_cmd_ctrl, DRM_UNLOCKED | DRM_AUTH), }; static const struct file_operations exynos_drm_driver_fops = {@@ -346,6 +355,12 @@ static int __init exynos_drm_init(void) goto out_g2d;#endif +#ifdef CONFIG_DRM_EXYNOS_IPP + ret =platform_driver_register (&ipp_driver); +if (ret <0 ) + goto out_ipp; +#endif + ret =platform_driver_register (&exynos_drm_platform_driver);if (ret <0 ) goto out_drm;@@ -363,6 +378,11 @@ out:platform_driver_unregister (&exynos_drm_platform_driver); out_drm: +#ifdef CONFIG_DRM_EXYNOS_IPP +platform_driver_unregister (&ipp_driver); +out_ipp: +#endif +#ifdef CONFIG_DRM_EXYNOS_G2D platform_driver_unregister (&g2d_driver); out_g2d:@@ -399,6 +419,10 @@ static void __exit exynos_drm_exit(void)platform_driver_unregister (&exynos_drm_platform_driver); +#ifdef CONFIG_DRM_EXYNOS_IPP +platform_driver_unregister (&ipp_driver); +#endif +#ifdef CONFIG_DRM_EXYNOS_G2D platform_driver_unregister (&g2d_driver);#endif drivers/gpu/drm/exynos/exynos_drm_drv.h +7
-0@@ -235,8 +235,14 @@ struct exynos_drm_g2d_private {unsigned int gem_nr; }; +struct exynos_drm_ipp_private { +struct device *dev; +struct list_head event_list; +}; +struct drm_exynos_file_private {struct exynos_drm_g2d_private *g2d_priv; +struct exynos_drm_ipp_private *ipp_priv; };/* @@ -335,4 +341,5 @@ extern struct platform_driver mixer_driver;extern struct platform_driver exynos_drm_common_hdmi_driver;extern struct platform_driver vidi_driver;extern struct platform_driver g2d_driver; +extern struct platform_driver ipp_driver;#endif drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +83
-0@@ -0,0 +1,1937 @@ +/* +* Copyright (C) 2012 Samsung Electronics Co.Ltd +* Authors: +* Eunchul Kim <[email protected]> +* Jinyoung Jeon <[email protected]> +* Sangmin Lee <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +*/ +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/clk.h> +#include <linux/pm_runtime.h> +#include <plat/map-base.h> + +#include <drm/drmP.h> +#include <drm/exynos_drm.h> +#include "exynos_drm_drv.h" +#include "exynos_drm_gem.h" +#include "exynos_drm_ipp.h" + +/* +* IPP is stand for Image Post Processing and +* supports image scaler/rotator and input/output DMA operations. +* using FIMC, GSC, Rotator, so on. +* IPP is integration device driver of same attribute h/w +*/ + +#define get_ipp_context (dev) platform_get_drvdata(to_platform_device(dev)) + +/* +* A structure of event. +* +* @base: base of event. +* @event: ipp event. +*/ +struct drm_exynos_ipp_send_event { +struct drm_pending_event base; +struct drm_exynos_ipp_event event; +}; + +/* +* A structure of memory node. +* +* @list: list head to memory queue information. +* @ops_id: id of operations. +* @prop_id: id of property. +* @buf_id: id of buffer. +* @buf_info: gem objects and dma address, size. +*/ +struct drm_exynos_ipp_mem_node { +struct list_head list; +enum drm_exynos_ops_id ops_id; +u32 prop_id; +u32 buf_id; +struct drm_exynos_ipp_buf_info buf_info; +}; + +/* +* A structure of ipp context. +* +* @subdrv: prepare initialization using subdrv. +* @ipp_lock: lock for synchronization of access to ipp_idr. +* @prop_lock: lock for synchronization of access to prop_idr. +* @ipp_idr: ipp driver idr. +* @prop_idr: property idr. +* @event_workq: event work queue. +* @cmd_workq: command work queue. +*/ +struct ipp_context { +struct exynos_drm_subdrv subdrv; +spinlock_t ipp_lock; +spinlock_t prop_lock; +struct idr ipp_idr; +struct idr prop_idr; +struct workqueue_struct *event_workq; +struct workqueue_struct *cmd_workq; +};
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 93
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +10
-0+ +static LIST_HEAD (exynos_drm_ippdrv_list); +static BLOCKING_NOTIFIER_HEAD (exynos_drm_ippnb_list); + +int exynos_drm_ippdrv_register (struct exynos_drm_ippdrv *ippdrv) +{ +DRM_DEBUG_KMS ("%s\n" , __func__); + +if (!ippdrv) +return -EINVAL ;
ippdrv can't be null.
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 95
Quoted 2 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +2
-0+ +list_add_tail (&ippdrv->drv_list, &exynos_drm_ippdrv_list);
Isn't exynos_drm_ippdrv_list global? add mutex_lock/unlock.
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 107
Quoted 12 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +12
-0+ +return 0 ; +} +EXPORT_SYMBOL_GPL (exynos_drm_ippdrv_register); + +int exynos_drm_ippdrv_unregister (struct exynos_drm_ippdrv *ippdrv) +{ +DRM_DEBUG_KMS ("%s\n" , __func__); + +if (!ippdrv) +return -EINVAL ; +
ditto.
Quoted 12 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +12
-0+list_del (&ippdrv->drv_list); + +return 0 ; +} +EXPORT_SYMBOL_GPL (exynos_drm_ippdrv_unregister); + +static int ipp_create_id (struct idr *id_idr,spinlock_t *lock,void *obj, +u32 *idp) +{ +int ret = -EINVAL ; + +DRM_DEBUG_KMS ("%s\n" , __func__);
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 129
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +10
-0+ +again: +/* ensure there is space available to allocate a handle */ +if (idr_pre_get (id_idr,GFP_KERNEL ) ==0 ) +return -ENOMEM ; + +/* do the allocation under our spinlock */ +spin_lock (lock); + ret =idr_get_new_above (id_idr, obj,1 , (int *)idp); +spin_unlock (lock);
Is there any reason to use spin_lock? Please, refrain from using spin lock.
Quoted 12 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +12
-0+if (ret == -EAGAIN ) + goto again; + +return ret; +} + +static void *ipp_find_id (struct idr *id_idr,spinlock_t *lock,u32 id) +{ +void *obj; + +DRM_DEBUG_KMS ("%s:id[%d]\n" , __func__, id); +
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 151
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +10
-0+spin_lock (lock); + +/* find object using handle */ + obj =idr_find (id_idr, id); +if (obj ==NULL ) { +spin_unlock (lock); +return NULL ; + } + +spin_unlock (lock);
ditto.
Quoted 59 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +59
-0+ +return obj; +} + +static struct exynos_drm_ippdrv *ipp_find_driver (struct ipp_context *ctx, +struct drm_exynos_ipp_property *property) +{ +struct exynos_drm_ippdrv *ippdrv; +u32 ipp_id = property->ipp_id; + +DRM_DEBUG_KMS ("%s:ipp_id[%d]\n" , __func__, ipp_id); + +if (ipp_id) { +/* find ipp driver */ + ippdrv =ipp_find_id (&ctx->ipp_idr, &ctx->ipp_lock, + ipp_id); +if (!ippdrv) { +DRM_ERROR ("not found ipp%d driver.\n" , ipp_id); + goto err_null; + } + +/* check dedicated state */ +if (ippdrv->dedicated) { +DRM_ERROR ("used choose device.\n" ); + goto err_null; + } + +if (property->cmd !=IPP_CMD_M2M + && !pm_runtime_suspended (ippdrv->dev)) { +DRM_ERROR ("can't run dedicatedly.\n" ); + goto err_null; + } + +/* check property */ +if (ippdrv->check_property && + ippdrv->check_property (ippdrv->dev, property)) { +DRM_ERROR ("not support property.\n" ); + goto err_null; + } + +return ippdrv; + }else { +/* get ipp driver entry */ +list_for_each_entry (ippdrv, &exynos_drm_ippdrv_list, drv_list) { +/* check dedicated state */ +if (ippdrv->dedicated) +continue ; + +if (property->cmd !=IPP_CMD_M2M + && !pm_runtime_suspended (ippdrv->dev)) { +DRM_DEBUG_KMS ("%s:can't run dedicatedly.\n" , + __func__); +continue ; + } + +/* check property */ +if (ippdrv->check_property && + ippdrv->check_property (ippdrv->dev, property)) { + DRM_DEBUG_KMS("%s:not support property.\n",
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 220
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +10
-0+ __func__); +continue ; + } + +return ippdrv; + } + +DRM_ERROR ("not support ipp driver operations.\n" ); + } +
return ERR_PTR(proper error type) and share duplicated codes.
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 232
Quoted 12 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +12
-0+err_null: +return NULL ; +} + +static struct exynos_drm_ippdrv *ipp_find_drv_node (u32 prop_id) +{ +struct exynos_drm_ippdrv *ippdrv; +struct drm_exynos_ipp_cmd_node *c_node; +int count =0 ; + +DRM_DEBUG_KMS ("%s:prop_id[%d]\n" , __func__, prop_id); +
add mutex lock.
Quoted 57 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +57
-0+if (list_empty (&exynos_drm_ippdrv_list)) { +DRM_DEBUG_KMS ("%s:ippdrv_list is empty.\n" , + __func__); +return NULL ; + } + +list_for_each_entry (ippdrv, &exynos_drm_ippdrv_list, drv_list) { +DRM_DEBUG_KMS ("%s:count[%d]ippdrv[0x%x]\n" , + __func__, count++, (int )ippdrv); + +if (!list_empty (&ippdrv->cmd_list)) { +list_for_each_entry (c_node, &ippdrv->cmd_list, list) { +if (c_node->property.prop_id == prop_id) +return ippdrv; + } + } + } + +return NULL ; +} + +int exynos_drm_ipp_get_property (struct drm_device *drm_dev,void *data, +struct drm_file *file) +{ +struct drm_exynos_file_private *file_priv = file->driver_priv; +struct exynos_drm_ipp_private *priv = file_priv->ipp_priv; +struct device *dev = priv->dev; +struct ipp_context *ctx =get_ipp_context (dev); +struct drm_exynos_ipp_prop_list *prop_list = data; +struct exynos_drm_ippdrv *ippdrv; +int count =0 ; + +DRM_DEBUG_KMS ("%s\n" , __func__); + +if (!ctx) { +DRM_ERROR ("invalid context.\n" ); +return -EINVAL ; + } + +if (!prop_list) { +DRM_ERROR ("invalid property parameter.\n" ); +return -EINVAL ; + } + +DRM_DEBUG_KMS ("%s:ipp_id[%d]\n" , __func__, prop_list->ipp_id); + +if (prop_list->ipp_id ==0 ) { +list_for_each_entry (ippdrv, &exynos_drm_ippdrv_list, drv_list) + count++; + prop_list->count = count; + }else { + ippdrv =ipp_find_id (&ctx->ipp_idr, &ctx->ipp_lock, + prop_list->ipp_id); + +if (!ippdrv) { +DRM_ERROR ("not found ipp%d driver.\n" , + prop_list->ipp_id);
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 299
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +10
-0+return -EINVAL ; + } + + prop_list = ippdrv->prop_list; + } + +return 0 ; +} +EXPORT_SYMBOL_GPL (exynos_drm_ipp_get_property); +
no need symbol export.
Quoted 147 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +147
-0+int exynos_drm_ipp_set_property (struct drm_device *drm_dev,void *data, +struct drm_file *file) +{ +struct drm_exynos_file_private *file_priv = file->driver_priv; +struct exynos_drm_ipp_private *priv = file_priv->ipp_priv; +struct device *dev = priv->dev; +struct ipp_context *ctx =get_ipp_context (dev); +struct drm_exynos_ipp_property *property = data; +struct exynos_drm_ippdrv *ippdrv; +struct drm_exynos_ipp_cmd_node *c_node; +struct drm_exynos_ipp_config *config; +struct drm_exynos_pos *pos; +struct drm_exynos_sz *sz; +int ret, i; + +DRM_DEBUG_KMS ("%s\n" , __func__); + +if (!ctx) { +DRM_ERROR ("invalid context.\n" ); +return -EINVAL ; + } + +if (!property) { +DRM_ERROR ("invalid property parameter.\n" ); +return -EINVAL ; + } + +for_each_ipp_ops (i) { + config = &property->config[i]; + pos = &config->pos; + sz = &config->sz; + +DRM_DEBUG_KMS ("%s:prop_id[%d]ops[%s]fmt[0x%x]\n" , + __func__, property->prop_id, + i ?"dst" :"src" , config->fmt); + +DRM_DEBUG_KMS ("%s:pos[%d %d %d %d]sz[%d %d]f[%d]r[%d]\n" , + __func__, pos->x, pos->y, pos->w, pos->h, + sz->hsize, sz->vsize, config->flip, config->degree); + } + +if (property->prop_id) { + ippdrv =ipp_find_drv_node (property->prop_id); +if (!ippdrv) { +DRM_ERROR ("failed to get ipp driver.\n" ); +return -EINVAL ; + } + +list_for_each_entry (c_node, &ippdrv->cmd_list, list) { +if ((c_node->property.prop_id == + property->prop_id) && + (c_node->state ==IPP_STATE_STOP )) { +DRM_DEBUG_KMS ("%s:found cmd[%d]ippdrv[0x%x]\n" , + __func__, property->cmd, (int )ippdrv); + + c_node->property = *property; +return 0 ; + } + } + +DRM_ERROR ("failed to search property.\n" ); +return -EINVAL ; + } + +/* find ipp driver using ipp id */ + ippdrv =ipp_find_driver (ctx, property); +if (!ippdrv) { +DRM_ERROR ("failed to get ipp driver.\n" ); +return -EINVAL ; + } + +/* allocate command node */ + c_node =kzalloc (sizeof (*c_node),GFP_KERNEL ); +if (!c_node) { +DRM_ERROR ("failed to allocate map node.\n" ); +return -ENOMEM ; + } + +/* create property id */ + ret =ipp_create_id (&ctx->prop_idr, &ctx->prop_lock, c_node, + &property->prop_id); +if (ret) { +DRM_ERROR ("failed to create id.\n" ); + goto err_clear; + } + +DRM_DEBUG_KMS ("%s:created prop_id[%d]cmd[%d]ippdrv[0x%x]\n" , + __func__, property->prop_id, property->cmd, (int )ippdrv); + +/* stored property information and ippdrv in private data */ + c_node->priv = priv; + c_node->property = *property; + c_node->state =IPP_STATE_IDLE ; + + c_node->start_work =kzalloc (sizeof (*c_node->start_work), +GFP_KERNEL ); +if (!c_node->start_work) { +DRM_ERROR ("failed to alloc start_work.\n" ); + ret = -ENOMEM ; + goto err_clear; + } + +INIT_WORK ((struct work_struct *)c_node->start_work, + ipp_sched_cmd); + + c_node->stop_work =kzalloc (sizeof (*c_node->stop_work), +GFP_KERNEL ); +if (!c_node->stop_work) { +DRM_ERROR ("failed to alloc stop_work.\n" ); + ret = -ENOMEM ; + goto err_free_start; + } + +INIT_WORK ((struct work_struct *)c_node->stop_work, + ipp_sched_cmd); + + c_node->event_work =kzalloc (sizeof (*c_node->event_work), +GFP_KERNEL ); +if (!c_node->event_work) { +DRM_ERROR ("failed to alloc event_work.\n" ); + ret = -ENOMEM ; + goto err_free_stop; + } + +INIT_WORK ((struct work_struct *)c_node->event_work, + ipp_sched_event); + +/* init ioctl lock */ +mutex_init (&c_node->cmd_lock); +mutex_init (&c_node->mem_lock); +mutex_init (&c_node->event_lock); +init_completion (&c_node->start_complete); +init_completion (&c_node->stop_complete); + +for_each_ipp_ops (i) +INIT_LIST_HEAD (&c_node->mem_list[i]); + +INIT_LIST_HEAD (&c_node->event_list); +list_splice_init (&priv->event_list, &c_node->event_list); +list_add_tail (&c_node->list, &ippdrv->cmd_list); + +/* make dedicated state without m2m */ +if (property->cmd !=IPP_CMD_M2M ) + ippdrv->dedicated = true; + +return 0 ; +
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 456
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +10
-0+err_free_stop: +kfree (c_node->stop_work); +err_free_start: +kfree (c_node->start_work); +err_clear: +kfree (c_node); +return ret; +} +EXPORT_SYMBOL_GPL (exynos_drm_ipp_set_property); +
no need symbol export.
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 466
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +10
-0+static struct drm_exynos_ipp_mem_node + *ipp_find_mem_node (struct drm_exynos_ipp_cmd_node *c_node, +struct drm_exynos_ipp_queue_buf *qbuf) +{ +struct drm_exynos_ipp_mem_node *m_node; +struct list_head *head; +int count =0 ; + +DRM_DEBUG_KMS ("%s:buf_id[%d]\n" , __func__, qbuf->buf_id); +
no need mutex lock? I think c_node is a member of ctx->ippdrv and ctx is unique to driver.
Quoted 94 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +94
-0+/* source/destination memory list */ + head = &c_node->mem_list[qbuf->ops_id]; + +/* find memory node entry */ +list_for_each_entry (m_node, head, list) { +DRM_DEBUG_KMS ("%s:count[%d]m_node[0x%x]\n" , + __func__, count++, (int )m_node); + +/* compare buffer id */ +if (m_node->buf_id == qbuf->buf_id) +return m_node; + } + +return NULL ; +} + +static int ipp_check_mem_list (struct drm_exynos_ipp_cmd_node *c_node) +{ +struct drm_exynos_ipp_property *property = &c_node->property; +struct drm_exynos_ipp_mem_node *m_node; +struct list_head *head; +int ret, i, count[EXYNOS_DRM_OPS_MAX ] = {0 , }; + +DRM_DEBUG_KMS ("%s\n" , __func__); + +mutex_lock (&c_node->mem_lock); + +for_each_ipp_ops (i) { +/* source/destination memory list */ + head = &c_node->mem_list[i]; + +if (list_empty (head)) { +DRM_DEBUG_KMS ("%s:%s memory empty.\n" , __func__, + i ?"dst" :"src" ); +continue ; + } + +/* find memory node entry */ +list_for_each_entry (m_node, head, list) { +DRM_DEBUG_KMS ("%s:%s,count[%d]m_node[0x%x]\n" , __func__, + i ?"dst" :"src" , count[i], (int )m_node); + count[i]++; + } + } + +DRM_DEBUG_KMS ("%s:min[%d]max[%d]\n" , __func__, +min (count[EXYNOS_DRM_OPS_SRC ], count[EXYNOS_DRM_OPS_DST ]), +max (count[EXYNOS_DRM_OPS_SRC ], count[EXYNOS_DRM_OPS_DST ])); + + +if (property->cmd ==IPP_CMD_M2M ) + ret =min (count[EXYNOS_DRM_OPS_SRC ], + count[EXYNOS_DRM_OPS_DST ]); +else + ret =max (count[EXYNOS_DRM_OPS_SRC ], + count[EXYNOS_DRM_OPS_DST ]); + +mutex_unlock (&c_node->mem_lock); + +return ret; +} + +static void ipp_clean_cmd_node (struct drm_exynos_ipp_cmd_node *c_node) +{ +DRM_DEBUG_KMS ("%s\n" , __func__); + +/* delete list */ +list_del (&c_node->list); + +/* destroy mutex */ +mutex_destroy (&c_node->cmd_lock); +mutex_destroy (&c_node->mem_lock); +mutex_destroy (&c_node->event_lock); + +/* free command node */ +kfree (c_node->start_work); +kfree (c_node->stop_work); +kfree (c_node->event_work); +kfree (c_node); +} + +static int ipp_set_mem_node (struct exynos_drm_ippdrv *ippdrv, +struct drm_exynos_ipp_cmd_node *c_node, +struct drm_exynos_ipp_mem_node *m_node) +{ +struct exynos_drm_ipp_ops *ops =NULL ; +int ret =0 ; + +DRM_DEBUG_KMS ("%s:node[0x%x]\n" , __func__, (int )m_node); + +if (!m_node) { +DRM_ERROR ("invalid queue node.\n" ); +return -EFAULT ; + }
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 570
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +10
-0+ +mutex_lock (&c_node->mem_lock); + +DRM_DEBUG_KMS ("%s:ops_id[%d]\n" , __func__, m_node->ops_id); + +/* get operations callback */ + ops = ippdrv->ops[m_node->ops_id]; +if (!ops) { +DRM_ERROR ("not support ops.\n" ); + ret = -EIO ;
-EFAULT;
Quoted 226 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +226
-0+ goto err_unlock; + } + +/* set address and enable irq */ +if (ops->set_addr) { + ret = ops->set_addr (ippdrv->dev, &m_node->buf_info, + m_node->buf_id,IPP_BUF_ENQUEUE ); +if (ret) { +DRM_ERROR ("failed to set addr.\n" ); + goto err_unlock; + } + } + +err_unlock: +mutex_unlock (&c_node->mem_lock); +return ret; +} + +static struct drm_exynos_ipp_mem_node + *ipp_get_mem_node (struct drm_device *drm_dev, +struct drm_file *file, +struct drm_exynos_ipp_cmd_node *c_node, +struct drm_exynos_ipp_queue_buf *qbuf) +{ +struct drm_exynos_ipp_mem_node *m_node; +struct drm_exynos_ipp_buf_info buf_info; +void *addr; +int i; + +mutex_lock (&c_node->mem_lock); + + m_node =kzalloc (sizeof (*m_node),GFP_KERNEL ); +if (!m_node) { +DRM_ERROR ("failed to allocate queue node.\n" ); + goto err_unlock; + } + +/* clear base address for error handling */ +memset (&buf_info,0x0 ,sizeof (buf_info)); + +/* operations, buffer id */ + m_node->ops_id = qbuf->ops_id; + m_node->prop_id = qbuf->prop_id; + m_node->buf_id = qbuf->buf_id; + +DRM_DEBUG_KMS ("%s:m_node[0x%x]ops_id[%d]\n" , __func__, + (int )m_node, qbuf->ops_id); +DRM_DEBUG_KMS ("%s:prop_id[%d]buf_id[%d]\n" , __func__, + qbuf->prop_id, m_node->buf_id); + +for_each_ipp_planar (i) { +DRM_DEBUG_KMS ("%s:i[%d]handle[0x%x]\n" , __func__, + i, qbuf->handle[i]); + +/* get dma address by handle */ +if (qbuf->handle[i] !=0 ) { + addr =exynos_drm_gem_get_dma_addr (drm_dev, + qbuf->handle[i], file); +if (!addr) { +DRM_ERROR ("failed to get addr.\n" ); + goto err_clear; + } + + buf_info.gem_handle[i] = qbuf->handle[i]; + buf_info.base[i] = *(dma_addr_t *) addr; + buf_info.file = file; +DRM_DEBUG_KMS ("%s:i[%d]base[0x%x]gem_handle[0x%x]\n" , + __func__, i, buf_info.base[i], + buf_info.gem_handle[i]); + } + } + + m_node->buf_info = buf_info; +list_add_tail (&m_node->list, &c_node->mem_list[qbuf->ops_id]); + +mutex_unlock (&c_node->mem_lock); +return m_node; + +err_clear: +kfree (m_node); + +err_unlock: +mutex_unlock (&c_node->mem_lock); + +return NULL ; +} + +static int ipp_put_mem_node (struct drm_device *drm_dev, +struct drm_exynos_ipp_cmd_node *c_node, +struct drm_exynos_ipp_mem_node *m_node) +{ +int i, ret =0 ; + +DRM_DEBUG_KMS ("%s:node[0x%x]\n" , __func__, (int )m_node); + +if (!m_node) { +DRM_ERROR ("invalid dequeue node.\n" ); +return -EFAULT ; + } + +if (list_empty (&m_node->list)) { +DRM_ERROR ("empty memory node.\n" ); +return -ENOMEM ; + } + +mutex_lock (&c_node->mem_lock); + +DRM_DEBUG_KMS ("%s:ops_id[%d]\n" , __func__, m_node->ops_id); + +/* put gem buffer */ +for_each_ipp_planar (i) { +struct drm_file *file = m_node->buf_info.file; +unsigned int gem_handle = m_node->buf_info.gem_handle[i]; + +if (gem_handle) +exynos_drm_gem_put_dma_addr (drm_dev, gem_handle, file); + } + +/* delete list in queue */ +list_del (&m_node->list); +kfree (m_node); + +mutex_unlock (&c_node->mem_lock); +return ret; +} + +static void ipp_free_event (struct drm_pending_event *event) +{ +kfree (event); +} + +static int ipp_get_event (struct drm_device *drm_dev, +struct drm_file *file, +struct drm_exynos_ipp_cmd_node *c_node, +struct drm_exynos_ipp_queue_buf *qbuf) +{ +struct drm_exynos_ipp_send_event *e; +unsigned long flags; + +DRM_DEBUG_KMS ("%s:ops_id[%d]buf_id[%d]\n" , __func__, + qbuf->ops_id, qbuf->buf_id); + + e =kzalloc (sizeof (*e),GFP_KERNEL ); + +if (!e) { +DRM_ERROR ("failed to allocate event.\n" ); +spin_lock_irqsave (&drm_dev->event_lock, flags); + file->event_space +=sizeof (e->event); +spin_unlock_irqrestore (&drm_dev->event_lock, flags); +return -ENOMEM ; + } + +/* make event */ + e->event.base.type =DRM_EXYNOS_IPP_EVENT ; + e->event.base.length =sizeof (e->event); + e->event.user_data = qbuf->user_data; + e->event.prop_id = qbuf->prop_id; + e->event.buf_id[EXYNOS_DRM_OPS_DST ] = qbuf->buf_id; + e->base.event = &e->event.base; + e->base.file_priv = file; + e->base.destroy = ipp_free_event; +list_add_tail (&e->base.link, &c_node->event_list); + +return 0 ; +} + +static void ipp_put_event (struct drm_exynos_ipp_cmd_node *c_node, +struct drm_exynos_ipp_queue_buf *qbuf) +{ +struct drm_exynos_ipp_send_event *e, *te; +int count =0 ; + +if (list_empty (&c_node->event_list)) { +DRM_DEBUG_KMS ("%s:event_list is empty.\n" , __func__); +return ; + } + +list_for_each_entry_safe (e, te, &c_node->event_list, base.link) { +DRM_DEBUG_KMS ("%s:count[%d]e[0x%x]\n" , + __func__, count++, (int )e); + +if (!qbuf) { +/* delete list */ +list_del (&e->base.link); +kfree (e); + }else if (e->event.buf_id[EXYNOS_DRM_OPS_DST ] + == qbuf->buf_id) { +/* delete list */ +list_del (&e->base.link); +kfree (e); +return ; + } + } + +return ; +} + +void ipp_handle_cmd_work (struct device *dev, +struct exynos_drm_ippdrv *ippdrv, +struct drm_exynos_ipp_cmd_work *cmd_work, +struct drm_exynos_ipp_cmd_node *c_node) +{ +struct ipp_context *ctx =get_ipp_context (dev); + + cmd_work->ippdrv = ippdrv; + cmd_work->c_node = c_node; +queue_work (ctx->cmd_workq, (struct work_struct *)cmd_work); +} + +int exynos_drm_ipp_queue_buf (struct drm_device *drm_dev,void *data, +struct drm_file *file) +{ +struct drm_exynos_file_private *file_priv = file->driver_priv; +struct exynos_drm_ipp_private *priv = file_priv->ipp_priv; +struct device *dev = priv->dev; +struct ipp_context *ctx =get_ipp_context (dev); +struct drm_exynos_ipp_queue_buf *qbuf = data; +struct exynos_drm_ippdrv *ippdrv; +struct drm_exynos_ipp_property *property; +struct exynos_drm_ipp_ops *ops; +struct drm_exynos_ipp_cmd_node *c_node; +struct drm_exynos_ipp_mem_node *m_node, *tm_node; +int ret; + +DRM_DEBUG_KMS ("%s\n" , __func__); +
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 806
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +10
-0+if (!qbuf) { +DRM_ERROR ("invalid buf parameter.\n" ); +return -EINVAL ; + } + + ippdrv =ipp_find_drv_node (qbuf->prop_id); + +if (!ippdrv) { +DRM_ERROR ("failed to get ipp driver.\n" ); +return -EINVAL ;
return -EFAULT;
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 817
Quoted 11 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +11
-0+ } + +if (qbuf->ops_id >=EXYNOS_DRM_OPS_MAX ) { +DRM_ERROR ("invalid ops parameter.\n" ); +return -EINVAL ; + } + + ops = ippdrv->ops[qbuf->ops_id]; +if (!ops) { +DRM_ERROR ("failed to get ops.\n" ); +return -EINVAL ;
return -EFAULT;
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 829
Quoted 12 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +12
-0+ } + +DRM_DEBUG_KMS ("%s:prop_id[%d]ops_id[%s]buf_id[%d]buf_type[%d]\n" , + __func__, qbuf->prop_id, qbuf->ops_id ?"dst" :"src" , + qbuf->buf_id, qbuf->buf_type); + +/* find command node */ + c_node =ipp_find_id (&ctx->prop_idr, &ctx->prop_lock, + qbuf->prop_id); +if (!c_node) { +DRM_ERROR ("failed to get command node.\n" ); +return -EINVAL ;
return -EFAULT;
Eunchul, it seems like that your patch set should be more cleared and simply. Please re-post them again as RFC after more clean.
Thanks,
Inki Dae
Re: [PATCH 1/4] drm/exynos: add ipp subsystem
Thank's quick review
I have some question about your some comment's
please check my comment and send one more time.
Quoted 229 lines · Inki Dae
below is quick review.
2012/10/18 Eunchul Kim <[email protected]>:
Quoted 226 lines
IPP stand for Image Post Processing and supports image scaler/rotator /crop/flip/csc(color space conversion) and input/output DMA operations using ipp drivers. also supports writeback and display output operations.
ipp driver include FIMC, Rotator, GSC, SC, so on.
and ipp is integration device driver for each hardware.Signed-off-by Eunchul Kim <[email protected]>Signed-off-by Jinyoung Jeon <[email protected]>--- drivers/gpu/drm/exynos/Kconfig | 6 + drivers/gpu/drm/exynos/Makefile | 1 + drivers/gpu/drm/exynos/exynos_drm_drv.c | 24 + drivers/gpu/drm/exynos/exynos_drm_drv.h | 7 + drivers/gpu/drm/exynos/exynos_drm_ipp.c | 1937 +++++++++++++++++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_ipp.h | 268 +++++ include/uapi/drm/exynos_drm.h | 189 +++ 7 files changed, 2432 insertions(+), 0 deletions(-)create mode 100644
drivers/gpu/drm/exynos/exynos_drm_ipp.ccreate mode 100644drivers/gpu/drm/exynos/exynos_drm_ipp.hdrivers/gpu/drm/exynos/Kconfig +6
-0@@ -39,3 +39,9 @@ config DRM_EXYNOS_G2D depends on DRM_EXYNOS && !VIDEO_SAMSUNG_S5P_G2D help Choose this option if you want to use Exynos G2D for DRM. + +config DRM_EXYNOS_IPP + bool "Exynos DRM IPP" + depends on DRM_EXYNOS + help + Choose this option if you want to use IPP feature for DRM.drivers/gpu/drm/exynos/Makefile +1
-0@@ -15,5 +15,6 @@ exynosdrm-$(CONFIG_DRM_EXYNOS_HDMI) += exynos_hdmi.o exynos_mixer.o \ exynos_drm_hdmi.o exynosdrm-$(CONFIG_DRM_EXYNOS_VIDI) += exynos_drm_vidi.o exynosdrm-$(CONFIG_DRM_EXYNOS_G2D) += exynos_drm_g2d.o +exynosdrm-$(CONFIG_DRM_EXYNOS_IPP) += exynos_drm_ipp.o obj-$(CONFIG_DRM_EXYNOS) += exynosdrm.odrivers/gpu/drm/exynos/exynos_drm_drv.c +24
-0@@ -40,6 +40,7 @@#include "exynos_drm_vidi.h" #include "exynos_drm_dmabuf.h" #include "exynos_drm_g2d.h" +#include "exynos_drm_ipp.h" #define DRIVER_NAME "exynos"#define DRIVER_DESC "Samsung SoC DRM"@@ -232,6 +233,14 @@ static struct drm_ioctl_desc exynos_ioctls[] = { exynos_g2d_set_cmdlist_ioctl, DRM_UNLOCKED | DRM_AUTH),DRM_IOCTL_DEF_DRV (EXYNOS_G2D_EXEC , exynos_g2d_exec_ioctl,DRM_UNLOCKED |DRM_AUTH ), +DRM_IOCTL_DEF_DRV (EXYNOS_IPP_GET_PROPERTY , + exynos_drm_ipp_get_property,DRM_UNLOCKED |DRM_AUTH ), +DRM_IOCTL_DEF_DRV (EXYNOS_IPP_SET_PROPERTY , + exynos_drm_ipp_set_property,DRM_UNLOCKED |DRM_AUTH ), +DRM_IOCTL_DEF_DRV (EXYNOS_IPP_QUEUE_BUF , + exynos_drm_ipp_queue_buf,DRM_UNLOCKED |DRM_AUTH ), +DRM_IOCTL_DEF_DRV (EXYNOS_IPP_CMD_CTRL , + exynos_drm_ipp_cmd_ctrl, DRM_UNLOCKED | DRM_AUTH), }; static const struct file_operations exynos_drm_driver_fops = {@@ -346,6 +355,12 @@ static int __init exynos_drm_init(void) goto out_g2d;#endif +#ifdef CONFIG_DRM_EXYNOS_IPP + ret =platform_driver_register (&ipp_driver); +if (ret <0 ) + goto out_ipp; +#endif + ret =platform_driver_register (&exynos_drm_platform_driver);if (ret <0 ) goto out_drm;@@ -363,6 +378,11 @@ out:platform_driver_unregister (&exynos_drm_platform_driver); out_drm: +#ifdef CONFIG_DRM_EXYNOS_IPP +platform_driver_unregister (&ipp_driver); +out_ipp: +#endif +#ifdef CONFIG_DRM_EXYNOS_G2D platform_driver_unregister (&g2d_driver); out_g2d:@@ -399,6 +419,10 @@ static void __exit exynos_drm_exit(void)platform_driver_unregister (&exynos_drm_platform_driver); +#ifdef CONFIG_DRM_EXYNOS_IPP +platform_driver_unregister (&ipp_driver); +#endif +#ifdef CONFIG_DRM_EXYNOS_G2D platform_driver_unregister (&g2d_driver);#endif drivers/gpu/drm/exynos/exynos_drm_drv.h +7
-0@@ -235,8 +235,14 @@ struct exynos_drm_g2d_private {unsigned int gem_nr; }; +struct exynos_drm_ipp_private { +struct device *dev; +struct list_head event_list; +}; +struct drm_exynos_file_private {struct exynos_drm_g2d_private *g2d_priv; +struct exynos_drm_ipp_private *ipp_priv; };/* @@ -335,4 +341,5 @@ extern struct platform_driver mixer_driver;extern struct platform_driver exynos_drm_common_hdmi_driver;extern struct platform_driver vidi_driver;extern struct platform_driver g2d_driver; +extern struct platform_driver ipp_driver;#endif drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +87
-0@@ -0,0 +1,1937 @@ +/* +* Copyright (C) 2012 Samsung Electronics Co.Ltd +* Authors: +* Eunchul Kim <[email protected]> +* Jinyoung Jeon <[email protected]> +* Sangmin Lee <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +*/ +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/clk.h> +#include <linux/pm_runtime.h> +#include <plat/map-base.h> + +#include <drm/drmP.h> +#include <drm/exynos_drm.h> +#include "exynos_drm_drv.h" +#include "exynos_drm_gem.h" +#include "exynos_drm_ipp.h" + +/* +* IPP is stand for Image Post Processing and +* supports image scaler/rotator and input/output DMA operations. +* using FIMC, GSC, Rotator, so on. +* IPP is integration device driver of same attribute h/w +*/ + +#define get_ipp_context (dev) platform_get_drvdata(to_platform_device(dev)) + +/* +* A structure of event. +* +* @base: base of event. +* @event: ipp event. +*/ +struct drm_exynos_ipp_send_event { +struct drm_pending_event base; +struct drm_exynos_ipp_event event; +}; + +/* +* A structure of memory node. +* +* @list: list head to memory queue information. +* @ops_id: id of operations. +* @prop_id: id of property. +* @buf_id: id of buffer. +* @buf_info: gem objects and dma address, size. +*/ +struct drm_exynos_ipp_mem_node { +struct list_head list; +enum drm_exynos_ops_id ops_id; +u32 prop_id; +u32 buf_id; +struct drm_exynos_ipp_buf_info buf_info; +}; + +/* +* A structure of ipp context. +* +* @subdrv: prepare initialization using subdrv. +* @ipp_lock: lock for synchronization of access to ipp_idr. +* @prop_lock: lock for synchronization of access to prop_idr. +* @ipp_idr: ipp driver idr. +* @prop_idr: property idr. +* @event_workq: event work queue. +* @cmd_workq: command work queue. +*/ +struct ipp_context { +struct exynos_drm_subdrv subdrv; +spinlock_t ipp_lock; +spinlock_t prop_lock; +struct idr ipp_idr; +struct idr prop_idr; +struct workqueue_struct *event_workq; +struct workqueue_struct *cmd_workq; +}; + +static LIST_HEAD (exynos_drm_ippdrv_list); +static BLOCKING_NOTIFIER_HEAD (exynos_drm_ippnb_list); +
Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 93
Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +6
-0+int exynos_drm_ippdrv_register (struct exynos_drm_ippdrv *ippdrv) +{ +DRM_DEBUG_KMS ("%s\n" , __func__); + +if (!ippdrv) +return -EINVAL ;ippdrv can't be null.
just error handling of ipp driver.
I will remove that.
Quoted 5 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 95
Quoted 3 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +2
-0+ +list_add_tail (&ippdrv->drv_list, &exynos_drm_ippdrv_list);Isn't
exynos_drm_ippdrv_listglobal? add mutex_lock/unlock.
It's global. but this api called by ipp driver. so, this platform driver already serialized in exynos_drm_init(). please one more comment's
Quoted 15 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 107
Quoted 13 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +12
-0+ +return 0 ; +} +EXPORT_SYMBOL_GPL (exynos_drm_ippdrv_register); + +int exynos_drm_ippdrv_unregister (struct exynos_drm_ippdrv *ippdrv) +{ +DRM_DEBUG_KMS ("%s\n" , __func__); + +if (!ippdrv) +return -EINVAL ; +ditto.
remove it.
Quoted 17 lines
Quoted 17 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +16
-0+list_del (&ippdrv->drv_list); + +return 0 ; +} +EXPORT_SYMBOL_GPL (exynos_drm_ippdrv_unregister); + +static int ipp_create_id (struct idr *id_idr,spinlock_t *lock,void *obj, +u32 *idp) +{ +int ret = -EINVAL ; + +DRM_DEBUG_KMS ("%s\n" , __func__); + +again: +/* ensure there is space available to allocate a handle */ +if (idr_pre_get (id_idr,GFP_KERNEL ) ==0 )
Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 129
Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +6
-0+return -ENOMEM ; + +/* do the allocation under our spinlock */ +spin_lock (lock); + ret =idr_get_new_above (id_idr, obj,1 , (int *)idp); +spin_unlock (lock);Is there any reason to use
spin_lock? Please, refrain from using spin lock.
I will change from spin lock to mutex lock. mutex lock was enough
Quoted 17 lines
Quoted 17 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +16
-0+if (ret == -EAGAIN ) + goto again; + +return ret; +} + +static void *ipp_find_id (struct idr *id_idr,spinlock_t *lock,u32 id) +{ +void *obj; + +DRM_DEBUG_KMS ("%s:id[%d]\n" , __func__, id); + +spin_lock (lock); + +/* find object using handle */ + obj =idr_find (id_idr, id);
Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 151
Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +6
-0+if (obj ==NULL ) { +spin_unlock (lock); +return NULL ; + } + +spin_unlock (lock);ditto.
change to mutex
Quoted 64 lines
Quoted 64 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +63
-0+ +return obj; +} + +static struct exynos_drm_ippdrv *ipp_find_driver (struct ipp_context *ctx, +struct drm_exynos_ipp_property *property) +{ +struct exynos_drm_ippdrv *ippdrv; +u32 ipp_id = property->ipp_id; + +DRM_DEBUG_KMS ("%s:ipp_id[%d]\n" , __func__, ipp_id); + +if (ipp_id) { +/* find ipp driver */ + ippdrv =ipp_find_id (&ctx->ipp_idr, &ctx->ipp_lock, + ipp_id); +if (!ippdrv) { +DRM_ERROR ("not found ipp%d driver.\n" , ipp_id); + goto err_null; + } + +/* check dedicated state */ +if (ippdrv->dedicated) { +DRM_ERROR ("used choose device.\n" ); + goto err_null; + } + +if (property->cmd !=IPP_CMD_M2M + && !pm_runtime_suspended (ippdrv->dev)) { +DRM_ERROR ("can't run dedicatedly.\n" ); + goto err_null; + } + +/* check property */ +if (ippdrv->check_property && + ippdrv->check_property (ippdrv->dev, property)) { +DRM_ERROR ("not support property.\n" ); + goto err_null; + } + +return ippdrv; + }else { +/* get ipp driver entry */ +list_for_each_entry (ippdrv, &exynos_drm_ippdrv_list, drv_list) { +/* check dedicated state */ +if (ippdrv->dedicated) +continue ; + +if (property->cmd !=IPP_CMD_M2M + && !pm_runtime_suspended (ippdrv->dev)) { +DRM_DEBUG_KMS ("%s:can't run dedicatedly.\n" , + __func__); +continue ; + } + +/* check property */ +if (ippdrv->check_property && + ippdrv->check_property (ippdrv->dev, property)) { +DRM_DEBUG_KMS ("%s:not support property.\n" , + __func__); +continue ; + } +
Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 220
Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +6
-0+return ippdrv; + } + +DRM_ERROR ("not support ipp driver operations.\n" ); + } +return
ERR_PTR(proper error type)and share duplicated codes.
we support two kind of method in ipp_find_driver.
first, If user library set ipp_id. we find this one.
second, If user library not set ipp_id(default), we search idle state driver. so, I think we can't share this code.
and I will add return ERR_PTR(error type)
Quoted 15 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 232
Quoted 13 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +12
-0+err_null: +return NULL ; +} + +static struct exynos_drm_ippdrv *ipp_find_drv_node (u32 prop_id) +{ +struct exynos_drm_ippdrv *ippdrv; +struct drm_exynos_ipp_cmd_node *c_node; +int count =0 ; + +DRM_DEBUG_KMS ("%s:prop_id[%d]\n" , __func__, prop_id); +add mutex lock.
OK, I will add lock.
Quoted 62 lines
Quoted 62 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +61
-0+if (list_empty (&exynos_drm_ippdrv_list)) { +DRM_DEBUG_KMS ("%s:ippdrv_list is empty.\n" , + __func__); +return NULL ; + } + +list_for_each_entry (ippdrv, &exynos_drm_ippdrv_list, drv_list) { +DRM_DEBUG_KMS ("%s:count[%d]ippdrv[0x%x]\n" , + __func__, count++, (int )ippdrv); + +if (!list_empty (&ippdrv->cmd_list)) { +list_for_each_entry (c_node, &ippdrv->cmd_list, list) { +if (c_node->property.prop_id == prop_id) +return ippdrv; + } + } + } + +return NULL ; +} + +int exynos_drm_ipp_get_property (struct drm_device *drm_dev,void *data, +struct drm_file *file) +{ +struct drm_exynos_file_private *file_priv = file->driver_priv; +struct exynos_drm_ipp_private *priv = file_priv->ipp_priv; +struct device *dev = priv->dev; +struct ipp_context *ctx =get_ipp_context (dev); +struct drm_exynos_ipp_prop_list *prop_list = data; +struct exynos_drm_ippdrv *ippdrv; +int count =0 ; + +DRM_DEBUG_KMS ("%s\n" , __func__); + +if (!ctx) { +DRM_ERROR ("invalid context.\n" ); +return -EINVAL ; + } + +if (!prop_list) { +DRM_ERROR ("invalid property parameter.\n" ); +return -EINVAL ; + } + +DRM_DEBUG_KMS ("%s:ipp_id[%d]\n" , __func__, prop_list->ipp_id); + +if (prop_list->ipp_id ==0 ) { +list_for_each_entry (ippdrv, &exynos_drm_ippdrv_list, drv_list) + count++; + prop_list->count = count; + }else { + ippdrv =ipp_find_id (&ctx->ipp_idr, &ctx->ipp_lock, + prop_list->ipp_id); + +if (!ippdrv) { +DRM_ERROR ("not found ipp%d driver.\n" , + prop_list->ipp_id); +return -EINVAL ; + } + + prop_list = ippdrv->prop_list;
Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 299
Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +6
-0+ } + +return 0 ; +} +EXPORT_SYMBOL_GPL (exynos_drm_ipp_get_property); +no need symbol export.
our all exynos specific ioctl is EXPORT symbol.
so, I added EXPORT symbol. is it some probem ?
Quoted 152 lines
Quoted 152 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +151
-0+int exynos_drm_ipp_set_property (struct drm_device *drm_dev,void *data, +struct drm_file *file) +{ +struct drm_exynos_file_private *file_priv = file->driver_priv; +struct exynos_drm_ipp_private *priv = file_priv->ipp_priv; +struct device *dev = priv->dev; +struct ipp_context *ctx =get_ipp_context (dev); +struct drm_exynos_ipp_property *property = data; +struct exynos_drm_ippdrv *ippdrv; +struct drm_exynos_ipp_cmd_node *c_node; +struct drm_exynos_ipp_config *config; +struct drm_exynos_pos *pos; +struct drm_exynos_sz *sz; +int ret, i; + +DRM_DEBUG_KMS ("%s\n" , __func__); + +if (!ctx) { +DRM_ERROR ("invalid context.\n" ); +return -EINVAL ; + } + +if (!property) { +DRM_ERROR ("invalid property parameter.\n" ); +return -EINVAL ; + } + +for_each_ipp_ops (i) { + config = &property->config[i]; + pos = &config->pos; + sz = &config->sz; + +DRM_DEBUG_KMS ("%s:prop_id[%d]ops[%s]fmt[0x%x]\n" , + __func__, property->prop_id, + i ?"dst" :"src" , config->fmt); + +DRM_DEBUG_KMS ("%s:pos[%d %d %d %d]sz[%d %d]f[%d]r[%d]\n" , + __func__, pos->x, pos->y, pos->w, pos->h, + sz->hsize, sz->vsize, config->flip, config->degree); + } + +if (property->prop_id) { + ippdrv =ipp_find_drv_node (property->prop_id); +if (!ippdrv) { +DRM_ERROR ("failed to get ipp driver.\n" ); +return -EINVAL ; + } + +list_for_each_entry (c_node, &ippdrv->cmd_list, list) { +if ((c_node->property.prop_id == + property->prop_id) && + (c_node->state ==IPP_STATE_STOP )) { +DRM_DEBUG_KMS ("%s:found cmd[%d]ippdrv[0x%x]\n" , + __func__, property->cmd, (int )ippdrv); + + c_node->property = *property; +return 0 ; + } + } + +DRM_ERROR ("failed to search property.\n" ); +return -EINVAL ; + } + +/* find ipp driver using ipp id */ + ippdrv =ipp_find_driver (ctx, property); +if (!ippdrv) { +DRM_ERROR ("failed to get ipp driver.\n" ); +return -EINVAL ; + } + +/* allocate command node */ + c_node =kzalloc (sizeof (*c_node),GFP_KERNEL ); +if (!c_node) { +DRM_ERROR ("failed to allocate map node.\n" ); +return -ENOMEM ; + } + +/* create property id */ + ret =ipp_create_id (&ctx->prop_idr, &ctx->prop_lock, c_node, + &property->prop_id); +if (ret) { +DRM_ERROR ("failed to create id.\n" ); + goto err_clear; + } + +DRM_DEBUG_KMS ("%s:created prop_id[%d]cmd[%d]ippdrv[0x%x]\n" , + __func__, property->prop_id, property->cmd, (int )ippdrv); + +/* stored property information and ippdrv in private data */ + c_node->priv = priv; + c_node->property = *property; + c_node->state =IPP_STATE_IDLE ; + + c_node->start_work =kzalloc (sizeof (*c_node->start_work), +GFP_KERNEL ); +if (!c_node->start_work) { +DRM_ERROR ("failed to alloc start_work.\n" ); + ret = -ENOMEM ; + goto err_clear; + } + +INIT_WORK ((struct work_struct *)c_node->start_work, + ipp_sched_cmd); + + c_node->stop_work =kzalloc (sizeof (*c_node->stop_work), +GFP_KERNEL ); +if (!c_node->stop_work) { +DRM_ERROR ("failed to alloc stop_work.\n" ); + ret = -ENOMEM ; + goto err_free_start; + } + +INIT_WORK ((struct work_struct *)c_node->stop_work, + ipp_sched_cmd); + + c_node->event_work =kzalloc (sizeof (*c_node->event_work), +GFP_KERNEL ); +if (!c_node->event_work) { +DRM_ERROR ("failed to alloc event_work.\n" ); + ret = -ENOMEM ; + goto err_free_stop; + } + +INIT_WORK ((struct work_struct *)c_node->event_work, + ipp_sched_event); + +/* init ioctl lock */ +mutex_init (&c_node->cmd_lock); +mutex_init (&c_node->mem_lock); +mutex_init (&c_node->event_lock); +init_completion (&c_node->start_complete); +init_completion (&c_node->stop_complete); + +for_each_ipp_ops (i) +INIT_LIST_HEAD (&c_node->mem_list[i]); + +INIT_LIST_HEAD (&c_node->event_list); +list_splice_init (&priv->event_list, &c_node->event_list); +list_add_tail (&c_node->list, &ippdrv->cmd_list); + +/* make dedicated state without m2m */ +if (property->cmd !=IPP_CMD_M2M ) + ippdrv->dedicated = true; + +return 0 ; + +err_free_stop: +kfree (c_node->stop_work); +err_free_start: +kfree (c_node->start_work);
Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 456
Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +6
-0+err_clear: +kfree (c_node); +return ret; +} +EXPORT_SYMBOL_GPL (exynos_drm_ipp_set_property); +no need symbol export.
ditto.
Quoted 14 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 466
Quoted 11 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +10
-0+static struct drm_exynos_ipp_mem_node + *ipp_find_mem_node (struct drm_exynos_ipp_cmd_node *c_node, +struct drm_exynos_ipp_queue_buf *qbuf) +{ +struct drm_exynos_ipp_mem_node *m_node; +struct list_head *head; +int count =0 ; + +DRM_DEBUG_KMS ("%s:buf_id[%d]\n" , __func__, qbuf->buf_id); +no need mutex lock? I think
c_nodeis a member ofctx->ippdrvand ctx is unique to driver.
you are right. but this api just find memory node. no delete and add. we aleady have locking in get/put.
so, I think we don't need locking in this case.
please one more comment.
Quoted 99 lines
Quoted 99 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +98
-0+/* source/destination memory list */ + head = &c_node->mem_list[qbuf->ops_id]; + +/* find memory node entry */ +list_for_each_entry (m_node, head, list) { +DRM_DEBUG_KMS ("%s:count[%d]m_node[0x%x]\n" , + __func__, count++, (int )m_node); + +/* compare buffer id */ +if (m_node->buf_id == qbuf->buf_id) +return m_node; + } + +return NULL ; +} + +static int ipp_check_mem_list (struct drm_exynos_ipp_cmd_node *c_node) +{ +struct drm_exynos_ipp_property *property = &c_node->property; +struct drm_exynos_ipp_mem_node *m_node; +struct list_head *head; +int ret, i, count[EXYNOS_DRM_OPS_MAX ] = {0 , }; + +DRM_DEBUG_KMS ("%s\n" , __func__); + +mutex_lock (&c_node->mem_lock); + +for_each_ipp_ops (i) { +/* source/destination memory list */ + head = &c_node->mem_list[i]; + +if (list_empty (head)) { +DRM_DEBUG_KMS ("%s:%s memory empty.\n" , __func__, + i ?"dst" :"src" ); +continue ; + } + +/* find memory node entry */ +list_for_each_entry (m_node, head, list) { +DRM_DEBUG_KMS ("%s:%s,count[%d]m_node[0x%x]\n" , __func__, + i ?"dst" :"src" , count[i], (int )m_node); + count[i]++; + } + } + +DRM_DEBUG_KMS ("%s:min[%d]max[%d]\n" , __func__, +min (count[EXYNOS_DRM_OPS_SRC ], count[EXYNOS_DRM_OPS_DST ]), +max (count[EXYNOS_DRM_OPS_SRC ], count[EXYNOS_DRM_OPS_DST ])); + + +if (property->cmd ==IPP_CMD_M2M ) + ret =min (count[EXYNOS_DRM_OPS_SRC ], + count[EXYNOS_DRM_OPS_DST ]); +else + ret =max (count[EXYNOS_DRM_OPS_SRC ], + count[EXYNOS_DRM_OPS_DST ]); + +mutex_unlock (&c_node->mem_lock); + +return ret; +} + +static void ipp_clean_cmd_node (struct drm_exynos_ipp_cmd_node *c_node) +{ +DRM_DEBUG_KMS ("%s\n" , __func__); + +/* delete list */ +list_del (&c_node->list); + +/* destroy mutex */ +mutex_destroy (&c_node->cmd_lock); +mutex_destroy (&c_node->mem_lock); +mutex_destroy (&c_node->event_lock); + +/* free command node */ +kfree (c_node->start_work); +kfree (c_node->stop_work); +kfree (c_node->event_work); +kfree (c_node); +} + +static int ipp_set_mem_node (struct exynos_drm_ippdrv *ippdrv, +struct drm_exynos_ipp_cmd_node *c_node, +struct drm_exynos_ipp_mem_node *m_node) +{ +struct exynos_drm_ipp_ops *ops =NULL ; +int ret =0 ; + +DRM_DEBUG_KMS ("%s:node[0x%x]\n" , __func__, (int )m_node); + +if (!m_node) { +DRM_ERROR ("invalid queue node.\n" ); +return -EFAULT ; + } + +mutex_lock (&c_node->mem_lock); + +DRM_DEBUG_KMS ("%s:ops_id[%d]\n" , __func__, m_node->ops_id);
Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 570
Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +6
-0+ +/* get operations callback */ + ops = ippdrv->ops[m_node->ops_id]; +if (!ops) { +DRM_ERROR ("not support ops.\n" ); + ret = -EIO ;
-EFAULT;
OK, I will change it.
Quoted 231 lines
Quoted 231 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +230
-0+ goto err_unlock; + } + +/* set address and enable irq */ +if (ops->set_addr) { + ret = ops->set_addr (ippdrv->dev, &m_node->buf_info, + m_node->buf_id,IPP_BUF_ENQUEUE ); +if (ret) { +DRM_ERROR ("failed to set addr.\n" ); + goto err_unlock; + } + } + +err_unlock: +mutex_unlock (&c_node->mem_lock); +return ret; +} + +static struct drm_exynos_ipp_mem_node + *ipp_get_mem_node (struct drm_device *drm_dev, +struct drm_file *file, +struct drm_exynos_ipp_cmd_node *c_node, +struct drm_exynos_ipp_queue_buf *qbuf) +{ +struct drm_exynos_ipp_mem_node *m_node; +struct drm_exynos_ipp_buf_info buf_info; +void *addr; +int i; + +mutex_lock (&c_node->mem_lock); + + m_node =kzalloc (sizeof (*m_node),GFP_KERNEL ); +if (!m_node) { +DRM_ERROR ("failed to allocate queue node.\n" ); + goto err_unlock; + } + +/* clear base address for error handling */ +memset (&buf_info,0x0 ,sizeof (buf_info)); + +/* operations, buffer id */ + m_node->ops_id = qbuf->ops_id; + m_node->prop_id = qbuf->prop_id; + m_node->buf_id = qbuf->buf_id; + +DRM_DEBUG_KMS ("%s:m_node[0x%x]ops_id[%d]\n" , __func__, + (int )m_node, qbuf->ops_id); +DRM_DEBUG_KMS ("%s:prop_id[%d]buf_id[%d]\n" , __func__, + qbuf->prop_id, m_node->buf_id); + +for_each_ipp_planar (i) { +DRM_DEBUG_KMS ("%s:i[%d]handle[0x%x]\n" , __func__, + i, qbuf->handle[i]); + +/* get dma address by handle */ +if (qbuf->handle[i] !=0 ) { + addr =exynos_drm_gem_get_dma_addr (drm_dev, + qbuf->handle[i], file); +if (!addr) { +DRM_ERROR ("failed to get addr.\n" ); + goto err_clear; + } + + buf_info.gem_handle[i] = qbuf->handle[i]; + buf_info.base[i] = *(dma_addr_t *) addr; + buf_info.file = file; +DRM_DEBUG_KMS ("%s:i[%d]base[0x%x]gem_handle[0x%x]\n" , + __func__, i, buf_info.base[i], + buf_info.gem_handle[i]); + } + } + + m_node->buf_info = buf_info; +list_add_tail (&m_node->list, &c_node->mem_list[qbuf->ops_id]); + +mutex_unlock (&c_node->mem_lock); +return m_node; + +err_clear: +kfree (m_node); + +err_unlock: +mutex_unlock (&c_node->mem_lock); + +return NULL ; +} + +static int ipp_put_mem_node (struct drm_device *drm_dev, +struct drm_exynos_ipp_cmd_node *c_node, +struct drm_exynos_ipp_mem_node *m_node) +{ +int i, ret =0 ; + +DRM_DEBUG_KMS ("%s:node[0x%x]\n" , __func__, (int )m_node); + +if (!m_node) { +DRM_ERROR ("invalid dequeue node.\n" ); +return -EFAULT ; + } + +if (list_empty (&m_node->list)) { +DRM_ERROR ("empty memory node.\n" ); +return -ENOMEM ; + } + +mutex_lock (&c_node->mem_lock); + +DRM_DEBUG_KMS ("%s:ops_id[%d]\n" , __func__, m_node->ops_id); + +/* put gem buffer */ +for_each_ipp_planar (i) { +struct drm_file *file = m_node->buf_info.file; +unsigned int gem_handle = m_node->buf_info.gem_handle[i]; + +if (gem_handle) +exynos_drm_gem_put_dma_addr (drm_dev, gem_handle, file); + } + +/* delete list in queue */ +list_del (&m_node->list); +kfree (m_node); + +mutex_unlock (&c_node->mem_lock); +return ret; +} + +static void ipp_free_event (struct drm_pending_event *event) +{ +kfree (event); +} + +static int ipp_get_event (struct drm_device *drm_dev, +struct drm_file *file, +struct drm_exynos_ipp_cmd_node *c_node, +struct drm_exynos_ipp_queue_buf *qbuf) +{ +struct drm_exynos_ipp_send_event *e; +unsigned long flags; + +DRM_DEBUG_KMS ("%s:ops_id[%d]buf_id[%d]\n" , __func__, + qbuf->ops_id, qbuf->buf_id); + + e =kzalloc (sizeof (*e),GFP_KERNEL ); + +if (!e) { +DRM_ERROR ("failed to allocate event.\n" ); +spin_lock_irqsave (&drm_dev->event_lock, flags); + file->event_space +=sizeof (e->event); +spin_unlock_irqrestore (&drm_dev->event_lock, flags); +return -ENOMEM ; + } + +/* make event */ + e->event.base.type =DRM_EXYNOS_IPP_EVENT ; + e->event.base.length =sizeof (e->event); + e->event.user_data = qbuf->user_data; + e->event.prop_id = qbuf->prop_id; + e->event.buf_id[EXYNOS_DRM_OPS_DST ] = qbuf->buf_id; + e->base.event = &e->event.base; + e->base.file_priv = file; + e->base.destroy = ipp_free_event; +list_add_tail (&e->base.link, &c_node->event_list); + +return 0 ; +} + +static void ipp_put_event (struct drm_exynos_ipp_cmd_node *c_node, +struct drm_exynos_ipp_queue_buf *qbuf) +{ +struct drm_exynos_ipp_send_event *e, *te; +int count =0 ; + +if (list_empty (&c_node->event_list)) { +DRM_DEBUG_KMS ("%s:event_list is empty.\n" , __func__); +return ; + } + +list_for_each_entry_safe (e, te, &c_node->event_list, base.link) { +DRM_DEBUG_KMS ("%s:count[%d]e[0x%x]\n" , + __func__, count++, (int )e); + +if (!qbuf) { +/* delete list */ +list_del (&e->base.link); +kfree (e); + }else if (e->event.buf_id[EXYNOS_DRM_OPS_DST ] + == qbuf->buf_id) { +/* delete list */ +list_del (&e->base.link); +kfree (e); +return ; + } + } + +return ; +} + +void ipp_handle_cmd_work (struct device *dev, +struct exynos_drm_ippdrv *ippdrv, +struct drm_exynos_ipp_cmd_work *cmd_work, +struct drm_exynos_ipp_cmd_node *c_node) +{ +struct ipp_context *ctx =get_ipp_context (dev); + + cmd_work->ippdrv = ippdrv; + cmd_work->c_node = c_node; +queue_work (ctx->cmd_workq, (struct work_struct *)cmd_work); +} + +int exynos_drm_ipp_queue_buf (struct drm_device *drm_dev,void *data, +struct drm_file *file) +{ +struct drm_exynos_file_private *file_priv = file->driver_priv; +struct exynos_drm_ipp_private *priv = file_priv->ipp_priv; +struct device *dev = priv->dev; +struct ipp_context *ctx =get_ipp_context (dev); +struct drm_exynos_ipp_queue_buf *qbuf = data; +struct exynos_drm_ippdrv *ippdrv; +struct drm_exynos_ipp_property *property; +struct exynos_drm_ipp_ops *ops; +struct drm_exynos_ipp_cmd_node *c_node; +struct drm_exynos_ipp_mem_node *m_node, *tm_node; +int ret; + +DRM_DEBUG_KMS ("%s\n" , __func__); + +if (!qbuf) { +DRM_ERROR ("invalid buf parameter.\n" ); +return -EINVAL ; + }
Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 806
Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +6
-0+ + ippdrv =ipp_find_drv_node (qbuf->prop_id); + +if (!ippdrv) { +DRM_ERROR ("failed to get ipp driver.\n" ); +return -EINVAL ;return
-EFAULT;
OK, I will change it.
Quoted 14 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 817
Quoted 12 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +11
-0+ } + +if (qbuf->ops_id >=EXYNOS_DRM_OPS_MAX ) { +DRM_ERROR ("invalid ops parameter.\n" ); +return -EINVAL ; + } + + ops = ippdrv->ops[qbuf->ops_id]; +if (!ops) { +DRM_ERROR ("failed to get ops.\n" ); +return -EINVAL ;return
-EFAULT;
OK, I will change it.
Quoted 15 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c line 829
Quoted 13 lines
drivers/gpu/drm/exynos/exynos_drm_ipp.c new file +12
-0+ } + +DRM_DEBUG_KMS ("%s:prop_id[%d]ops_id[%s]buf_id[%d]buf_type[%d]\n" , + __func__, qbuf->prop_id, qbuf->ops_id ?"dst" :"src" , + qbuf->buf_id, qbuf->buf_type); + +/* find command node */ + c_node =ipp_find_id (&ctx->prop_idr, &ctx->prop_lock, + qbuf->prop_id); +if (!c_node) { +DRM_ERROR ("failed to get command node.\n" ); +return -EINVAL ;return
-EFAULT;
OK, I will change it.
Quoted 4 lines
Eunchul, it seems like that your patch set should be more cleared and simply. Please re-post them again as RFC after more clean.
OK. I wil send one more time using RFC.
Quoted 4 lines
Thanks,
Inki Dae
Thank's
Eunchul Kim
PATCH 2/4 drm/exynos: add fimc ipp driver
In reply to Eunchul KimFIMC is stand for Fully Interfactive Mobile Camera and
supports image scaler/rotator/crop/flip/csc and input/output DMA operations. input DMA reads image data from the memory.
output DMA writes image data to memory.
FIMC supports image rotation and image effect functions.
also supports writeback and display output operations.
--- drivers/gpu/drm/exynos/Kconfig | 6 + drivers/gpu/drm/exynos/Makefile | 1 + drivers/gpu/drm/exynos/exynos_drm_drv.c | 15 + drivers/gpu/drm/exynos/exynos_drm_drv.h | 1 + drivers/gpu/drm/exynos/exynos_drm_fimc.c | 2041 ++++++++++++++++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_fimc.h | 35 + drivers/gpu/drm/exynos/regs-fimc.h | 669 ++++++++++ include/drm/exynos_drm.h | 33 + 8 files changed, 2801 insertions(+), 0 deletions(-) create mode 100644 drivers/gpu/drm/exynos/exynos_drm_fimc.c create mode 100644 drivers/gpu/drm/exynos/exynos_drm_fimc.h create mode 100644 drivers/gpu/drm/exynos/regs-fimc.h
drivers/gpu/drm/exynos/Kconfig +6 -0
@@ -45,3 +45,9 @@ config DRM_EXYNOS_IPP depends on DRM_EXYNOS help Choose this option if you want to use IPP feature for DRM. + +config DRM_EXYNOS_FIMC + bool "Exynos DRM FIMC" + depends on DRM_EXYNOS_IPP + help + Choose this option if you want to use Exynos FIMC for DRM.
drivers/gpu/drm/exynos/Makefile +1 -0
@@ -16,5 +16,6 @@ exynosdrm-$(CONFIG_DRM_EXYNOS_HDMI) += exynos_hdmi.o exynos_mixer.o \ exynosdrm-$(CONFIG_DRM_EXYNOS_VIDI) += exynos_drm_vidi.o exynosdrm-$(CONFIG_DRM_EXYNOS_G2D) += exynos_drm_g2d.o exynosdrm-$(CONFIG_DRM_EXYNOS_IPP) += exynos_drm_ipp.o +exynosdrm-$(CONFIG_DRM_EXYNOS_FIMC) += exynos_drm_fimc.o obj-$(CONFIG_DRM_EXYNOS) += exynosdrm.o
drivers/gpu/drm/exynos/exynos_drm_drv.c +15 -0
@@ -355,6 +355,12 @@ static int __init exynos_drm_init(void) goto out_g2d;#endif +#ifdef CONFIG_DRM_EXYNOS_FIMC + ret =platform_driver_register (&fimc_driver); +if (ret <0 ) + goto out_fimc; +#endif +#ifdef CONFIG_DRM_EXYNOS_IPP ret =platform_driver_register (&ipp_driver);if (ret <0 )
@@ -383,6 +389,11 @@ out_drm: out_ipp:#endif +#ifdef CONFIG_DRM_EXYNOS_FIMC +platform_driver_unregister (&fimc_driver); +out_fimc: +#endif +#ifdef CONFIG_DRM_EXYNOS_G2D platform_driver_unregister (&g2d_driver); out_g2d:
@@ -423,6 +434,10 @@ static void __exit exynos_drm_exit(void)platform_driver_unregister (&ipp_driver);#endif +#ifdef CONFIG_DRM_EXYNOS_FIMC +platform_driver_unregister (&fimc_driver); +#endif +#ifdef CONFIG_DRM_EXYNOS_G2D platform_driver_unregister (&g2d_driver);#endif
drivers/gpu/drm/exynos/exynos_drm_drv.h +1 -0
@@ -341,5 +341,6 @@ extern struct platform_driver mixer_driver;extern struct platform_driver exynos_drm_common_hdmi_driver;extern struct platform_driver vidi_driver;extern struct platform_driver g2d_driver; +extern struct platform_driver fimc_driver;extern struct platform_driver ipp_driver;#endif
drivers/gpu/drm/exynos/exynos_drm_fimc.c new file +2041 -0
2,041 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_drm_fimc.h new file +35 -0
@@ -0,0 +1,35 @@ +/* +* Copyright (c) 2012 Samsung Electronics Co., Ltd. +* +* Authors: +* Eunchul Kim <[email protected]> +* Jinyoung Jeon <[email protected]> +* Sangmin Lee <[email protected]> +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _EXYNOS_DRM_FIMC_H_ +#define _EXYNOS_DRM_FIMC_H_ + +/* ToDo */ + +#endif /* _EXYNOS_DRM_FIMC_H_ */ +
drivers/gpu/drm/exynos/regs-fimc.h new file +669 -0
669 lines not on this page · raw message
include/drm/exynos_drm.h +33 -0
@@ -85,4 +85,37 @@ struct exynos_drm_hdmi_pdata { int (*get_hpd)(void); }; +/** +* Platform Specific Structure for DRM based FIMC. +* +* @inv_pclk: if set 1. invert pixel clock +* @inv_vsync: if set 1. invert vsync signal for wb +* @inv_href: if set 1. invert href signal +* @inv_hsync: if set 1. invert hsync signal for wb +*/ +struct exynos_drm_fimc_pol { +unsigned int inv_pclk; +unsigned int inv_vsync; +unsigned int inv_href; +unsigned int inv_hsync; +}; + +enum exynos_drm_fimc_ver { +FIMC_EXYNOS_4210 , +FIMC_EXYNOS_4212 , +FIMC_EXYNOS_4412 , +FIMC_EXYNOS_4412_R2 , +}; + +/** +* Platform Specific Structure for DRM based FIMC. +* +* @pol: current hardware block polarity settings. +* @ver: current hardware block version. +*/ +struct exynos_drm_fimc_pdata { +struct exynos_drm_fimc_pol pol; +enum exynos_drm_fimc_ver ver; +}; +#endif /* _EXYNOS_DRM_H_ */
Signature · 1 line
1.7.0.4
PATCH 3/4 drm/exynos: add rotator ipp driver
In reply to Eunchul KimRotator supports rotation/crop/flip and input/output DMA operations Rotator ipp driver supports 90,180,270 degree rotaion and vertical, horizontal flip. and has some limitations(source and destination format have to be same, no scaler)
--- drivers/gpu/drm/exynos/Kconfig | 6 + drivers/gpu/drm/exynos/Makefile | 1 + drivers/gpu/drm/exynos/exynos_drm_drv.c | 15 + drivers/gpu/drm/exynos/exynos_drm_drv.h | 1 + drivers/gpu/drm/exynos/exynos_drm_rotator.c | 801 +++++++++++++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_rotator.h | 13 + drivers/gpu/drm/exynos/regs-rotator.h | 73 +++ 7 files changed, 910 insertions(+), 0 deletions(-) create mode 100644 drivers/gpu/drm/exynos/exynos_drm_rotator.c create mode 100644 drivers/gpu/drm/exynos/exynos_drm_rotator.h create mode 100644 drivers/gpu/drm/exynos/regs-rotator.h
drivers/gpu/drm/exynos/Kconfig +6 -0
@@ -51,3 +51,9 @@ config DRM_EXYNOS_FIMC depends on DRM_EXYNOS_IPP help Choose this option if you want to use Exynos FIMC for DRM. + +config DRM_EXYNOS_ROTATOR + bool "Exynos DRM Rotator" + depends on DRM_EXYNOS_IPP + help + Choose this option if you want to use Exynos Rotator for DRM.
drivers/gpu/drm/exynos/Makefile +1 -0
@@ -17,5 +17,6 @@ exynosdrm-$(CONFIG_DRM_EXYNOS_VIDI) += exynos_drm_vidi.o exynosdrm-$(CONFIG_DRM_EXYNOS_G2D) += exynos_drm_g2d.o exynosdrm-$(CONFIG_DRM_EXYNOS_IPP) += exynos_drm_ipp.o exynosdrm-$(CONFIG_DRM_EXYNOS_FIMC) += exynos_drm_fimc.o +exynosdrm-$(CONFIG_DRM_EXYNOS_ROTATOR) += exynos_drm_rotator.o obj-$(CONFIG_DRM_EXYNOS) += exynosdrm.o
drivers/gpu/drm/exynos/exynos_drm_drv.c +15 -0
@@ -361,6 +361,12 @@ static int __init exynos_drm_init(void) goto out_fimc;#endif +#ifdef CONFIG_DRM_EXYNOS_ROTATOR + ret =platform_driver_register (&rotator_driver); +if (ret <0 ) + goto out_rotator; +#endif +#ifdef CONFIG_DRM_EXYNOS_IPP ret =platform_driver_register (&ipp_driver);if (ret <0 )
@@ -389,6 +395,11 @@ out_drm: out_ipp:#endif +#ifdef CONFIG_DRM_EXYNOS_ROTATOR +platform_driver_unregister (&rotator_driver); +out_rotator: +#endif +#ifdef CONFIG_DRM_EXYNOS_FIMC platform_driver_unregister (&fimc_driver); out_fimc:
@@ -434,6 +445,10 @@ static void __exit exynos_drm_exit(void)platform_driver_unregister (&ipp_driver);#endif +#ifdef CONFIG_DRM_EXYNOS_ROTATOR +platform_driver_unregister (&rotator_driver); +#endif +#ifdef CONFIG_DRM_EXYNOS_FIMC platform_driver_unregister (&fimc_driver);#endif
drivers/gpu/drm/exynos/exynos_drm_drv.h +1 -0
@@ -342,5 +342,6 @@ extern struct platform_driver exynos_drm_common_hdmi_driver;extern struct platform_driver vidi_driver;extern struct platform_driver g2d_driver;extern struct platform_driver fimc_driver; +extern struct platform_driver rotator_driver;extern struct platform_driver ipp_driver;#endif
drivers/gpu/drm/exynos/exynos_drm_rotator.c new file +801 -0
801 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_drm_rotator.h new file +13 -0
@@ -0,0 +1,13 @@ +/* +* Copyright (C) 2012 Samsung Electronics Co.Ltd +* Authors: YoungJun Cho <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundationr +*/ + +#ifndef _EXYNOS_DRM_ROTATOR_H_ +#define _EXYNOS_DRM_ROTATOR_H_ + +#endif
drivers/gpu/drm/exynos/regs-rotator.h new file +73 -0
73 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 4/4 drm/exynos: add gsc ipp driver
In reply to Eunchul KimGSC is stand for General SCaler and supports supports image scaler/rotator/crop/flip/csc and input/output DMA operations. input DMA reads image data from the memory.
output DMA writes image data to memory.
GSC supports image rotation and imag effect functions. also supports writeback and display output operations.
--- drivers/gpu/drm/exynos/Kconfig | 6 + drivers/gpu/drm/exynos/Makefile | 1 + drivers/gpu/drm/exynos/exynos_drm_drv.c | 15 + drivers/gpu/drm/exynos/exynos_drm_drv.h | 1 + drivers/gpu/drm/exynos/exynos_drm_gsc.c | 1476 +++++++++++++++++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_gsc.h | 35 + drivers/gpu/drm/exynos/regs-gsc.h | 295 ++++++ 7 files changed, 1829 insertions(+), 0 deletions(-) create mode 100644 drivers/gpu/drm/exynos/exynos_drm_gsc.c create mode 100644 drivers/gpu/drm/exynos/exynos_drm_gsc.h create mode 100644 drivers/gpu/drm/exynos/regs-gsc.h
drivers/gpu/drm/exynos/Kconfig +6 -0
@@ -57,3 +57,9 @@ config DRM_EXYNOS_ROTATOR depends on DRM_EXYNOS_IPP help Choose this option if you want to use Exynos Rotator for DRM. + +config DRM_EXYNOS_GSC + bool "Exynos DRM GSC" + depends on DRM_EXYNOS_IPP && ARCH_EXYNOS5 + help + Choose this option if you want to use Exynos GSC for DRM.
drivers/gpu/drm/exynos/Makefile +1 -0
@@ -18,5 +18,6 @@ exynosdrm-$(CONFIG_DRM_EXYNOS_G2D) += exynos_drm_g2d.o exynosdrm-$(CONFIG_DRM_EXYNOS_IPP) += exynos_drm_ipp.o exynosdrm-$(CONFIG_DRM_EXYNOS_FIMC) += exynos_drm_fimc.o exynosdrm-$(CONFIG_DRM_EXYNOS_ROTATOR) += exynos_drm_rotator.o +exynosdrm-$(CONFIG_DRM_EXYNOS_GSC) += exynos_drm_gsc.o obj-$(CONFIG_DRM_EXYNOS) += exynosdrm.o
drivers/gpu/drm/exynos/exynos_drm_drv.c +15 -0
@@ -367,6 +367,12 @@ static int __init exynos_drm_init(void) goto out_rotator;#endif +#ifdef CONFIG_DRM_EXYNOS_GSC + ret =platform_driver_register (&gsc_driver); +if (ret <0 ) + goto out_gsc; +#endif +#ifdef CONFIG_DRM_EXYNOS_IPP ret =platform_driver_register (&ipp_driver);if (ret <0 )
@@ -395,6 +401,11 @@ out_drm: out_ipp:#endif +#ifdef CONFIG_DRM_EXYNOS_GSC +platform_driver_unregister (&gsc_driver); +out_gsc: +#endif +#ifdef CONFIG_DRM_EXYNOS_ROTATOR platform_driver_unregister (&rotator_driver); out_rotator:
@@ -445,6 +456,10 @@ static void __exit exynos_drm_exit(void)platform_driver_unregister (&ipp_driver);#endif +#ifdef CONFIG_DRM_EXYNOS_GSC +platform_driver_unregister (&gsc_driver); +#endif +#ifdef CONFIG_DRM_EXYNOS_ROTATOR platform_driver_unregister (&rotator_driver);#endif
drivers/gpu/drm/exynos/exynos_drm_drv.h +1 -0
@@ -343,5 +343,6 @@ extern struct platform_driver vidi_driver;extern struct platform_driver g2d_driver;extern struct platform_driver fimc_driver;extern struct platform_driver rotator_driver; +extern struct platform_driver gsc_driver;extern struct platform_driver ipp_driver;#endif
drivers/gpu/drm/exynos/exynos_drm_gsc.c new file +1476 -0
1,476 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_drm_gsc.h new file +35 -0
@@ -0,0 +1,35 @@ +/* +* Copyright (c) 2012 Samsung Electronics Co., Ltd. +* +* Authors: +* Eunchul Kim <[email protected]> +* Jinyoung Jeon <[email protected]> +* Sangmin Lee <[email protected]> +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _EXYNOS_DRM_GSC_H_ +#define _EXYNOS_DRM_GSC_H_ + +/* ToDo */ + +#endif /* _EXYNOS_DRM_GSC_H_ */ +
drivers/gpu/drm/exynos/regs-gsc.h new file +295 -0
295 lines not on this page · raw message
Signature · 1 line
1.7.0.4
Inki Dae
maintainer2012/10/18 Eunchul Kim <[email protected]>:
Quoted 11 lines
Hi All.
I am responsible for a display part from Samsung Electronics Telecommunication Division. and I am going to add post-processing features in exynos drm.
If you have some opinion of this patch,
please give some comments about my patch.IPP is stands for Image Post Processing and supports image scaler/rotator and input/output DMA operations using IPP
drivers(FIMC, Rotator, GSC, SC, so on.)IPP is integration device driver of same attibute hardware.
Please add more descriptions. Actually, GSC is a new hardware for Exynos5xxx SoC and later. So please, leave descriptions enough. ie. in case of Exynos4xxx SoCs, Image scaler, rotator and color space conversion had been processed by FIMC hardware. But as you know, in case of Exynos5xxx and layer, they are processed by GSC. And also the GSC can be used instead of Exynos4xxx's Video Processor. So such things should be described enough.
Quoted 28 lines
IPP drivers supports Memory to Memory operations with various converting. and some drivers supports Writeback and Display output operations using local path. User can make converted image using this driver.
and also supports streaming concept for multimedia data processing.And supports various operations
1. Scale operation generates various sizes of image.
2. CSC(Color Space Conversion) operation supports format converting.
3. Crop operation supports cutting the image.
4. Rotate operation supports to 90, 180, 270 degree.
5. Flip operation supports to vertical, horizontal, and both.
6. Writeback operation genertates cloned image from display controller(FIMD).
7. Display output operation support various format display to display controller(FIMD).
8. Input DMA reads image data from the memory.
9. Output DMA writes image data to memory.
10. Supports image effect functions.Descriptions)
User should make property informations and set this property to registers.
and IPP subsystem manages property id using command node and make queue list using memory node. IPP subsystem supports register function of IPP drivers.
IPP driver manages input/output DMA with various operations. and some driver supports optionaloperations(writeback, output).
IPP driver needs various informations, so User set property information to IPP driver. and also IPP driver needs memory base address of image for various operations. User doesn't know its address, so fills the gem handle of that memory than address of image base. and than IPP driver start operation.
Quoted 7 lines
We adds four ioctls and one event for IPP subsystem.
Basic control flow is same as below
Open -> Get properties -> User choose IPP driver and set property information -> Set Property -> Create gem handle -> Queue buffer(Enqueue) of source/destination -> Command control(Play) -> Event occured to User
-> User handle converted image -> (Queue buffer(Enqueue) of source/destination -> Event occured to User)*N -> Queue buffer(Dequeue) of source/destination -> Command control(Stop) -> Free gem handle -> Close
The above descriptions are not enough. Please add test application so that other people can understand your patch set. And let's start as RFC this time.
Quoted 49 lines
- ioctls
DRM_EXYNOS_IPP_GET_PROPERTY: get ipp driver capabilitis and id.DRM_EXYNOS_IPP_SET_PROPERTY: set format, position, rotation, flip about source/destination.DRM_EXYNOS_IPP_QUEUE_BUF: enqueue/dequeue buffer and make event list.DRM_EXYNOS_IPP_CMD_CTRL: play/stop/pause/resume control.- event
DRM_EXYNOS_IPP_EVENT: event to give notification completion of buffer DMA with buffer listEunchul Kim (4):
drm/exynos: add ipp subsystem
drm/exynos: add fimc ipp driver
drm/exynos: add rotator ipp driver
drm/exynos: add gsc ipp driverdrivers/gpu/drm/exynos/Kconfig | 24 + drivers/gpu/drm/exynos/Makefile | 4 + drivers/gpu/drm/exynos/exynos_drm_drv.c | 69 + drivers/gpu/drm/exynos/exynos_drm_drv.h | 10 + drivers/gpu/drm/exynos/exynos_drm_fimc.c | 2041 +++++++++++++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_fimc.h | 35 + drivers/gpu/drm/exynos/exynos_drm_gsc.c | 1476 +++++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_gsc.h | 35 + drivers/gpu/drm/exynos/exynos_drm_ipp.c | 1937 +++++++++++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_ipp.h | 268 ++++ drivers/gpu/drm/exynos/exynos_drm_rotator.c | 801 +++++++++++ drivers/gpu/drm/exynos/exynos_drm_rotator.h | 13 + drivers/gpu/drm/exynos/regs-fimc.h | 669 +++++++++ drivers/gpu/drm/exynos/regs-gsc.h | 295 ++++ drivers/gpu/drm/exynos/regs-rotator.h | 73 + include/drm/exynos_drm.h | 33 + include/uapi/drm/exynos_drm.h | 189 +++ 17 files changed, 7972 insertions(+), 0 deletions(-) create mode 100644 drivers/gpu/drm/exynos/exynos_drm_fimc.c create mode 100644 drivers/gpu/drm/exynos/exynos_drm_fimc.h create mode 100644 drivers/gpu/drm/exynos/exynos_drm_gsc.c create mode 100644 drivers/gpu/drm/exynos/exynos_drm_gsc.h create mode 100644 drivers/gpu/drm/exynos/exynos_drm_ipp.c create mode 100644 drivers/gpu/drm/exynos/exynos_drm_ipp.h create mode 100644 drivers/gpu/drm/exynos/exynos_drm_rotator.c create mode 100644 drivers/gpu/drm/exynos/exynos_drm_rotator.h create mode 100644 drivers/gpu/drm/exynos/regs-fimc.h create mode 100644 drivers/gpu/drm/exynos/regs-gsc.h create mode 100644 drivers/gpu/drm/exynos/regs-rotator.h_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Thank's comment
and I will modify description of Exynos5 series. and than I will send it.
Quoted 13 lines · Inki Dae
2012/10/18 Eunchul Kim <[email protected]>:
Quoted 11 lines
Hi All.
I am responsible for a display part from Samsung Electronics Telecommunication Division. and I am going to add post-processing features in exynos drm.
If you have some opinion of this patch,
please give some comments about my patch.IPP is stands for Image Post Processing and supports image scaler/rotator and input/output DMA operations using IPP
drivers(FIMC, Rotator, GSC, SC, so on.)IPP is integration device driver of same attibute hardware.
Quoted 7 lines
Please add more descriptions. Actually, GSC is a new hardware for Exynos5xxx SoC and later. So please, leave descriptions enough. ie. in case of Exynos4xxx SoCs, Image scaler, rotator and color space conversion had been processed by FIMC hardware. But as you know, in case of Exynos5xxx and layer, they are processed by GSC. And also the GSC can be used instead of Exynos4xxx's Video Processor. So such things should be described enough.
OK I will add more descriptions.
Quoted 37 lines
Quoted 29 lines
IPP drivers supports Memory to Memory operations with various converting. and some drivers supports Writeback and Display output operations using local path. User can make converted image using this driver.
and also supports streaming concept for multimedia data processing.And supports various operations
1. Scale operation generates various sizes of image.
2. CSC(Color Space Conversion) operation supports format converting.
3. Crop operation supports cutting the image.
4. Rotate operation supports to 90, 180, 270 degree.
5. Flip operation supports to vertical, horizontal, and both.
6. Writeback operation genertates cloned image from display controller(FIMD).
7. Display output operation support various format display to display controller(FIMD).
8. Input DMA reads image data from the memory.
9. Output DMA writes image data to memory.
10. Supports image effect functions.Descriptions)
User should make property informations and set this property to registers.
and IPP subsystem manages property id using command node and make queue list using memory node. IPP subsystem supports register function of IPP drivers.
IPP driver manages input/output DMA with various operations. and some driver supports optionaloperations(writeback, output).
IPP driver needs various informations, so User set property information to IPP driver. and also IPP driver needs memory base address of image for various operations. User doesn't know its address, so fills the gem handle of that memory than address of image base. and than IPP driver start operation.Quoted 7 lines
We adds four ioctls and one event for IPP subsystem.
Basic control flow is same as below
Open -> Get properties -> User choose IPP driver and set property information -> Set Property -> Create gem handle -> Queue buffer(Enqueue) of source/destination -> Command control(Play) -> Event occured to User
-> User handle converted image -> (Queue buffer(Enqueue) of source/destination -> Event occured to User)*N -> Queue buffer(Dequeue) of source/destination -> Command control(Stop) -> Free gem handle -> Close
Quoted 4 lines
The above descriptions are not enough. Please add test application so that other people can understand your patch set. And let's start as RFC this time.
Do you want to attach ipptest application in libdrm ?
Quoted 50 lines
Quoted 49 lines
- ioctls
DRM_EXYNOS_IPP_GET_PROPERTY: get ipp driver capabilitis and id.DRM_EXYNOS_IPP_SET_PROPERTY: set format, position, rotation, flip about source/destination.DRM_EXYNOS_IPP_QUEUE_BUF: enqueue/dequeue buffer and make event list.DRM_EXYNOS_IPP_CMD_CTRL: play/stop/pause/resume control.- event
DRM_EXYNOS_IPP_EVENT: event to give notification completion of buffer DMA with buffer listEunchul Kim (4):
drm/exynos: add ipp subsystem
drm/exynos: add fimc ipp driver
drm/exynos: add rotator ipp driver
drm/exynos: add gsc ipp driverdrivers/gpu/drm/exynos/Kconfig | 24 + drivers/gpu/drm/exynos/Makefile | 4 + drivers/gpu/drm/exynos/exynos_drm_drv.c | 69 + drivers/gpu/drm/exynos/exynos_drm_drv.h | 10 + drivers/gpu/drm/exynos/exynos_drm_fimc.c | 2041 +++++++++++++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_fimc.h | 35 + drivers/gpu/drm/exynos/exynos_drm_gsc.c | 1476 +++++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_gsc.h | 35 + drivers/gpu/drm/exynos/exynos_drm_ipp.c | 1937 +++++++++++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_ipp.h | 268 ++++ drivers/gpu/drm/exynos/exynos_drm_rotator.c | 801 +++++++++++ drivers/gpu/drm/exynos/exynos_drm_rotator.h | 13 + drivers/gpu/drm/exynos/regs-fimc.h | 669 +++++++++ drivers/gpu/drm/exynos/regs-gsc.h | 295 ++++ drivers/gpu/drm/exynos/regs-rotator.h | 73 + include/drm/exynos_drm.h | 33 + include/uapi/drm/exynos_drm.h | 189 +++ 17 files changed, 7972 insertions(+), 0 deletions(-)create mode 100644
drivers/gpu/drm/exynos/exynos_drm_fimc.ccreate mode 100644drivers/gpu/drm/exynos/exynos_drm_fimc.hcreate mode 100644drivers/gpu/drm/exynos/exynos_drm_gsc.ccreate mode 100644drivers/gpu/drm/exynos/exynos_drm_gsc.hcreate mode 100644drivers/gpu/drm/exynos/exynos_drm_ipp.ccreate mode 100644drivers/gpu/drm/exynos/exynos_drm_ipp.hcreate mode 100644drivers/gpu/drm/exynos/exynos_drm_rotator.ccreate mode 100644drivers/gpu/drm/exynos/exynos_drm_rotator.hcreate mode 100644drivers/gpu/drm/exynos/regs-fimc.hcreate mode 100644drivers/gpu/drm/exynos/regs-gsc.hcreate mode 100644drivers/gpu/drm/exynos/regs-rotator.h_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel