All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] updated exynos-drm-fixes
@ 2012-04-23 11:59 Inki Dae
  2012-04-23 11:59 ` [PATCH 1/3] drm/exynos: fixed duplicatd memory allocation bug Inki Dae
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Inki Dae @ 2012-04-23 11:59 UTC (permalink / raw)
  To: airlied, dri-devel; +Cc: Inki Dae, kyungmin.park, sw0312.kim

this patch set fixes gem allocation and mapping issue between user space and
physical memory region.

this patch set is based on git repository below:
	git://people.freedesktop.org/~airlied/linux.git drm-fixes
	commit-id: 273a50fbcd2d2c0652bbda58dd1985f932ce6d75

Inki Dae (3):
  drm/exynos: fixed duplicatd memory allocation bug.
  drm/exynos: fixed exynos_drm_gem_map_pages bug.
  drm/exynos: added missed vm area region mapping type.

 drivers/gpu/drm/exynos/exynos_drm_gem.c |   30 +++++-------------------------
 1 files changed, 5 insertions(+), 25 deletions(-)

-- 
1.7.4.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] drm/exynos: fixed duplicatd memory allocation bug.
  2012-04-23 11:59 [PATCH 0/3] updated exynos-drm-fixes Inki Dae
@ 2012-04-23 11:59 ` Inki Dae
  2012-04-23 11:59 ` [PATCH 2/3] drm/exynos: fixed exynos_drm_gem_map_pages bug Inki Dae
  2012-04-23 11:59 ` [PATCH 3/3] drm/exynos: added missed vm area region mapping type Inki Dae
  2 siblings, 0 replies; 4+ messages in thread
From: Inki Dae @ 2012-04-23 11:59 UTC (permalink / raw)
  To: airlied, dri-devel; +Cc: Inki Dae, kyungmin.park, sw0312.kim

the gem was already allocated at gem allocation time but is allocated
at page fault handler so this patch fixes the problem that gem was
allocated one more time.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_gem.c |   12 ------------
 1 files changed, 0 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c
index 26d5197..b1850c3 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
@@ -712,7 +712,6 @@ int exynos_drm_gem_dumb_destroy(struct drm_file *file_priv,
 int exynos_drm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
 	struct drm_gem_object *obj = vma->vm_private_data;
-	struct exynos_drm_gem_obj *exynos_gem_obj = to_exynos_gem_obj(obj);
 	struct drm_device *dev = obj->dev;
 	unsigned long f_vaddr;
 	pgoff_t page_offset;
@@ -724,21 +723,10 @@ int exynos_drm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 
 	mutex_lock(&dev->struct_mutex);
 
-	/*
-	 * allocate all pages as desired size if user wants to allocate
-	 * physically non-continuous memory.
-	 */
-	if (exynos_gem_obj->flags & EXYNOS_BO_NONCONTIG) {
-		ret = exynos_drm_gem_get_pages(obj);
-		if (ret < 0)
-			goto err;
-	}
-
 	ret = exynos_drm_gem_map_pages(obj, vma, f_vaddr, page_offset);
 	if (ret < 0)
 		DRM_ERROR("failed to map pages.\n");
 
-err:
 	mutex_unlock(&dev->struct_mutex);
 
 	return convert_to_vm_err_msg(ret);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] drm/exynos: fixed exynos_drm_gem_map_pages bug.
  2012-04-23 11:59 [PATCH 0/3] updated exynos-drm-fixes Inki Dae
  2012-04-23 11:59 ` [PATCH 1/3] drm/exynos: fixed duplicatd memory allocation bug Inki Dae
@ 2012-04-23 11:59 ` Inki Dae
  2012-04-23 11:59 ` [PATCH 3/3] drm/exynos: added missed vm area region mapping type Inki Dae
  2 siblings, 0 replies; 4+ messages in thread
From: Inki Dae @ 2012-04-23 11:59 UTC (permalink / raw)
  To: airlied, dri-devel; +Cc: Inki Dae, kyungmin.park, sw0312.kim

this patch fixes the problem that the physical memory region to be mapped
to user space could be exceeded. if page fault address was placed at between
buffer start and end then memory region to be mapped would be exceeded.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_gem.c |   16 +++-------------
 1 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c
index b1850c3..f09d292 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
@@ -149,22 +149,12 @@ static int exynos_drm_gem_map_pages(struct drm_gem_object *obj,
 	unsigned long pfn;
 
 	if (exynos_gem_obj->flags & EXYNOS_BO_NONCONTIG) {
-		unsigned long usize = buf->size;
-
 		if (!buf->pages)
 			return -EINTR;
 
-		while (usize > 0) {
-			pfn = page_to_pfn(buf->pages[page_offset++]);
-			vm_insert_mixed(vma, f_vaddr, pfn);
-			f_vaddr += PAGE_SIZE;
-			usize -= PAGE_SIZE;
-		}
-
-		return 0;
-	}
-
-	pfn = (buf->dma_addr >> PAGE_SHIFT) + page_offset;
+		pfn = page_to_pfn(buf->pages[page_offset++]);
+	} else
+		pfn = (buf->dma_addr >> PAGE_SHIFT) + page_offset;
 
 	return vm_insert_mixed(vma, f_vaddr, pfn);
 }
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] drm/exynos: added missed vm area region mapping type.
  2012-04-23 11:59 [PATCH 0/3] updated exynos-drm-fixes Inki Dae
  2012-04-23 11:59 ` [PATCH 1/3] drm/exynos: fixed duplicatd memory allocation bug Inki Dae
  2012-04-23 11:59 ` [PATCH 2/3] drm/exynos: fixed exynos_drm_gem_map_pages bug Inki Dae
@ 2012-04-23 11:59 ` Inki Dae
  2 siblings, 0 replies; 4+ messages in thread
From: Inki Dae @ 2012-04-23 11:59 UTC (permalink / raw)
  To: airlied, dri-devel; +Cc: Inki Dae, kyungmin.park, sw0312.kim

with this patch, if the memory region is physically non-continuous
then VM_MIXEDMAP is set to vm->vm_flags otherwise VM_PFNMAP.
we had missed this flag setting.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_gem.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c
index f09d292..01139c8 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
@@ -514,6 +514,8 @@ static int exynos_drm_gem_mmap_buffer(struct file *filp,
 		if (!buffer->pages)
 			return -EINVAL;
 
+		vma->vm_flags |= VM_MIXEDMAP;
+
 		do {
 			ret = vm_insert_page(vma, uaddr, buffer->pages[i++]);
 			if (ret) {
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-04-23 11:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-23 11:59 [PATCH 0/3] updated exynos-drm-fixes Inki Dae
2012-04-23 11:59 ` [PATCH 1/3] drm/exynos: fixed duplicatd memory allocation bug Inki Dae
2012-04-23 11:59 ` [PATCH 2/3] drm/exynos: fixed exynos_drm_gem_map_pages bug Inki Dae
2012-04-23 11:59 ` [PATCH 3/3] drm/exynos: added missed vm area region mapping type Inki Dae

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.