Skip to contentSkip to conversation

drm/exynos: add ipp subsystem and each ipp drivers

RFC New Eunchul Kim 1 participant 6 messages Dec 14, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v5 cover drm/exynos: 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 opinions of this patch,
please give some comments about my patch.

Changelog v5:
This RFC v5 changed TODO list for arrangement.
Supports devm_ fuction in resource handling.
Arranged comments and added description.
Changed return value for right detect error.
Added GSC definition.

Changelog v4:
This RFC v4 changed ipp subsystem for arrangement.
Remove EXPORT_SYMBOL_GPL in ipp subsystem.
Added error handling in ipp subsystem.
Change set_transf return from swap to ret and use pointer about swap. Seperated function in Rotator.

Changelog v3:
This RFC v3 changed ipp subsystem for arrangement. Fixed scaler problem in GSC.
Added/Removed comment from Inki.Dae.
Fixed Joonyoung.Shim comment.
Added rotator comments.

Changelog v2:
This RFC v2 supports iommu in ipp. and Added/Removed comment from Inki.Dae. Fixed GSC part bugs and next time I will send our local git commit. and We finished implementation of SC for post-processing.
SC driver not fully tested yet. so, I didn't add SC feature in this patch.

Changelog v1:

This patch is post-processing(IPP) support for exynos drm driver.

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.

Exynos4xxxx SoC support FIMC, Rotator for post-processing. and Exynos5xxxx SoC support GSC, Rotator, SC for post-processing. SC driver not tested yet. so, I didn't add SC feature in this patch. and IPP subsystem works on Exynos SoC version independently.

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.

Ioctls)
We adds four ioctls and one event for IPP subsystem.

- 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 list

Basic control flow and Sample pseudo application)
1. 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

2. Sample pseudo application
#include "exynos_drm.h"
static int exynos_drm_ipp_set_property(int fd ...)

{
	struct drm_exynos_pos crop_pos = {0, 0, hsize, vsize};
	struct drm_exynos_pos scale_pos = {0, 0, hsize, vsize};
	struct drm_exynos_sz src_sz = {hsize, vsize};
	struct drm_exynos_sz dst_sz = {hsize, vsize};
	int ret = 0;

	memset(property, 0x00, sizeof(struct drm_exynos_ipp_property));
	property->cmd = cmd;

	property->config[EXYNOS_DRM_OPS_SRC].ops_id = EXYNOS_DRM_OPS_SRC;
	property->config[EXYNOS_DRM_OPS_SRC].flip = EXYNOS_DRM_FLIP_NONE;
	property->config[EXYNOS_DRM_OPS_SRC].degree = EXYNOS_DRM_DEGREE_0;
	property->config[EXYNOS_DRM_OPS_SRC].fmt = DRM_FORMAT_XRGB8888;
	property->config[EXYNOS_DRM_OPS_SRC].pos = crop_pos;
	property->config[EXYNOS_DRM_OPS_SRC].sz = src_sz;

	property->config[EXYNOS_DRM_OPS_DST].ops_id = EXYNOS_DRM_OPS_DST;
	property->config[EXYNOS_DRM_OPS_DST].flip = EXYNOS_DRM_FLIP_NONE;
	property->config[EXYNOS_DRM_OPS_DST].degree = degree;
	property->config[EXYNOS_DRM_OPS_DST].fmt = DRM_FORMAT_XRGB8888;
	property->config[EXYNOS_DRM_OPS_DST].pos = scale_pos;
	property->config[EXYNOS_DRM_OPS_DST].sz = dst_sz;

	ret = ioctl(fd, DRM_IOCTL_EXYNOS_IPP_SET_PROPERTY, property);
	if (ret)
		fprintf(stderr,
			"failed to DRM_IOCTL_EXYNOS_IPP_SET_PROPERTY : %s\n",
			strerror(errno));
	
	printf("DRM_IOCTL_EXYNOS_IPP_SET_PROPERTY : prop_id[%d]\n",
		property->prop_id);

	return ret;
}

static int exynos_drm_ipp_queue_buf(int fd, ..., unsigned int gem_handle)

{
	int ret = 0;

	memset(qbuf, 0x00, sizeof(struct drm_exynos_ipp_queue_buf));

	qbuf->ops_id = ops_id;
	qbuf->buf = buf;
	qbuf->user_data = 0;
	qbuf->prop_id = prop_id;
	qbuf->buf_id = buf_id;
	qbuf->handle[EXYNOS_DRM_PLANAR_Y] = gem_handle;
	qbuf->handle[EXYNOS_DRM_PLANAR_CB] = 0;
	qbuf->handle[EXYNOS_DRM_PLANAR_CR] = 0;

	ret = ioctl(fd, DRM_IOCTL_EXYNOS_IPP_QUEUE_BUF, qbuf);
	if (ret)
		fprintf(stderr,
		"failed to DRM_IOCTL_EXYNOS_IPP_QUEUE_BUF[id:%d][buf:%d] : %s\n",
		ops_id, buf, strerror(errno));
 
	return ret;
}

static int exynos_drm_ipp_cmd_ctrl(int fd, ...)

{
	int ret = 0;

	memset(cmd_ctrl, 0x00, sizeof(struct drm_exynos_ipp_cmd_ctrl));

	cmd_ctrl->prop_id = prop_id;
	cmd_ctrl->ctrl = ctrl;

	ret = ioctl(fd, DRM_IOCTL_EXYNOS_IPP_CMD_CTRL, cmd_ctrl);
	if (ret)
		fprintf(stderr,
		"failed to DRM_IOCTL_EXYNOS_IPP_CMD_CTRL[prop_id:%d][ctrl:%d] : %s\n",
		prop_id, ctrl, strerror(errno));

	return ret;
}

int ipp_event_handler(...)

{
	char buffer[1024];
	int len, i;
	struct drm_event *e;
	struct drm_exynos_ipp_event *ipp_event;
	char filename[100];
	int ret = 0;
	int src_buf_id, dst_buf_id;
	static bmp_idx = 0;

	len = read(fd, buffer, sizeof buffer);
	if (len == 0)
		return 0;
	if (len < sizeof *e)
		return -1;

	i = 0;
	while (i < len) {
		e = (struct drm_event *) &buffer[i];
		switch (e->type) {
		case DRM_EXYNOS_IPP_EVENT:
			ipp_event = (struct drm_exynos_ipp_event *) e;
			src_buf_id = ipp_event->buf_id[EXYNOS_DRM_OPS_SRC];
			dst_buf_id = ipp_event->buf_id[EXYNOS_DRM_OPS_DST];

			/* For source buffer queue to IPP */
			ret = exynos_drm_ipp_queue_buf(fd, &src_qbuf[src_buf_id], EXYNOS_DRM_OPS_SRC,
						IPP_BUF_ENQUEUE, property->prop_id,
						src_buf_id, src_gem[src_buf_id].handle);
			if (ret) {
				fprintf(stderr, "failed to ipp buf src queue\n");
				goto err_ipp_ctrl_close;
			}

			/* For destination buffer queue to IPP */
			ret = exynos_drm_ipp_queue_buf(fd, &dst_qbuf[dst_buf_id], EXYNOS_DRM_OPS_DST,
						IPP_BUF_ENQUEUE, property->prop_id,
						dst_buf_id, dst_gem[dst_buf_id].handle);
			if (ret) {
				fprintf(stderr, "failed to ipp buf dst queue\n");
				goto err_ipp_ctrl_close;
			}
			break;
		default:
			break;
		}
		i += e->length;
	}

err_ipp_ctrl_close:

	return ret;
}

void ipp_main(...)

{
	struct drm_exynos_ipp_property property;
	struct drm_exynos_ipp_cmd_ctrl cmd_ctrl;
	struct drm_exynos_sz def_sz = {720, 1280};
	struct drm_exynos_ipp_queue_buf qbuf1[MAX_BUF], qbuf2[MAX_BUF];
	unsigned int width=720, height=1280, stride;
	int ret, i, j, x;
	struct drm_exynos_gem_create gem1[MAX_BUF], gem2[MAX_BUF];
	struct drm_exynos_gem_mmap mmap1[MAX_BUF], mmap2[MAX_BUF];
	void *usr_addr1[MAX_BUF], *usr_addr2[MAX_BUF];
	struct timeval begin, end;
	struct drm_gem_close args;
	char filename[100];

	/* For property */
	ret = exynos_drm_ipp_set_property(fd, &property, &def_sz, IPP_CMD_M2M, EXYNOS_DRM_DEGREE_0);
	if (ret) {
		fprintf(stderr, "failed to ipp property\n");
		return;
	}

	for (i = 0; i < MAX_BUF; i++) {
		/* For source buffer map to IPP */
		ret = exynos_drm_ipp_queue_buf(fd, &qbuf1[i], EXYNOS_DRM_OPS_SRC,
				IPP_BUF_ENQUEUE, property.prop_id, i, gem1[i].handle);
		if (ret) {
			fprintf(stderr, "failed to ipp buf src map\n");
			goto err_ipp_ctrl_close;
		}
	}

	for (i = 0; i < MAX_BUF; i++) {
		/* For destination buffer map to IPP */
		ret = exynos_drm_ipp_queue_buf(fd, &qbuf2[i], EXYNOS_DRM_OPS_DST,
			IPP_BUF_ENQUEUE, property.prop_id, i, gem2[i].handle);
		if (ret) {
			fprintf(stderr, "failed to ipp buf dst map\n");
			goto err_ipp_ctrl_close;
		}
	}

	/* Start */
	gettimeofday(&begin, NULL);
	ret = exynos_drm_ipp_cmd_ctrl(fd, &cmd_ctrl, property.prop_id, IPP_CTRL_PLAY);
	if (ret) {
		fprintf(stderr,
		"failed to ipp ctrl IPP_CMD_M2M start\n");
		goto err_ipp_ctrl_close;
	}
        
	j=0;
	while (1) {
		struct timeval timeout = { .tv_sec = 3, .tv_usec = 0 };
		fd_set fds;

		FD_ZERO(&fds);
		FD_SET(0, &fds);
		FD_SET(fd, &fds);
		ret = select(fd + 1, &fds, NULL, NULL, &timeout);
		if (ret <= 0) {
			fprintf(stderr, "select timed out or error.\n");
			continue;
		} else if (FD_ISSET(0, &fds)) {
			break;
		}

		gettimeofday(&end, NULL);
		usec[j] = (end.tv_sec - begin.tv_sec) * 1000000 +
		(end.tv_usec - begin.tv_usec);

		if(ipp_event_handler() < 0)
			break;

		if (++j > MAX_LOOP)
			break;

		gettimeofday(&begin, NULL);
	}

err_ipp_ctrl_close:

	/* For source buffer dequeue to IPP */
	for (i = 0; i < MAX_BUF; i++) {
		ret = exynos_drm_ipp_queue_buf(fd, &qbuf1[i], EXYNOS_DRM_OPS_SRC,
						IPP_BUF_DEQUEUE, property.prop_id, i, gem1[i].handle);
		if (ret < 0)
			fprintf(stderr, "failed to ipp buf dst dequeue\n");
	}

	/* For destination buffer dequeue to IPP */
	for (i = 0; i < MAX_BUF; i++) {
		ret = exynos_drm_ipp_queue_buf(fd, &qbuf2[i], EXYNOS_DRM_OPS_DST,
						IPP_BUF_DEQUEUE, property.prop_id, i, gem2[i].handle);
		if (ret < 0)
			fprintf(stderr, "failed to ipp buf dst dequeue\n");
	}

	/* Stop */
	ret = exynos_drm_ipp_cmd_ctrl(fd, &cmd_ctrl, property.prop_id, IPP_CTRL_STOP);
	if (ret)
		fprintf(stderr, "failed to ipp ctrl IPP_CMD_WB stop\n");

	return;
}

Eunchul Kim (5):
drm/exynos: add ipp subsystem
drm/exynos: add iommu support for ipp
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    | 2002 ++++++++++++++++++++++++++
 drivers/gpu/drm/exynos/exynos_drm_fimc.h    |   37 +
 drivers/gpu/drm/exynos/exynos_drm_gsc.c     | 1870 ++++++++++++++++++++++++
 drivers/gpu/drm/exynos/exynos_drm_gsc.h     |   38 +
 drivers/gpu/drm/exynos/exynos_drm_ipp.c     | 2060 +++++++++++++++++++++++++++
 drivers/gpu/drm/exynos/exynos_drm_ipp.h     |  266 ++++
 drivers/gpu/drm/exynos/exynos_drm_rotator.c |  856 +++++++++++
 drivers/gpu/drm/exynos/exynos_drm_rotator.h |   33 +
 drivers/gpu/drm/exynos/regs-fimc.h          |  669 +++++++++
 drivers/gpu/drm/exynos/regs-gsc.h           |  284 ++++
 drivers/gpu/drm/exynos/regs-rotator.h       |   73 +
 include/drm/exynos_drm.h                    |   26 +
 include/uapi/drm/exynos_drm.h               |  190 +++
 17 files changed, 8511 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
#1 lore raw

RFC v5 1/5 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 | 2042 +++++++++++++++++++++++++++++++
 drivers/gpu/drm/exynos/exynos_drm_ipp.h |  266 ++++
 include/uapi/drm/exynos_drm.h           |  190 +++
 7 files changed, 2536 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
index 4ea8cdc..bcf1c9d 100644
@@ -45,3 +45,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
index 26813b8..6c536ce 100644
@@ -16,5 +16,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
index 4a1168d..0eb8a97 100644
@@ -40,6 +40,7 @@
 #include "exynos_drm_vidi.h"
 #include "exynos_drm_dmabuf.h"
 #include "exynos_drm_g2d.h"
+#include "exynos_drm_ipp.h"
 #include "exynos_drm_iommu.h"
 
 #define DRIVER_NAME	"exynos"
@@ -249,6 +250,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 = {
@@ -363,6 +372,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;
@@ -380,6 +395,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:
@@ -416,6 +436,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
index a9db025..a365788 100644
@@ -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;
 };
 
 /*
@@ -346,4 +352,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 +2042 -0

2,042 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_drm_ipp.h new file +266 -0

266 lines not on this page · raw message

include/uapi/drm/exynos_drm.h +190 -0

214 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#2 lore raw

RFC v5 2/5 drm/exynos: add iommu support for ipp

In reply to Eunchul Kim

This patch adds iommu support for ipp.
For this, it adds subdrv_probe/remove callback to enable or disable ipp iommu. we can get or put device address to a gem handle from user through exynos_drm_gem_get/put_dma_addr().

---
 drivers/gpu/drm/exynos/exynos_drm_ipp.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_ipp.c +18 -0
index c640935..49eebe9 100644
@@ -24,6 +24,7 @@
 #include "exynos_drm_drv.h"
 #include "exynos_drm_gem.h"
 #include "exynos_drm_ipp.h"
+#include "exynos_drm_iommu.h"
 
 /*
  * IPP is stand for Image Post Processing and
@@ -1771,10 +1772,24 @@ static int ipp_subdrv_probe(struct drm_device *drm_dev, struct device *dev)
 		ippdrv->event_workq = ctx->event_workq;
 		ippdrv->sched_event = ipp_sched_event;
 		INIT_LIST_HEAD(&ippdrv->cmd_list);
+
+		if (is_drm_iommu_supported(drm_dev)) {
+			ret = drm_iommu_attach_device(drm_dev, ippdrv->dev);
+			if (ret) {
+				DRM_ERROR("failed to activate iommu\n");
+				goto err_iommu;
+			}
+		}
 	}
 
 	return 0;
 
+err_iommu:
+	/* get ipp driver entry */
+	list_for_each_entry_reverse(ippdrv, &exynos_drm_ippdrv_list, drv_list)
+		if (is_drm_iommu_supported(drm_dev))
+			drm_iommu_detach_device(drm_dev, ippdrv->dev);
+
 err_idr:
 	idr_remove_all(&ctx->ipp_idr);
 	idr_remove_all(&ctx->prop_idr);
@@ -1791,6 +1806,9 @@ static void ipp_subdrv_remove(struct drm_device *drm_dev, struct device *dev)
 
 	/* get ipp driver entry */
 	list_for_each_entry(ippdrv, &exynos_drm_ippdrv_list, drv_list) {
+		if (is_drm_iommu_supported(drm_dev))
+			drm_iommu_detach_device(drm_dev, ippdrv->dev);
+
 		ippdrv->drm_dev = NULL;
 		exynos_drm_ippdrv_unregister(ippdrv);
 	}
Signature · 1 line
1.7.0.4
#3 lore raw

RFC v5 3/5 drm/exynos: add fimc ipp driver

In reply to Eunchul Kim

FIMC 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 | 2002 ++++++++++++++++++++++++++++++
 drivers/gpu/drm/exynos/exynos_drm_fimc.h |   37 +
 drivers/gpu/drm/exynos/regs-fimc.h       |  669 ++++++++++
 include/drm/exynos_drm.h                 |   26 +
 8 files changed, 2757 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
index bcf1c9d..4915ab6 100644
@@ -51,3 +51,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
index 6c536ce..9710024 100644
@@ -17,5 +17,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
index 0eb8a97..73f02ac 100644
@@ -372,6 +372,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)
@@ -400,6 +406,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:
@@ -440,6 +451,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
index a365788..14f9490 100644
@@ -352,5 +352,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 +2002 -0

2,002 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_drm_fimc.h new file +37 -0
new file mode 100644
index 0000000..dc970fa
@@ -0,0 +1,37 @@
+/*
+ * 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
+ * FIMD output interface notifier callback.
+ */
+
+#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 +26 -0
index 3c13a3a..808dad2 100644
@@ -85,4 +85,30 @@ struct exynos_drm_hdmi_pdata {
 	int (*get_hpd)(void);
 };
 
+/**
+ * Platform Specific Structure for DRM based IPP.
+ *
+ * @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_ipp_pol {
+	unsigned int inv_pclk;
+	unsigned int inv_vsync;
+	unsigned int inv_href;
+	unsigned int inv_hsync;
+};
+
+/**
+ * Platform Specific Structure for DRM based FIMC.
+ *
+ * @pol: current hardware block polarity settings.
+ * @clk_rate: current hardware clock rate.
+ */
+struct exynos_drm_fimc_pdata {
+	struct exynos_drm_ipp_pol pol;
+	int clk_rate;
+};
+
 #endif	/* _EXYNOS_DRM_H_ */
Signature · 1 line
1.7.0.4
#4 lore raw

RFC v5 4/5 drm/exynos: add rotator ipp driver

In reply to Eunchul Kim

Rotator 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              |    7 +
 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 |  856 +++++++++++++++++++++++++++
 drivers/gpu/drm/exynos/exynos_drm_rotator.h |   33 +
 drivers/gpu/drm/exynos/regs-rotator.h       |   73 +++
 7 files changed, 986 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 +7 -0
index 4915ab6..4860835 100644
@@ -57,3 +57,10 @@ 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
index 9710024..3b70668 100644
@@ -18,5 +18,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
index 73f02ac..09d884b 100644
@@ -378,6 +378,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)
@@ -406,6 +412,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:
@@ -451,6 +462,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
index 14f9490..a74e37c 100644
@@ -353,5 +353,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 +856 -0

856 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_drm_rotator.h new file +33 -0
new file mode 100644
index 0000000..a2d7a14
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *
+ * Authors:
+ *	YoungJun Cho <[email protected]>
+ *	Eunchul Kim <[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_ROTATOR_H_
+#define	_EXYNOS_DRM_ROTATOR_H_
+
+/* TODO */
+
+#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
#5 lore raw

RFC v5 5/5 drm/exynos: add gsc ipp driver

In reply to Eunchul Kim

GSC is stand for General SCaler 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.
GSC supports image rotation and image effect functions, also supports writeback and display output operations. M2M operation : supports crop/scale/rotation/csc so on.
Memory ---> GSC H/W ---> Memory.
Writeback operation : supports cloned screen with FIMD.
FIMD ---> GSC H/W ---> Memory.
Output operation : supports direct display using local path.
Memory ---> GSC H/W ---> FIMD, Mixer.

Changelog v5
- Changed return type
- Define hard coding value
- Changed to devm_ function

---
 drivers/gpu/drm/exynos/Kconfig          |    5 +
 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 | 1870 +++++++++++++++++++++++++++++++
 drivers/gpu/drm/exynos/exynos_drm_gsc.h |   38 +
 drivers/gpu/drm/exynos/regs-gsc.h       |  284 +++++
 7 files changed, 2214 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 +5 -0
index 4860835..c93d776 100644
@@ -64,3 +64,8 @@ config DRM_EXYNOS_ROTATOR
 	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
index 3b70668..639b49e 100644
@@ -19,5 +19,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
index 09d884b..e0a8e80 100644
@@ -384,6 +384,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)
@@ -412,6 +418,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:
@@ -462,6 +473,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
index a74e37c..afe556c 100644
@@ -354,5 +354,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 +1870 -0

1,870 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_drm_gsc.h new file +38 -0
new file mode 100644
index 0000000..b3c3bc6
@@ -0,0 +1,38 @@
+/*
+ * 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
+ * FIMD output interface notifier callback.
+ * Mixer output interface notifier callback.
+ */
+
+#endif /* _EXYNOS_DRM_GSC_H_ */
drivers/gpu/drm/exynos/regs-gsc.h new file +284 -0

284 lines not on this page · raw message

Signature · 1 line
1.7.0.4