Skip to contentSkip to conversation

DRM: add DRM Driver for Samsung SoC EXYNOS4210.

RFC PATCH Superseded Inki Dae 3 participants 8 messages Jul 29, 2011 – Aug 4, 2011

Subsystems (4)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Inki Dae

author
#0 lore raw

RFC PATCH 1/1 DRM: add DRM Driver for Samsung SoC EXYNOS4210.

This patch is a DRM Driver(only including FIMD Driver yet)
for Samsung SoC Exynos4210. and as RFC, I am sending only DRM driver part.

this patch is based on git repository below:
git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6.git,
branch: drm-next
commit-id: 5a96a899bbdee86024ab9ea6d02b9e242faacbed

We tried to re-use lowlevel codes of the FIMD driver(s3c-fb.c based on Linux framebuffer) but couldn't so because lowlevel codes of s3c-fb.c are included internally and so this driver shares only platform device.

Sub drivers such as fimd or hdmi have indenpendent platform device and Platform driver and when driver's probe is called, the driver object including callbacks(for hardware control) would be registered to Samsung drm driver. and then when samsung drm driver is probed, each probe callback of the driver object registered is called so that additional callbacks for drm framework would be set at this time.

We used GEM framework for buffer management and this driver supports only physically continuous memory yet(non-iommu). and for buffer allocation, we used DMA APIs(dma_alloc_writecombine) but we will change it to CMA instead of DMA APIs later.

Refer to this link for CMA(Continuous Memory Allocator):
http://lkml.org/lkml/2011/7/20/45

Future works:
- HDMI support.
- drm plane feature support.
refer to this link for drm plane feature:
http://www.spinics.net/lists/dri-devel/msg11778.html
- change the allocator to CMA.
- iommu support.(for non-continuous physical memory usage)
- fimd driver update.
- add exception codes and code clean.

to support all features above, we need long time and hard work. so we wish that only some features(fimd and non-iommu) are applied to mainline first.

We would be pleased you to give us your comments.

---
 arch/arm/plat-samsung/include/plat/samsung_drm.h |   63 ++
 drivers/gpu/drm/Kconfig                          |   10 +
 drivers/gpu/drm/Makefile                         |    1 +
 drivers/gpu/drm/samsung/Makefile                 |   10 +
 drivers/gpu/drm/samsung/samsung_drm_buf.c        |  140 +++++
 drivers/gpu/drm/samsung/samsung_drm_buf.h        |   78 +++
 drivers/gpu/drm/samsung/samsung_drm_common.h     |   40 ++
 drivers/gpu/drm/samsung/samsung_drm_connector.c  |  346 +++++++++++
 drivers/gpu/drm/samsung/samsung_drm_connector.h  |   39 ++
 drivers/gpu/drm/samsung/samsung_drm_crtc.c       |  300 ++++++++++
 drivers/gpu/drm/samsung/samsung_drm_crtc.h       |   53 ++
 drivers/gpu/drm/samsung/samsung_drm_dispc.h      |   49 ++
 drivers/gpu/drm/samsung/samsung_drm_drv.c        |  379 ++++++++++++
 drivers/gpu/drm/samsung/samsung_drm_encoder.c    |  242 ++++++++
 drivers/gpu/drm/samsung/samsung_drm_encoder.h    |   37 ++
 drivers/gpu/drm/samsung/samsung_drm_fb.c         |  290 +++++++++
 drivers/gpu/drm/samsung/samsung_drm_fb.h         |   46 ++
 drivers/gpu/drm/samsung/samsung_drm_fbdev.c      |  303 ++++++++++
 drivers/gpu/drm/samsung/samsung_drm_fbdev.h      |   37 ++
 drivers/gpu/drm/samsung/samsung_drm_fimd.c       |  676 ++++++++++++++++++++++
 drivers/gpu/drm/samsung/samsung_drm_gem.c        |  412 +++++++++++++
 drivers/gpu/drm/samsung/samsung_drm_gem.h        |   72 +++
 drivers/gpu/drm/samsung/samsung_drm_ump.c        |  105 ++++
 include/drm/samsung_drm.h                        |  258 ++++++++
 24 files changed, 3986 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-samsung/include/plat/samsung_drm.h
 create mode 100644 drivers/gpu/drm/samsung/Makefile
 create mode 100644 drivers/gpu/drm/samsung/samsung_drm_buf.c
 create mode 100644 drivers/gpu/drm/samsung/samsung_drm_buf.h
 create mode 100644 drivers/gpu/drm/samsung/samsung_drm_common.h
 create mode 100644 drivers/gpu/drm/samsung/samsung_drm_connector.c
 create mode 100644 drivers/gpu/drm/samsung/samsung_drm_connector.h
 create mode 100644 drivers/gpu/drm/samsung/samsung_drm_crtc.c
 create mode 100644 drivers/gpu/drm/samsung/samsung_drm_crtc.h
 create mode 100644 drivers/gpu/drm/samsung/samsung_drm_dispc.h
 create mode 100644 drivers/gpu/drm/samsung/samsung_drm_drv.c
 create mode 100644 drivers/gpu/drm/samsung/samsung_drm_encoder.c
 create mode 100644 drivers/gpu/drm/samsung/samsung_drm_encoder.h
 create mode 100644 drivers/gpu/drm/samsung/samsung_drm_fb.c
 create mode 100644 drivers/gpu/drm/samsung/samsung_drm_fb.h
 create mode 100644 drivers/gpu/drm/samsung/samsung_drm_fbdev.c
 create mode 100644 drivers/gpu/drm/samsung/samsung_drm_fbdev.h
 create mode 100644 drivers/gpu/drm/samsung/samsung_drm_fimd.c
 create mode 100644 drivers/gpu/drm/samsung/samsung_drm_gem.c
 create mode 100644 drivers/gpu/drm/samsung/samsung_drm_gem.h
 create mode 100644 drivers/gpu/drm/samsung/samsung_drm_ump.c
 create mode 100644 include/drm/samsung_drm.h
arch/arm/plat-samsung/include/plat/samsung_drm.h new file +63 -0
new file mode 100644
index 0000000..db9c9fa
@@ -0,0 +1,63 @@
+/* samsung_drm.h
+ *
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ * Authors:
+ *	Inki Dae <[email protected]>
+ *	Joonyoung Shim <[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.
+ */
+
+enum samsung_drm_output_type {
+	SAMSUNG_DISPLAY_TYPE_NONE,
+	SAMSUNG_DISPLAY_TYPE_LCD,	/* RGB or CPU Interface. */
+	SAMSUNG_DISPLAY_TYPE_MIPI,	/* MIPI-DSI Interface. */
+	SAMSUNG_DISPLAY_TYPE_HDMI,	/* HDMI Interface. */
+	SAMSUNG_DISPLAY_TYPE_VENC,
+};
+
+struct samsung_video_timings {
+	u16 x_res;
+	u16 y_res;
+	u16 hsw;
+	u16 hfp;
+	u16 hbp;
+	u16 vsw;
+	u16 vfp;
+	u16 vbp;
+	u32 framerate;
+	u32 vclk;	/* Hz, calcurate from driver */
+};
+
+struct samsung_drm_manager_data {
+	unsigned int display_type;
+	unsigned int overlay_nr;
+	unsigned int overlay_num;
+	unsigned int bpp;
+};
+
+struct samsung_drm_fimd_pdata {
+	struct samsung_drm_manager_data	manager_data;
+	struct samsung_video_timings	timing;
+	void				(*setup_gpio)(void);
+	u32				vidcon0;
+	u32				vidcon1;
+};
drivers/gpu/drm/Kconfig +10 -0
index b493663..3a0eac0 100644
@@ -158,3 +158,13 @@ config DRM_SAVAGE
 	help
 	  Choose this option if you have a Savage3D/4/SuperSavage/Pro/Twister
 	  chipset. If M is selected the module will be called savage.
+
+config DRM_SAMSUNG
+	tristate "DRM Support for Samsung SoC EXYNOS Series"
+	depends on DRM && PLAT_SAMSUNG
+	select DRM_KMS_HELPER
+	select FB_CFB_FILLRECT
+	select FB_CFB_COPYAREA
+	select FB_CFB_IMAGEBLIT
+	help
+	  Choose this option if you have a Samsung SoC EXYNOS chipset.
drivers/gpu/drm/Makefile +1 -0
index 89cf05a..0c6e773 100644
@@ -35,4 +35,5 @@ obj-$(CONFIG_DRM_SAVAGE)+= savage/
 obj-$(CONFIG_DRM_VMWGFX)+= vmwgfx/
 obj-$(CONFIG_DRM_VIA)	+=via/
 obj-$(CONFIG_DRM_NOUVEAU) +=nouveau/
+obj-$(CONFIG_DRM_SAMSUNG) +=samsung/
 obj-y			+= i2c/
drivers/gpu/drm/samsung/Makefile new file +10 -0
new file mode 100644
index 0000000..33504fa
@@ -0,0 +1,10 @@
+#
+# Makefile for the drm device driver.  This driver provides support for the
+# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
+
+ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/samsung -Idrivers/gpu/drm/samsung/ump/include
+samsungdrm-y := samsung_drm_drv.o samsung_drm_encoder.o samsung_drm_connector.o \
+		samsung_drm_crtc.o samsung_drm_fbdev.o samsung_drm_fb.o \
+		samsung_drm_buf.o samsung_drm_fimd.o samsung_drm_gem.o
+
+obj-$(CONFIG_DRM_SAMSUNG) += samsungdrm.o
drivers/gpu/drm/samsung/samsung_drm_buf.c new file +140 -0

140 lines not on this page · raw message

drivers/gpu/drm/samsung/samsung_drm_buf.h new file +78 -0

78 lines not on this page · raw message

drivers/gpu/drm/samsung/samsung_drm_common.h new file +40 -0
new file mode 100644
index 0000000..ba92b87
@@ -0,0 +1,40 @@
+/* samsung_drm_common.h
+ *
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ * Autohr: Inki Dae <[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 _SAMSUNG_DRM_COMMON_H
+#define _SAMSUNG_DRM_COMMON_H
+
+/* get samsung_drm_manager from drm_encoder. */
+struct samsung_drm_manager *
+samsung_drm_get_manager(struct drm_encoder *encoder);
+
+/* get drm_encoder from drm_connector. */
+struct drm_encoder *
+	samsung_drm_get_attached_encoder(struct drm_connector *connector);
+
+struct samsung_drm_display *
+	get_display_from_connector(struct drm_connector *connector);
+
+#endif
drivers/gpu/drm/samsung/samsung_drm_connector.c new file +346 -0

346 lines not on this page · raw message

drivers/gpu/drm/samsung/samsung_drm_connector.h new file +39 -0
new file mode 100644
index 0000000..ed7be57
@@ -0,0 +1,39 @@
+/* samsung_drm_connector.h
+ *
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ * Authors:
+ *	Inki Dae <[email protected]>
+ *	Joonyoung Shim <[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 _SAMSUNG_DRM_CONNECTOR_H_
+#define _SAMSUNG_DRM_CONNECTOR_H_
+
+ /* initialize connector. (drm and samsung SoC specific connector) */
+int samsung_drm_connector_create(struct drm_device *dev,
+				 struct drm_encoder *encoder);
+
+/* get an encoder attached to an connector. */
+struct drm_encoder *
+	samsung_drm_get_attached_encoder(struct drm_connector *connector);
+
+#endif
drivers/gpu/drm/samsung/samsung_drm_crtc.c new file +300 -0

300 lines not on this page · raw message

drivers/gpu/drm/samsung/samsung_drm_crtc.h new file +53 -0

53 lines not on this page · raw message

drivers/gpu/drm/samsung/samsung_drm_dispc.h new file +49 -0

49 lines not on this page · raw message

drivers/gpu/drm/samsung/samsung_drm_drv.c new file +379 -0

379 lines not on this page · raw message

drivers/gpu/drm/samsung/samsung_drm_encoder.c new file +242 -0

242 lines not on this page · raw message

drivers/gpu/drm/samsung/samsung_drm_encoder.h new file +37 -0
new file mode 100644
index 0000000..31c19dd
@@ -0,0 +1,37 @@
+/* samsung_drm_encoder.h
+ *
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ * Authors:
+ *	Inki Dae <[email protected]>
+ *	Joonyoung Shim <[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 _SAMSUNG_DRM_ENCODER_H_
+#define _SAMSUNG_DRM_ENCODER_H_
+
+struct samsung_drm_manager;
+
+ /* initialize encoder. (drm and samsung SoC specific encoder) */
+struct drm_encoder *samsung_drm_encoder_create(struct drm_device *dev,
+					       struct samsung_drm_manager *mgr);
+
+#endif
drivers/gpu/drm/samsung/samsung_drm_fb.c new file +290 -0

290 lines not on this page · raw message

drivers/gpu/drm/samsung/samsung_drm_fb.h new file +46 -0

46 lines not on this page · raw message

drivers/gpu/drm/samsung/samsung_drm_fbdev.c new file +303 -0

303 lines not on this page · raw message

drivers/gpu/drm/samsung/samsung_drm_fbdev.h new file +37 -0
new file mode 100644
index 0000000..70b33de
@@ -0,0 +1,37 @@
+/* samsung_drm_fbdev.h
+ *
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ *
+ * Authors:
+ *	Inki Dae, <[email protected]>
+ *	Joonyoung Shim, <[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 _SAMSUNG_DRM_FBDEV_H_
+#define _SAMSUNG_DRM_FBDEV_H_
+
+/* initialize drm fbdev helper. */
+int samsung_drm_fbdev_init(struct drm_device *dev);
+
+void samsung_drm_fbdev_restore_mode(struct drm_device *dev);
+
+#endif
drivers/gpu/drm/samsung/samsung_drm_fimd.c new file +676 -0

530 lines not on this page · raw message

drivers/gpu/drm/samsung/samsung_drm_gem.c new file +412 -0

412 lines not on this page · raw message

drivers/gpu/drm/samsung/samsung_drm_gem.h new file +72 -0

72 lines not on this page · raw message

drivers/gpu/drm/samsung/samsung_drm_ump.c new file +105 -0

105 lines not on this page · raw message

include/drm/samsung_drm.h new file +258 -0

258 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.0.4

Part of the diff is not shown here. View the raw message.

#1 lore raw

Hi,

Quoted 38 lines · Inki Dae

This patch is a DRM Driver(only including FIMD Driver yet)
for Samsung SoC Exynos4210. and as RFC, I am sending only DRM driver part.

this patch is based on git repository below:
git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6.git,
branch: drm-next
commit-id: 5a96a899bbdee86024ab9ea6d02b9e242faacbed

We tried to re-use lowlevel codes of the FIMD driver(s3c-fb.c based on Linux framebuffer) but couldn't so because lowlevel codes of s3c-fb.c are included internally and so this driver shares only platform device.

Sub drivers such as fimd or hdmi have indenpendent platform device and Platform driver and when driver's probe is called, the driver object including callbacks(for hardware control) would be registered to Samsung drm driver. and then when samsung drm driver is probed, each probe callback of the driver object registered is called so that additional callbacks for drm framework would be set at this time.

We used GEM framework for buffer management and this driver supports only physically continuous memory yet(non-iommu). and for buffer allocation, we used DMA APIs(dma_alloc_writecombine) but we will change it to CMA instead of DMA APIs later.

Refer to this link for CMA(Continuous Memory Allocator):
http://lkml.org/lkml/2011/7/20/45

Future works:
- HDMI support.
- drm plane feature support.
refer to this link for drm plane feature:
http://www.spinics.net/lists/dri-devel/msg11778.html
- change the allocator to CMA.
- iommu support.(for non-continuous physical memory usage)
- fimd driver update.
- add exception codes and code clean.

Quoted 5 lines

to support all features above, we need long time and hard work. so we wish that only some features(fimd and non-iommu) are applied to mainline first.

We would be pleased you to give us your comments.

So far I only had a quick look over the driver. You might know that I wrote a Freescale i.MX drm driver which I posted to the list some time ago.

My driver lacks GEM support which your driver has, so I specifically looked at this part. It seems we could reuse the GEM code on i.MX and probably on most other ARMs aswell. Can you split out this code and remove the samsung_ namespace?

btw you should probably Cc the arm Linux Kernel mailing list as this is the list where your users are.

I look forward to have the first ARM drm drivers mainline, so I really appreciate your work :)

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
author
#2 lore raw

Hi, Sascha Hauer.
thank you for your comments and below is my answer.

Quoted 47 lines · Sascha Hauer

Hi,

Quoted 38 lines · Inki Dae

This patch is a DRM Driver(only including FIMD Driver yet)
for Samsung SoC Exynos4210. and as RFC, I am sending only DRM driver part.

this patch is based on git repository below:
git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6.git,
branch: drm-next
commit-id: 5a96a899bbdee86024ab9ea6d02b9e242faacbed

We tried to re-use lowlevel codes of the FIMD driver(s3c-fb.c based on Linux framebuffer) but couldn't so because lowlevel codes of s3c-fb.c are included internally and so this driver shares only platform device.

Sub drivers such as fimd or hdmi have indenpendent platform device and Platform driver and when driver's probe is called, the driver object including callbacks(for hardware control) would be registered to Samsung drm driver. and then when samsung drm driver is probed, each probe callback of the driver object registered is called so that additional callbacks for drm framework would be set at this time.

We used GEM framework for buffer management and this driver supports only physically continuous memory yet(non-iommu). and for buffer allocation, we used DMA APIs(dma_alloc_writecombine) but we will change it to CMA instead of DMA APIs later.

Refer to this link for CMA(Continuous Memory Allocator):
http://lkml.org/lkml/2011/7/20/45

Future works:
- HDMI support.
- drm plane feature support.
refer to this link for drm plane feature:
http://www.spinics.net/lists/dri-devel/msg11778.html
- change the allocator to CMA.
- iommu support.(for non-continuous physical memory usage)
- fimd driver update.
- add exception codes and code clean.

Quoted 5 lines

to support all features above, we need long time and hard work. so we wish that only some features(fimd and non-iommu) are applied to mainline first.

We would be pleased you to give us your comments.

Quoted 9 lines

So far I only had a quick look over the driver. You might know that I wrote a Freescale i.MX drm driver which I posted to the list some time ago.

My driver lacks GEM support which your driver has, so I specifically looked at this part. It seems we could reuse the GEM code on i.MX and probably on most other ARMs aswell. Can you split out this code and remove the samsung_ namespace?

By any chance, you mean drm_gem_free_mmap_offset()? this patch had already been posted by Rob Clark, Omap TI as RFC.

you can refer to this link for it.
http://www.spinics.net/lists/dri-devel/msg13018.html

if so, I am aware of it but his patch isn't applied to drm-next yet and so my drm driver doesn't include his patch. of course I will reuse it and remove the samsung_ namespace as you pointed out if the patch is applied to drm-next.

Quoted 8 lines

btw you should probably Cc the arm Linux Kernel mailing list as this is the list where your users are.

I look forward to have the first ARM drm drivers mainline, so I really appreciate your work :)

Sascha

Thank you for your comments and advice again. :)

#3 lore raw
Quoted 63 lines · daeinki

Hi, Sascha Hauer.
thank you for your comments and below is my answer.

Quoted 47 lines · Sascha Hauer

Hi,

Quoted 38 lines · Inki Dae

This patch is a DRM Driver(only including FIMD Driver yet)
for Samsung SoC Exynos4210. and as RFC, I am sending only DRM driver part.

this patch is based on git repository below:
git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6.git,
branch: drm-next
commit-id: 5a96a899bbdee86024ab9ea6d02b9e242faacbed

We tried to re-use lowlevel codes of the FIMD driver(s3c-fb.c based on Linux framebuffer) but couldn't so because lowlevel codes of s3c-fb.c are included internally and so this driver shares only platform device.

Sub drivers such as fimd or hdmi have indenpendent platform device and Platform driver and when driver's probe is called, the driver object including callbacks(for hardware control) would be registered to Samsung drm driver. and then when samsung drm driver is probed, each probe callback of the driver object registered is called so that additional callbacks for drm framework would be set at this time.

We used GEM framework for buffer management and this driver supports only physically continuous memory yet(non-iommu). and for buffer allocation, we used DMA APIs(dma_alloc_writecombine) but we will change it to CMA instead of DMA APIs later.

Refer to this link for CMA(Continuous Memory Allocator):
http://lkml.org/lkml/2011/7/20/45

Future works:
- HDMI support.
- drm plane feature support.
refer to this link for drm plane feature:
http://www.spinics.net/lists/dri-devel/msg11778.html
- change the allocator to CMA.
- iommu support.(for non-continuous physical memory usage)
- fimd driver update.
- add exception codes and code clean.

Quoted 5 lines

to support all features above, we need long time and hard work. so we wish that only some features(fimd and non-iommu) are applied to mainline first.

We would be pleased you to give us your comments.

Quoted 9 lines

So far I only had a quick look over the driver. You might know that I wrote a Freescale i.MX drm driver which I posted to the list some time ago.

My driver lacks GEM support which your driver has, so I specifically looked at this part. It seems we could reuse the GEM code on i.MX and probably on most other ARMs aswell. Can you split out this code and remove the samsung_ namespace?

By any chance, you mean drm_gem_free_mmap_offset()? this patch had already been posted by Rob Clark, Omap TI as RFC.

Quoted 7 lines

you can refer to this link for it.
http://www.spinics.net/lists/dri-devel/msg13018.html

if so, I am aware of it but his patch isn't applied to drm-next yet and so my drm driver doesn't include his patch. of course I will reuse it and remove the samsung_ namespace as you pointed out if the patch is applied to drm-next.

Not only. I meant the full content of samsaung_drm_gem.c, samsung_drm_buf.c and maybe even samsung_drm_fb.c.

Except for the samsung namespace these functions could look the same on i.MX and other dumb framebuffer drm drivers.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
author
#4 lore raw
Quoted 86 lines

-----Original Message-----
From: Sascha Hauer [mailto:[email protected]]
Sent: Thursday, August 04, 2011 12:47 AM
To: daeinki
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] [RFC PATCH] DRM: add DRM Driver for Samsung SoC EXYNOS4210.

Quoted 9 lines · daeinki

Hi, Sascha Hauer.
thank you for your comments and below is my answer.

Quoted 5 lines · Sascha Hauer

Hi,

Quoted 2 lines · Inki Dae

This patch is a DRM Driver(only including FIMD Driver yet) for Samsung SoC Exynos4210. and as RFC, I am sending only DRM driver

part.

Quoted 18 lines
Quoted 18 lines
Quoted 18 lines

this patch is based on git repository below:
git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6.git,
branch: drm-next
commit-id: 5a96a899bbdee86024ab9ea6d02b9e242faacbed

We tried to re-use lowlevel codes of the FIMD driver(s3c-fb.c based on Linux framebuffer) but couldn't so because lowlevel codes of s3c-fb.c are included internally and so this driver shares only platform device.

Sub drivers such as fimd or hdmi have indenpendent platform device and Platform driver and when driver's probe is called, the driver object including callbacks(for hardware control) would be registered to Samsung drm driver. and then when samsung drm driver is probed, each probe callback of the driver object registered is called so that additional callbacks for drm framework would be set at this time.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

We used GEM framework for buffer management and this driver supports only physically continuous memory yet(non-iommu). and for buffer

allocation,

Quoted 1 line
Quoted 1 line
Quoted 1 line

we used DMA APIs(dma_alloc_writecombine) but we will change it to CMA

instead

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines

of DMA APIs later.

Refer to this link for CMA(Continuous Memory Allocator):
http://lkml.org/lkml/2011/7/20/45

Future works:
- HDMI support.
- drm plane feature support.
refer to this link for drm plane feature:
http://www.spinics.net/lists/dri-devel/msg11778.html
- change the allocator to CMA.
- iommu support.(for non-continuous physical memory usage)
- fimd driver update.
- add exception codes and code clean.

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

to support all features above, we need long time and hard work. so we wish that only some features(fimd and non-iommu) are applied to mainline first.

We would be pleased you to give us your comments.

So far I only had a quick look over the driver. You might know that I wrote a Freescale i.MX drm driver which I posted to the list some

time

Quoted 10 lines
Quoted 7 lines

ago.

My driver lacks GEM support which your driver has, so I specifically looked at this part. It seems we could reuse the GEM code on i.MX and probably on most other ARMs aswell. Can you split out this code and remove the samsung_ namespace?

By any chance, you mean drm_gem_free_mmap_offset()? this patch had already been posted by Rob Clark, Omap TI as RFC.

Quoted 7 lines

you can refer to this link for it.
http://www.spinics.net/lists/dri-devel/msg13018.html

if so, I am aware of it but his patch isn't applied to drm-next yet and so my drm driver doesn't include his patch. of course I will reuse it and remove the samsung_ namespace as you pointed out if the patch is applied to drm-next.

Quoted 8 lines

Not only. I meant the full content of samsaung_drm_gem.c, samsung_drm_buf.c and maybe even samsung_drm_fb.c.

Except for the samsung namespace these functions could look the same on i.MX and other dumb framebuffer drm drivers.

Sascha

I agree with you but I think it remains to be seem yet if I understood what you mean.
many drm drivers(i915, radeon and so on) in mainline are using their own prefix yet.
Sometime, these duplicated codes should be used as common part.

Thank you for your comments.

Quoted 5 lines

--

Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#5 lore raw
In reply to daeinki
Quoted 4 lines

if so, I am aware of it but his patch isn't applied to drm-next yet and so my drm driver doesn't include his patch. of course I will reuse it and remove the samsung_ namespace as you pointed out if the patch is applied to drm-next.

It would be nice it was as its also the same as the code being carried in the GEM glue for the gma500 driver so we now have 3 users (plus i915 can use it).

I agree with Sascha Hauer that a lot more could be shared with other (particularly future 'dumb') drivers. I think however it would be better to see what wants moving *after* such drivers are merged rather than guess in advance and do unneeded work and get it wrong anyway.

It's a nice reference driver for anyone else writing a DRM driver too.

Architecturally it's actually not quite as neat a fit for PC dumb devices as it might first seem though - in the PC world framebuffer case for a lot of cards I suspect you actually want to use real GEM objects.

In the PC case you do get multiple framebuffers allocated not all of which are in use so for cards with limited memory a true GEM object is useful. This would then be 'pinned' and 'unpinned' by copying it to/from video RAM and invalidating the mappings so mmap users fault with the new address next access)

With that behaviour proper use can be made of video RAM and out of use objects can still be paged.

For other cases it looks right as is.

Alan

author
#6 lore raw
Quoted 31 lines

-----Original Message-----
From: Alan Cox [mailto:[email protected]]
Sent: Thursday, August 04, 2011 3:54 AM
To: daeinki
Cc: Sascha Hauer; [email protected]; dri- [email protected]
Subject: Re: [PATCH] [RFC PATCH] DRM: add DRM Driver for Samsung SoC EXYNOS4210.

Quoted 4 lines

if so, I am aware of it but his patch isn't applied to drm-next yet and so my drm driver doesn't include his patch. of course I will reuse it and remove the samsung_ namespace as you pointed out if the patch is applied to drm-next.

It would be nice it was as its also the same as the code being carried in the GEM glue for the gma500 driver so we now have 3 users (plus i915 can use it).

I agree with Sascha Hauer that a lot more could be shared with other (particularly future 'dumb') drivers. I think however it would be better to see what wants moving *after* such drivers are merged rather than guess in advance and do unneeded work and get it wrong anyway.

It's a nice reference driver for anyone else writing a DRM driver too.

Architecturally it's actually not quite as neat a fit for PC dumb devices as it might first seem though - in the PC world framebuffer case for a lot of cards I suspect you actually want to use real GEM objects.

Quoted 6 lines

In the PC case you do get multiple framebuffers allocated not all of which are in use so for cards with limited memory a true GEM object is useful. This would then be 'pinned' and 'unpinned' by copying it to/from video RAM and invalidating the mappings so mmap users fault with the new address next access)

In fact, the FIMD and HDMI hardware on Samsung SoC EXYNOS4210 have no any their own video ram(maybe most of embedded systems) so that they use only system memory. Thank you for your explanation about pin/unpin. I could understand pin/unpin feature through you.

If so, I think the feature(that physical memory mapping is done at page fault handler of specific gem module) doesn't need for embedded systems without their own video memory and so they would need only the mapping way that user space would be mapped to physical memory directly not at the page fault handler once user requests specific mmap ioctl(not mmap system call). you can refer to i915_gem_mmap_ioctl() of i915/i915_gem.c for that.

Thank you for your comments.

Quoted 6 lines

With that behaviour proper use can be made of video RAM and out of use objects can still be paged.

For other cases it looks right as is.

Alan

#7 lore raw
In reply to Alan Cox
Quoted 5 lines · Alan Cox
Quoted 4 lines

if so, I am aware of it but his patch isn't applied to drm-next yet and so my drm driver doesn't include his patch. of course I will reuse it and remove the samsung_ namespace as you pointed out if the patch is applied to drm-next.

Quoted 8 lines

It would be nice it was as its also the same as the code being carried in the GEM glue for the gma500 driver so we now have 3 users (plus i915 can use it).

I agree with Sascha Hauer that a lot more could be shared with other (particularly future 'dumb') drivers. I think however it would be better to see what wants moving *after* such drivers are merged rather than guess in advance and do unneeded work and get it wrong anyway.

Forking is much easier than merging, so I really want to share as much as possible from the start. I'm not aware of any SoC having dedicated graphics memory, they all use system memory and the only difference I know is that some systems have a iommu and others don't.

Also, don't forget that we do not talk about three major graphic card vendors, but about dozens of SoC vendors with different graphic cores.

Quoted 7 lines

It's a nice reference driver for anyone else writing a DRM driver too.

Architecturally it's actually not quite as neat a fit for PC dumb devices as it might first seem though - in the PC world framebuffer case for a lot of cards I suspect you actually want to use real GEM objects.

Quoted 5 lines

In the PC case you do get multiple framebuffers allocated not all of which are in use so for cards with limited memory a true GEM object is useful. This would then be 'pinned' and 'unpinned' by copying it to/from video RAM and invalidating the mappings so mmap users fault with the new address next access)

/me has just learned something about GEM ;)

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |