<br><br><div class="gmail_quote">2012/11/15 Prathyush K <span dir="ltr"><<a href="mailto:prathyush.k@samsung.com" target="_blank">prathyush.k@samsung.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This patch adds a exynos drm specific implementation of fb_mmap.<br>
The root framebuffer is allocated using dma_alloc_attrs which can<br>
allocate a contig or noncontig buffer depending on whether an iommu<br>
is attached to drm device or not. The default fb_mmap function<br>
always assumes the root fb to be contiguous thus failing in case of<br>
a non-contig buffer.<br>
<br>
The exynos drm specific implementation of fb_mmap extracts the private<br>
data from the fb_info and calls dma_mmap_attrs with the parameters<br>
used while allocating the buffer.<br>
<br>
Signed-off-by: Prathyush K <<a href="mailto:prathyush.k@samsung.com">prathyush.k@samsung.com</a>><br>
---<br>
drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 30 +++++++++++++++++++++++++++++<br>
1 files changed, 30 insertions(+), 0 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c<br>
index 67eb6ba..62314ca 100644<br>
--- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c<br>
+++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c<br>
@@ -46,8 +46,38 @@ struct exynos_drm_fbdev {<br>
struct exynos_drm_gem_obj *exynos_gem_obj;<br>
};<br>
<br>
+static int exynos_drm_fb_mmap(struct fb_info *info,<br>
+ struct vm_area_struct *vma)<br>
+{<br>
+ struct drm_fb_helper *helper = info->par;<br>
+ struct exynos_drm_fbdev *exynos_fbd = to_exynos_fbdev(helper);<br>
+ struct exynos_drm_gem_obj *exynos_gem_obj = exynos_fbd->exynos_gem_obj;<br>
+ struct exynos_drm_gem_buf *buffer = exynos_gem_obj->buffer;<br>
+ unsigned long vm_size;<br>
+ int ret;<br>
+<br>
+ DRM_DEBUG_KMS("%s\n", __func__);<br>
+<br>
+ vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;<br>
+<br>
+ vm_size = vma->vm_end - vma->vm_start;<br>
+<br>
+ if (vm_size > buffer->size)<br>
+ return -EINVAL;<br>
+<br>
+ ret = dma_mmap_attrs(helper->dev->dev, vma, buffer->kvaddr,<br>
+ buffer->dma_addr, vm_size, &buffer->dma_attrs);<br></blockquote><div><br>use original size requested in dma_alloc_attrs instead of vm_size. And please, leave previous history like below,<br><br>
For example,<br><br>Changelog v2:<br>new comments such as what is changed, what is added and so on.<br><br>Changelog v1:<br>origin comments.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ if (ret < 0) {<br>
+ DRM_ERROR("failed to mmap.\n");<br>
+ return ret;<br>
+ }<br>
+<br>
+ return 0;<br>
+}<br>
+<br>
static struct fb_ops exynos_drm_fb_ops = {<br>
.owner = THIS_MODULE,<br>
+ .fb_mmap = exynos_drm_fb_mmap,<br>
.fb_fillrect = cfb_fillrect,<br>
.fb_copyarea = cfb_copyarea,<br>
.fb_imageblit = cfb_imageblit,<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.0.4<br>
<br>
_______________________________________________<br>
dri-devel mailing list<br>
<a href="mailto:dri-devel@lists.freedesktop.org">dri-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/dri-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/dri-devel</a><br>
</font></span></blockquote></div><br>