updated exynos-drm-fixes
Subsystems (3)
Inki Dae
maintainercover updated exynos-drm-fixes
this patch set fixes page align and duplicated allocation issues and removes unnecessary codes for code clean.
this patch set is based on git repository below:
git://people.freedesktop.org/~airlied/linux.git drm-fixes commit-id: 62fb376e214d3c1bfdf6fbb77dac162f6da04d7e
Please let me know if there is any problem.
Thanks,
Inki Dae
Inki Dae (2):
drm/exynos: fixed page align and code clean. drm/exynos: fixed duplicated page allocation bug.
drivers/gpu/drm/exynos/exynos_drm_buf.c | 47 +++++++++--------------------- drivers/gpu/drm/exynos/exynos_drm_gem.c | 45 +++++++++++++++++++++++------ drivers/gpu/drm/exynos/exynos_drm_gem.h | 2 + include/drm/exynos_drm.h | 3 +- 4 files changed, 54 insertions(+), 43 deletions(-)
Signature · 1 line
1.7.4.1
Inki Dae
maintainerPATCH 1/2 drm/exynos: fixed page align and code clean.
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.
--- drivers/gpu/drm/exynos/exynos_drm_buf.c | 13 +++----- drivers/gpu/drm/exynos/exynos_drm_gem.c | 45 ++++++++++++++++++++++++------ drivers/gpu/drm/exynos/exynos_drm_gem.h | 2 + include/drm/exynos_drm.h | 3 +- 4 files changed, 45 insertions(+), 18 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_buf.c +5 -8
@@ -41,7 +41,7 @@ static int lowlevel_buffer_allocate(struct drm_device *dev,DRM_DEBUG_KMS ("%s\n" , __FILE__); -if (flags &EXYNOS_BO_NONCONTIG ) { +if (IS_NONCONTIG_BUFFER (flags)) {DRM_DEBUG_KMS ("not support allocation type.\n" );return -EINVAL ; }
@@ -52,13 +52,13 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, }if (buf->size >=SZ_1M ) { - npages = (buf->size >>SECTION_SHIFT ) +1 ; + npages = buf->size >>SECTION_SHIFT ; page_size =SECTION_SIZE ; }else if (buf->size >=SZ_64K ) { - npages = (buf->size >>16 ) +1 ; + npages = buf->size >>16 ; page_size =SZ_64K ; }else { - npages = (buf->size >>PAGE_SHIFT ) +1 ; + npages = buf->size >>PAGE_SHIFT ; page_size =PAGE_SIZE ; }
@@ -119,9 +119,6 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, buf->pages[i] =phys_to_page (start_addr); - sgl =sg_next (sgl); -sg_set_page (sgl, buf->pages[i+1 ], end_addr - start_addr,0 ); - DRM_DEBUG_KMS("vaddr(0x%lx), dma_addr(0x%lx), size(0x%lx)\n", (unsigned long)buf->kvaddr, (unsigned long)buf->dma_addr,
@@ -150,7 +147,7 @@ static void lowlevel_buffer_deallocate(struct drm_device *dev,* non-continuous memory would be released by exynos * gem framework. */ -if (flags &EXYNOS_BO_NONCONTIG ) { +if (IS_NONCONTIG_BUFFER (flags)) {DRM_DEBUG_KMS ("not support allocation type.\n" );return ; }
drivers/gpu/drm/exynos/exynos_drm_gem.c +36 -9
80 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_drm_gem.h +2 -0
@@ -29,6 +29,8 @@#define to_exynos_gem_obj (x) container_of(x,\ struct exynos_drm_gem_obj, base) +#define IS_NONCONTIG_BUFFER (f) (f & EXYNOS_BO_NONCONTIG) +/* * exynos drm gem buffer structure. *
include/drm/exynos_drm.h +2 -1
@@ -96,7 +96,8 @@ struct drm_exynos_plane_set_zpos {/* memory type definitions. */ enum e_drm_exynos_gem_mem_type {/* Physically Non-Continuous memory. */ -EXYNOS_BO_NONCONTIG =1 <<0 +EXYNOS_BO_NONCONTIG =1 <<0 , +EXYNOS_BO_MASK =EXYNOS_BO_NONCONTIG };#define DRM_EXYNOS_GEM_CREATE 0x00
Signature · 1 line
1.7.4.1
Inki Dae
maintainerPATCH 2/2 drm/exynos: fixed duplicated page allocation bug.
In reply to Inki Daethis patch fixes that buf->pages is allocated two times when it allocates physically continuous memory region and removes unnecessary codes for code clean.
--- drivers/gpu/drm/exynos/exynos_drm_buf.c | 34 ++++++++---------------------- 1 files changed, 9 insertions(+), 25 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_buf.c +9 -25
@@ -34,7 +34,7 @@static int lowlevel_buffer_allocate (struct drm_device *dev,unsigned int flags,struct exynos_drm_gem_buf *buf) { -dma_addr_t start_addr, end_addr; +dma_addr_t start_addr;unsigned int npages, page_size, i =0 ;struct scatterlist *sgl;int ret =0 ;
@@ -76,26 +76,13 @@ static int lowlevel_buffer_allocate(struct drm_device *dev,return -ENOMEM ; } - buf->kvaddr =dma_alloc_writecombine (dev->dev, buf->size, - &buf->dma_addr,GFP_KERNEL ); -if (!buf->kvaddr) { -DRM_ERROR ("failed to allocate buffer.\n" ); - ret = -ENOMEM ; - goto err1; - } - - start_addr = buf->dma_addr; - end_addr = buf->dma_addr + buf->size; - - buf->pages =kzalloc (sizeof (struct page ) * npages,GFP_KERNEL ); -if (!buf->pages) { -DRM_ERROR ("failed to allocate pages.\n" ); - ret = -ENOMEM ; - goto err2; - } - - start_addr = buf->dma_addr; - end_addr = buf->dma_addr + buf->size; + buf->kvaddr =dma_alloc_writecombine (dev->dev, buf->size, + &buf->dma_addr,GFP_KERNEL ); +if (!buf->kvaddr) { +DRM_ERROR ("failed to allocate buffer.\n" ); + ret = -ENOMEM ; + goto err1; + } buf->pages =kzalloc (sizeof (struct page ) * npages,GFP_KERNEL );if (!buf->pages) {
@@ -105,20 +92,17 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, } sgl = buf->sgt->sgl; + start_addr = buf->dma_addr;while (i < npages) { buf->pages[i] =phys_to_page (start_addr);sg_set_page (sgl, buf->pages[i], page_size,0 );sg_dma_address (sgl) = start_addr; start_addr += page_size; -if (end_addr - start_addr < page_size) -break ; sgl =sg_next (sgl); i++; } - buf->pages[i] =phys_to_page (start_addr); - DRM_DEBUG_KMS("vaddr(0x%lx), dma_addr(0x%lx), size(0x%lx)\n", (unsigned long)buf->kvaddr, (unsigned long)buf->dma_addr,
Signature · 1 line
1.7.4.1