Commit b9556e0f authored by Dave Airlie's avatar Dave Airlie

Merge branch 'exynos-drm-fixes' of...

Merge branch 'exynos-drm-fixes' of git://git.infradead.org/users/kmpark/linux-2.6-samsung into drm-fixes

From Inki Dae:

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

* 'exynos-drm-fixes' of git://git.infradead.org/users/kmpark/linux-2.6-samsung:
  drm/exynos: added missed vm area region mapping type.
  drm/exynos: fixed exynos_drm_gem_map_pages bug.
  drm/exynos: fixed duplicatd memory allocation bug.
parents af3a3ab2 818c4ea7
...@@ -149,22 +149,12 @@ static int exynos_drm_gem_map_pages(struct drm_gem_object *obj, ...@@ -149,22 +149,12 @@ static int exynos_drm_gem_map_pages(struct drm_gem_object *obj,
unsigned long pfn; unsigned long pfn;
if (exynos_gem_obj->flags & EXYNOS_BO_NONCONTIG) { if (exynos_gem_obj->flags & EXYNOS_BO_NONCONTIG) {
unsigned long usize = buf->size;
if (!buf->pages) if (!buf->pages)
return -EINTR; return -EINTR;
while (usize > 0) { pfn = page_to_pfn(buf->pages[page_offset++]);
pfn = page_to_pfn(buf->pages[page_offset++]); } else
vm_insert_mixed(vma, f_vaddr, pfn); pfn = (buf->dma_addr >> PAGE_SHIFT) + page_offset;
f_vaddr += PAGE_SIZE;
usize -= PAGE_SIZE;
}
return 0;
}
pfn = (buf->dma_addr >> PAGE_SHIFT) + page_offset;
return vm_insert_mixed(vma, f_vaddr, pfn); return vm_insert_mixed(vma, f_vaddr, pfn);
} }
...@@ -524,6 +514,8 @@ static int exynos_drm_gem_mmap_buffer(struct file *filp, ...@@ -524,6 +514,8 @@ static int exynos_drm_gem_mmap_buffer(struct file *filp,
if (!buffer->pages) if (!buffer->pages)
return -EINVAL; return -EINVAL;
vma->vm_flags |= VM_MIXEDMAP;
do { do {
ret = vm_insert_page(vma, uaddr, buffer->pages[i++]); ret = vm_insert_page(vma, uaddr, buffer->pages[i++]);
if (ret) { if (ret) {
...@@ -710,7 +702,6 @@ int exynos_drm_gem_dumb_destroy(struct drm_file *file_priv, ...@@ -710,7 +702,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) int exynos_drm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
{ {
struct drm_gem_object *obj = vma->vm_private_data; 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; struct drm_device *dev = obj->dev;
unsigned long f_vaddr; unsigned long f_vaddr;
pgoff_t page_offset; pgoff_t page_offset;
...@@ -722,21 +713,10 @@ int exynos_drm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) ...@@ -722,21 +713,10 @@ int exynos_drm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
mutex_lock(&dev->struct_mutex); 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); ret = exynos_drm_gem_map_pages(obj, vma, f_vaddr, page_offset);
if (ret < 0) if (ret < 0)
DRM_ERROR("failed to map pages.\n"); DRM_ERROR("failed to map pages.\n");
err:
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
return convert_to_vm_err_msg(ret); return convert_to_vm_err_msg(ret);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment