DRM: add DRM Driver for Samsung SoC EXYNOS4210.
Subsystems (2)
PATCH v5 1/1 DRM: add DRM Driver for Samsung SoC EXYNOS4210.
This patch is a DRM Driver for Samsung SoC Exynos4210 and now enables only FIMD yet but we will add HDMI support also in the future.
this patch is based on git repository below:git://people.freedesktop.org/~airlied/linux.git
branch name: drm-next
commit-id: 88ef4e3f4f616462b78a7838eb3ffc3818d30f67
you can refer to our working repository below:
http://git.infradead.org/users/kmpark/linux-2.6-samsung
branch name: samsung-drm
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 FIMD module of this driver has its own lowlevel codes.
We used GEM framework for buffer management and DMA APIs(dma_alloc_*) for buffer allocation so we can allocate physically continuous memory for DMA through it and also we could use CMA later if CMA is applied to mainline.
Refer to this link for CMA(Continuous Memory Allocator):
http://lkml.org/lkml/2011/7/20/45
this driver supports only physically continuous memory(non-iommu).
Links to previous versions of the patchset:
v1: < https://lwn.net/Articles/454380/ >
v2: < http://www.spinics.net/lists/kernel/msg1224275.html >
v3: < http://www.gossamer-threads.com/lists/linux/kernel/1423684 >
v4: < http://permalink.gmane.org/gmane.comp.video.dri.devel/60439 >
Changelog v2:
DRM: add DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl command.
this feature maps user address space to physical memory region once user application requests DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl.
DRM: code clean and add exception codes.
Changelog v3:
DRM: Support multiple irq.
FIMD and HDMI have their own irq handler but DRM Framework can regiter only one irq handler this patch supports mutiple irq for Samsung SoC.
DRM: Consider modularization.
each DRM, FIMD could be built as a module.
DRM: Have indenpendent crtc object.
crtc isn't specific to SoC Platform so this patch gets a crtc to be used as common object.
created crtc could be attached to any encoder object.
DRM: code clean and add exception codes.
Changelog v4:
DRM: remove is_defult from samsung_fb.
is_default isn't used for default framebuffer.
DRM: code refactoring to fimd module.
this patch is be considered with multiple display objects and would use its own request_irq() to register a irq handler instead of drm framework's one.
DRM: remove find_samsung_drm_gem_object()
DRM: move kernel private data structures and definitions to driver folder.
samsung_drm.h would contain only public information for userspace ioctl interface.
DRM: code refactoring to gem modules.
buffer module isn't dependent of gem module anymore.
DRM: fixed security issue.
DRM: remove encoder porinter from specific connector.
samsung connector doesn't need to have generic encoder.
DRM: code clean and add exception codes.
Changlog v5:
DRM: updated fimd(display controller) driver.
added various pixel formats, color key and pixel blending features.
DRM: removed end_buf_off from samsung_drm_overlay structure.
this variable isn't used and end buffer address would be calculated by each sub driver.
DRM: use generic function for mmap_offset.
replaced samsung_drm_gem_create_mmap_offset() and samsung_drm_free_mmap_offset() with generic ones applied to mainline recentrly.
DRM: removed unnecessary codes and added exception codes.
DRM: added comments and code clean.
--- drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/samsung/Kconfig | 18 + drivers/gpu/drm/samsung/Makefile | 11 + drivers/gpu/drm/samsung/samsung_drm_buf.c | 110 ++++ drivers/gpu/drm/samsung/samsung_drm_buf.h | 50 ++ drivers/gpu/drm/samsung/samsung_drm_connector.c | 282 ++++++++ drivers/gpu/drm/samsung/samsung_drm_connector.h | 34 + drivers/gpu/drm/samsung/samsung_drm_core.c | 269 ++++++++ drivers/gpu/drm/samsung/samsung_drm_crtc.c | 347 ++++++++++ drivers/gpu/drm/samsung/samsung_drm_crtc.h | 38 ++ drivers/gpu/drm/samsung/samsung_drm_drv.c | 230 +++++++ drivers/gpu/drm/samsung/samsung_drm_drv.h | 241 +++++++ drivers/gpu/drm/samsung/samsung_drm_encoder.c | 270 ++++++++ drivers/gpu/drm/samsung/samsung_drm_encoder.h | 45 ++ drivers/gpu/drm/samsung/samsung_drm_fb.c | 270 ++++++++ drivers/gpu/drm/samsung/samsung_drm_fb.h | 47 ++ drivers/gpu/drm/samsung/samsung_drm_fbdev.c | 440 +++++++++++++ drivers/gpu/drm/samsung/samsung_drm_fbdev.h | 37 ++ drivers/gpu/drm/samsung/samsung_drm_fimd.c | 793 +++++++++++++++++++++++ drivers/gpu/drm/samsung/samsung_drm_gem.c | 415 ++++++++++++ drivers/gpu/drm/samsung/samsung_drm_gem.h | 107 +++ include/drm/samsung_drm.h | 101 +++ 23 files changed, 4158 insertions(+), 0 deletions(-) create mode 100644 drivers/gpu/drm/samsung/Kconfig 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_connector.c create mode 100644 drivers/gpu/drm/samsung/samsung_drm_connector.h create mode 100644 drivers/gpu/drm/samsung/samsung_drm_core.c 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_drv.c create mode 100644 drivers/gpu/drm/samsung/samsung_drm_drv.h 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 include/drm/samsung_drm.h
drivers/gpu/drm/Kconfig +2 -0
@@ -158,3 +158,5 @@ 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. + +source "drivers/gpu/drm/samsung/Kconfig"
drivers/gpu/drm/Makefile +1 -0
@@ -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/Kconfig new file +18 -0
@@ -0,0 +1,18 @@ +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 + select VT_HW_CONSOLE_BINDING if FRAMEBUFFER_CONSOLE + help + Choose this option if you have a Samsung SoC EXYNOS chipset. + If M is selected the module will be called samsungdrm. + +config DRM_SAMSUNG_FIMD + tristate "Samsung DRM FIMD" + depends on DRM_SAMSUNG + help + Choose this option if you want to use Samsung FIMD for DRM. + If M is selected, the module will be called samsung_drm_fimd
drivers/gpu/drm/samsung/Makefile new file +11 -0
@@ -0,0 +1,11 @@ +# +# 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 +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_gem.o samsung_drm_core.o + +obj-$(CONFIG_DRM_SAMSUNG) += samsungdrm.o +obj-$(CONFIG_DRM_SAMSUNG_FIMD) += samsung_drm_fimd.o
drivers/gpu/drm/samsung/samsung_drm_buf.c new file +110 -0
110 lines not on this page · raw message
drivers/gpu/drm/samsung/samsung_drm_buf.h new file +50 -0
50 lines not on this page · raw message
drivers/gpu/drm/samsung/samsung_drm_connector.c new file +282 -0
282 lines not on this page · raw message
drivers/gpu/drm/samsung/samsung_drm_connector.h new file +34 -0
@@ -0,0 +1,34 @@ +/* +* Copyright (c) 2011 Samsung Electronics Co., Ltd. +* Authors: +* Inki Dae <[email protected]> +* Joonyoung Shim <[email protected]> +* SeungWoo 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 _SAMSUNG_DRM_CONNECTOR_H_ +#define _SAMSUNG_DRM_CONNECTOR_H_ + +struct drm_connector *samsung_drm_connector_create (struct drm_device *dev, +struct drm_encoder *encoder); + +#endif
drivers/gpu/drm/samsung/samsung_drm_core.c new file +269 -0
269 lines not on this page · raw message
drivers/gpu/drm/samsung/samsung_drm_crtc.c new file +347 -0
347 lines not on this page · raw message
drivers/gpu/drm/samsung/samsung_drm_crtc.h new file +38 -0
@@ -0,0 +1,38 @@ +/* samsung_drm_crtc.h +* +* Copyright (c) 2011 Samsung Electronics Co., Ltd. +* Authors: +* Inki Dae <[email protected]> +* Joonyoung Shim <[email protected]> +* SeungWoo 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 _SAMSUNG_DRM_CRTC_H_ +#define _SAMSUNG_DRM_CRTC_H_ + +struct samsung_drm_overlay *get_samsung_drm_overlay (struct drm_device *dev, +struct drm_crtc *crtc); +int samsung_drm_crtc_create (struct drm_device *dev,unsigned int nr); +int samsung_drm_crtc_enable_vblank (struct drm_device *dev,int crtc); +void samsung_drm_crtc_disable_vblank (struct drm_device *dev,int crtc); + +#endif
drivers/gpu/drm/samsung/samsung_drm_drv.c new file +230 -0
230 lines not on this page · raw message
drivers/gpu/drm/samsung/samsung_drm_drv.h new file +241 -0
241 lines not on this page · raw message
drivers/gpu/drm/samsung/samsung_drm_encoder.c new file +270 -0
270 lines not on this page · raw message
drivers/gpu/drm/samsung/samsung_drm_encoder.h new file +45 -0
45 lines not on this page · raw message
drivers/gpu/drm/samsung/samsung_drm_fb.c new file +270 -0
270 lines not on this page · raw message
drivers/gpu/drm/samsung/samsung_drm_fb.h new file +47 -0
47 lines not on this page · raw message
drivers/gpu/drm/samsung/samsung_drm_fbdev.c new file +440 -0
440 lines not on this page · raw message
drivers/gpu/drm/samsung/samsung_drm_fbdev.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* Copyright (c) 2011 Samsung Electronics Co., Ltd. +* +* Authors: +* Inki Dae <[email protected]> +* Joonyoung Shim <[email protected]> +* SeungWoo 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 _SAMSUNG_DRM_FBDEV_H_ +#define _SAMSUNG_DRM_FBDEV_H_ + +int samsung_drm_fbdev_init (struct drm_device *dev); +int samsung_drm_fbdev_reinit (struct drm_device *dev); +void samsung_drm_fbdev_fini (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 +793 -0
251 lines not on this page · raw message
drivers/gpu/drm/samsung/samsung_drm_gem.c new file +415 -0
415 lines not on this page · raw message
drivers/gpu/drm/samsung/samsung_drm_gem.h new file +107 -0
107 lines not on this page · raw message
include/drm/samsung_drm.h new file +101 -0
101 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.4.1
Part of the diff is not shown here. View the raw message.
drivers/gpu/drm/samsung/Kconfig line 3
Quoted 9 lines
drivers/gpu/drm/samsung/Kconfig new file +3
-0@@ -0,0 +1,18 @@ +config DRM_SAMSUNG + tristate "DRM Support for Samsung SoC EXYNOS Series" + depends on DRM && PLAT_SAMSUNG
You should probably also have a default 'm' option?
Quoted 5 lines
drivers/gpu/drm/samsung/Kconfig new file +5
-0+ select DRM_KMS_HELPER + select FB_CFB_FILLRECT + select FB_CFB_COPYAREA + select FB_CFB_IMAGEBLIT + select VT_HW_CONSOLE_BINDING if FRAMEBUFFER_CONSOLE
drivers/gpu/drm/samsung/Kconfig line 18
Quoted 10 lines
drivers/gpu/drm/samsung/Kconfig new file +10
-0+ help + Choose this option if you have a Samsung SoC EXYNOS chipset. + If M is selected the module will be called samsungdrm. + +config DRM_SAMSUNG_FIMD + tristate "Samsung DRM FIMD" + depends on DRM_SAMSUNG + help + Choose this option if you want to use Samsung FIMD for DRM. + If M is selected, the module will be called samsung_drm_fimd
.. which is just nitpicking and optional so. I took a look at the code and you can stick 'Reviewed-by: Konrad Rzeszutek Wilk <[email protected]>' if you want to.
Hi, Konrad Rzeszutek Wilk.
Quoted 6 lines
-----Original Message-----
From: Konrad Rzeszutek Wilk [mailto:[email protected]]
Sent: Tuesday, October 04, 2011 12:46 AM
To: Inki Dae
Cc: [email protected]; [email protected]; [email protected]; [email protected];
Quoted 5 lines
[email protected]
Subject: Re: [PATCH v5] DRM: add DRM Driver for Samsung SoC EXYNOS4210.Review
Quoted 1 line
(quoted diff) +0
-0b/drivers/gpu/drm/samsung/Kconfig
Quoted 11 lines
drivers/gpu/drm/samsung/Kconfig line 3
Quoted 8 lines
new file mode 100644
index 0000000..34ceddadrivers/gpu/drm/samsung/Kconfig new file +3
-0@@ -0,0 +1,18 @@ +config DRM_SAMSUNG + tristate "DRM Support for Samsung SoC EXYNOS Series" + depends on DRM && PLAT_SAMSUNGYou should probably also have a default 'm' option?
Yes, right. I will add a default 'm' or 'n' option. thank you.
Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/samsung/Kconfig new file +12
-0+ select DRM_KMS_HELPER + select FB_CFB_FILLRECT + select FB_CFB_COPYAREA + select FB_CFB_IMAGEBLIT + select VT_HW_CONSOLE_BINDING if FRAMEBUFFER_CONSOLE + help + Choose this option if you have a Samsung SoC EXYNOS chipset. + If M is selected the module will be called samsungdrm. + +config DRM_SAMSUNG_FIMD + tristate "Samsung DRM FIMD" + depends on DRM_SAMSUNG
Quoted 8 lines
drivers/gpu/drm/samsung/Kconfig line 18
Quoted 3 lines
drivers/gpu/drm/samsung/Kconfig new file +3
-0+ help + Choose this option if you want to use Samsung FIMD for DRM. + If M is selected, the module will be called samsung_drm_fimd.. which is just nitpicking and optional so. I took a look at the code and you can stick 'Reviewed-by: Konrad Rzeszutek Wilk <[email protected]>'
if you want to.
Of course, we want :) I will add you as a reviewer. we will send V6 patch soon. and thank you for your comments and advices again.
Quoted 100 lines · Inki Dae
This patch is a DRM Driver for Samsung SoC Exynos4210 and now enables only FIMD yet but we will add HDMI support also in the future.
this patch is based on git repository below:
git://people.freedesktop.org/~airlied/linux.git
branch name: drm-next
commit-id:88ef4e3f4f616462b78a7838eb3ffc3818d30f67you can refer to our working repository below:
http://git.infradead.org/users/kmpark/linux-2.6-samsung
branch name: samsung-drmWe 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.care included internally and so FIMD module of this driver has its own lowlevel codes.We used GEM framework for buffer management and DMA
APIs(dma_alloc_*)for buffer allocation so we can allocate physically continuous memory for DMA through it and also we could use CMA later if CMA is applied to mainline.Refer to this link for CMA(Continuous Memory Allocator):
http://lkml.org/lkml/2011/7/20/45this driver supports only physically continuous memory(non-iommu).
Links to previous versions of the patchset:
v1: < https://lwn.net/Articles/454380/ >
v2: < http://www.spinics.net/lists/kernel/msg1224275.html >
v3: < http://www.gossamer-threads.com/lists/linux/kernel/1423684 >
v4: < http://permalink.gmane.org/gmane.comp.video.dri.devel/60439 >Changelog v2:
DRM: addDRM_IOCTL_SAMSUNG_GEM_MMAPioctl command.this feature maps user address space to physical memory region once user application requests
DRM_IOCTL_SAMSUNG_GEM_MMAPioctl.DRM: code clean and add exception codes.
Changelog v3:
DRM: Support multiple irq.FIMD and HDMI have their own irq handler but DRM Framework can regiter only one irq handler this patch supports mutiple irq for Samsung SoC.
DRM: Consider modularization.
each DRM, FIMD could be built as a module.
DRM: Have indenpendent crtc object.
crtc isn't specific to SoC Platform so this patch gets a crtc to be used as common object.
created crtc could be attached to any encoder object.DRM: code clean and add exception codes.
Changelog v4:
DRM: removeis_defultfromsamsung_fb.is_default isn't used for default framebuffer.
DRM: code refactoring to fimd module.
this patch is be considered with multiple display objects and would use its ownrequest_irq()to register a irq handler instead of drm framework's one.DRM: remove
find_samsung_drm_gem_object()DRM: move kernel private data structures and definitions to driver folder.
samsung_drm.h would contain only public information for userspace ioctl interface.
DRM: code refactoring to gem modules.
buffer module isn't dependent of gem module anymore.DRM: fixed security issue.
DRM: remove encoder porinter from specific connector.
samsung connector doesn't need to have generic encoder.
DRM: code clean and add exception codes.
Changlog v5:
DRM: updated fimd(display controller) driver.
added various pixel formats, color key and pixel blending features.DRM: removed
end_buf_offfromsamsung_drm_overlaystructure. this variable isn't used and end buffer address would be calculated by each sub driver.DRM: use generic function for
mmap_offset. replacedsamsung_drm_gem_create_mmap_offset()andsamsung_drm_free_mmap_offset()with generic ones applied to mainline recentrly.
Quoted 8 lines
DRM: removed unnecessary codes and added exception codes.
DRM: added comments and code clean.
Signed-off-by Inki Dae <[email protected]>Signed-off-by Joonyoung Shim <[email protected]>Signed-off-by SeungWoo Kim <[email protected]>Signed-off-by kyungmin.park <[email protected]>
BR,
-R