summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorYongqiang Niu <yongqiang.niu@mediatek.com>2019-03-27 14:19:20 +0800
committerCK Hu <ck.hu@mediatek.com>2019-05-29 14:55:26 +0800
commit46a3b9fce29386704a56fbfb22e0dcdbd813b4b5 (patch)
tree77bd3528a8f23acda757c66c4abd4d1f79c957e6 /drivers/gpu
parent937f861def1a1d49abb92e041efaa5c259281fbf (diff)
downloadlinux-46a3b9fce29386704a56fbfb22e0dcdbd813b4b5.tar.gz
linux-46a3b9fce29386704a56fbfb22e0dcdbd813b4b5.tar.bz2
linux-46a3b9fce29386704a56fbfb22e0dcdbd813b4b5.zip
drm/mediatek: respect page offset for PRIME mmap calls
Respect page offset for PRIME mmap calls Signed-off-by: Yongqiang Niu <yongqiang.niu@mediatek.com> Signed-off-by: CK Hu <ck.hu@mediatek.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/mediatek/mtk_drm_gem.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
index 38483e9ee071..7eabdf335a79 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
@@ -144,7 +144,6 @@ static int mtk_drm_gem_object_mmap(struct drm_gem_object *obj,
* VM_PFNMAP flag that was set by drm_gem_mmap_obj()/drm_gem_mmap().
*/
vma->vm_flags &= ~VM_PFNMAP;
- vma->vm_pgoff = 0;
ret = dma_mmap_attrs(priv->dma_dev, vma, mtk_gem->cookie,
mtk_gem->dma_addr, obj->size, mtk_gem->dma_attrs);
@@ -176,6 +175,12 @@ int mtk_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
obj = vma->vm_private_data;
+ /*
+ * Set vm_pgoff (used as a fake buffer offset by DRM) to 0 and map the
+ * whole buffer from the start.
+ */
+ vma->vm_pgoff = 0;
+
return mtk_drm_gem_object_mmap(obj, vma);
}