aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/exynos/exynos_drm_buf.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2013-09-16drm/exynos: fix return value check in lowlevel_buffer_allocate()Wei Yongjun1-2/+2
In case of error, the function drm_prime_pages_to_sg() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2013-09-16drm/exynos: Fix address space warning in exynos_drm_buf.cSachin Kamat1-1/+2
Fixes the following warning: drivers/gpu/drm/exynos/exynos_drm_buf.c:66:29: warning: incorrect type in assignment (different address spaces) drivers/gpu/drm/exynos/exynos_drm_buf.c:66:29: expected void [noderef] <asn:2>*kvaddr drivers/gpu/drm/exynos/exynos_drm_buf.c:66:29: got void * Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2013-09-05drm/exynos: Remove redundant error messagesSachin Kamat1-3/+1
kzalloc already has built-in error messages. Hence remove additional ones. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2013-09-05drm/exynos: Remove redundant NULL check in exynos_drm_bufSachin Kamat1-5/+0
kfree handles null pointers. Hence this check is not necessary. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2013-07-04drm/exynos: remove duplicated error routine and unnecessary assignSeung-Woo Kim1-3/+3
There were duplicated error handling routines during allocating pages in lowlevel_buffer_allocate() and g2d_userptr_get_dma_addr(). Also unnecessary NULL assignments for variable used not any more are removed from g2d_userptr_get_dma_addr() and g2d_userptr_put_dma_addr(). Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: YoungJun Cho <yj44.cho@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2013-07-04drm/exynos: fix pages allocation size in lowlevel_buffer_allocateYoungJun Cho1-1/+1
When IOMMU is not supported, buf->pages has to be allocated to assign the result of phys_to_page() which return type is struct page *. So it is sufficient to allocate buf->pages with the size of multiple struct page pointers. Signed-off-by: YoungJun Cho <yj44.cho@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2013-07-04drm/exynos: use drm_calloc_large when allocates pointer arrayYoungJun Cho1-5/+4
If the type of object is pointer array, the drm_calloc_large() is more suitable than kzalloc() for its allocation function. And uses drm_free_large() instead of kfree() also. Signed-off-by: YoungJun Cho <yj44.cho@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2013-06-28drm/exynos: Remove tracking log functionsYoungJun Cho1-7/+0
This patch removes tracking log functions which were used to debug in the early development stage and are not so important as were. So remove them for code clean up. Signed-off-by: YoungJun Cho <yj44.cho@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2013-01-04drm/exynos: fix gem buffer allocation type checkingInki Dae1-1/+1
This patch fixes gem buffer allocation type checking. EXYNOS_BO_CONTIG has 0 so the checking should be fixed to 'if (!(flags & EXYNOS_BO_NONCONTIG))' Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2013-01-04drm/exynos: consider buffer allocation without iommuInki Dae1-7/+48
This patch fixes the issue that when buffer allocation is requested without iommu, the allocation is failed. Without iommu, dma_alloc_attrs function allocates some memory region and returns cpu address so this patch makes the cpu address to be set to buf->kvaddr correctly. Changelog v2: - fix buffer free . Without iommu, dma_free_attrs function requires kernel space address as argument. So it changes the argument, buf->pages to buf->kvaddr. Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2013-01-04drm/exynos: change file license to GPLInki Dae1-18/+4
This patch changes file license to GPL Most of exynos files had been copied from some random file and not updated correctly. So this patch corrects the file license. Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2012-12-14drm/exynos: fix allocation and cache mapping typeInki Dae1-2/+16
This patch fixes memory alloction(contiguous or not) and cache mapping types(cachable or not). For this, it converts each type from user request into dma attribute properly. Changelog v2: - just code cleanup. Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2012-12-13drm/exynos: use DMA_ATTR_NO_KERNEL_MAPPING attributeInki Dae1-20/+11
Changelog v3: just code cleanup. Changelog v2: fix argument to dma_mmap_attr function. - use pages instead of kvaddr because kvaddr is 0 with DMA_ATTR_NO_KERNEL_MAPPING. Changelog v1: When gem allocation is requested, kernel space mapping isn't needed. But if need, such as console framebuffer, the physical pages would be mapped with kernel space though vmap function. Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2012-12-05drm/exynos: remove 'pages' and 'page_size' elements in exynos gem bufferPrathyush K1-20/+0
Changelog v2: Removed redundant check for invalid sgl. Added check for valid page_offset in the beginning of exynos_drm_gem_map_buf. Changelog v1: The 'pages' structure is not required since we can use the 'sgt'. Even for CONTIG buffers, a SGT is created (which will have just one sgl). This SGT can be used during mmap instead of 'pages'. The 'page_size' element of the structure is also not used anywhere and is removed. This patch also fixes a memory leak where the 'pages' structure was being allocated during gem buffer allocation but not being freed during deallocate. Signed-off-by: Prathyush K <prathyush.k@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2012-11-29drm/exynos: add iommu support for exynos drm frameworkInki Dae1-56/+32
Changelog v4: - fix condition to drm_iommu_detach_device funtion. Changelog v3: - add dma_parms->max_segment_size setting of drm_device->dev. - use devm_kzalloc instead of kzalloc. Changelog v2: - fix iommu attach condition. . check archdata.dma_ops of drm device instead of subdrv device's one. - code clean to exynos_drm_iommu.c file. . remove '#ifdef CONFIG_ARM_DMA_USE_IOMMU' from exynos_drm_iommu.c and add it to driver/gpu/drm/exynos/Kconfig. Changelog v1: This patch adds iommu support for exynos drm framework with dma mapping api. In this patch, we used dma mapping api to allocate physical memory and maps it with iommu table and removed some existing codes and added new some codes for iommu support. GEM allocation requires one device object to use dma mapping api so this patch uses one iommu mapping for all sub drivers. In other words, all sub drivers have same iommu mapping. Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2012-10-02UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/David Howells1-2/+2
Convert #include "..." to #include <path/...> in drivers/gpu/. Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Dave Airlie <airlied@redhat.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Acked-by: Dave Jones <davej@redhat.com>
2012-10-02UAPI: (Scripted) Remove redundant DRM UAPI header #inclusions from drivers/gpu/.David Howells1-1/+0
Remove redundant DRM UAPI header #inclusions from drivers/gpu/. Remove redundant #inclusions of core DRM UAPI headers (drm.h, drm_mode.h and drm_sarea.h). They are now #included via drmP.h and drm_crtc.h via a preceding patch. Without this patch and the patch to make include the UAPI headers from the core headers, after the UAPI split, the DRM C sources cannot find these UAPI headers because the DRM code relies on specific -I flags to make #include "..." work on headers in include/drm/ - but that does not work after the UAPI split without adding more -I flags. Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Dave Airlie <airlied@redhat.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Acked-by: Dave Jones <davej@redhat.com>
2012-05-08drm/exynos: added drm prime feature.Inki Dae1-6/+6
this patch adds exynos specific codes for DRM Prime feature. with this patch, user application can get file descriptor from gem handle through DRM_IOCTL_PRIME_HANDLE_TO_FD ioctl command(export) and also gem handle from file descriptor through DRM_IOCTL_PRIME_FD_TO_HANLDE(import) ioctl command. Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2012-04-03drm/exynos: fixed duplicated page allocation bug.Inki Dae1-25/+9
this patch fixes that buf->pages is allocated two times when it allocates physically continuous memory region and removes unnecessary codes. Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2012-04-03drm/exynos: fixed page align and code clean.Inki Dae1-8/+5
1M section, 64k page count also should be rounded up so this patch rounds up them and caculates page count of them properly and also checks memory flags from user. Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2012-03-20drm/exynos: update gem and buffer framework.Inki Dae1-35/+156
with this patch, we can allocate physically continuous or non-continuous memory and also it creates scatterlist for iommu support so allocated memory region can be mapped to iommu page table using scatterlist. Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-12-29drm/exynos: gem code cleanupJoonyoung Shim1-3/+2
This cleans codes of exynos gem - indents and order function and so on. Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2011-11-15drm/exynos: changed buffer structure.Inki Dae1-28/+32
the purpose of this patch is to consider IOMMU support in the future. EXYNOS4 SoC supports IOMMU also so the address for DMA could be physical address with IOMMU or device address with IOMMU. Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2011-11-15drm/exynos: removed unnecessary variable.Inki Dae1-2/+0
Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2011-10-05DRM: add DRM Driver for Samsung SoC EXYNOS4210.Inki Dae1-0/+110
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.spinics.net/lists/dri-devel/msg13755.html > v4: < http://permalink.gmane.org/gmane.comp.video.dri.devel/60439 > v5: < http://comments.gmane.org/gmane.comp.video.dri.devel/60802 > 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. Changelog 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. Changelog v6: DRM: added default config options. DRM: added padding for 64-bit align. DRM: changed prefix 'samsung' to 'exynos' Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>