Re: [PATCH v2 23/25] drm/mediatek: add vmap support for mediatek drm

CK Hu
2019-04-16T08:31:21Z

Hi, Yongqiang:

On Wed, 2019-03-27 at 14:19 +0800, yongqiang.niu@mediatek.com wrote:
> From: Yongqiang Niu <yongqiang.niu@mediatek.com>
>
> This patch add add vmap support for mediatek drm

I think the upstreamed patch 'drm/mediatek: Implement gem prime
vmap/vunmap function' [1] has the same function of this patch. You could
cherry-pick that patch to your local and need not to upstream this
patch.

[1]
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/gpu/drm/mediatek?h=v5.1-rc5&id=3df64d7b0a4f70f1797f23cfd4cca5c4d48131fe

Regards,
CK

>
> Signed-off-by: Yongqiang Niu <yongqiang.niu@mediatek.com>
> ---
> drivers/gpu/drm/mediatek/mtk_drm_drv.c | 1 +
> drivers/gpu/drm/mediatek/mtk_drm_gem.c | 7 +++++++
> drivers/gpu/drm/mediatek/mtk_drm_gem.h | 1 +
> 3 files changed, 9 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index 84c6626..942789d 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -370,6 +370,7 @@ static void mtk_drm_kms_deinit(struct drm_device *drm)
> .gem_prime_get_sg_table = mtk_gem_prime_get_sg_table,
> .gem_prime_import_sg_table = mtk_gem_prime_import_sg_table,
> .gem_prime_mmap = mtk_drm_gem_mmap_buf,
> + .gem_prime_vmap = mtk_drm_gem_vmap_buf,
> .fops = &mtk_drm_fops,
>
> .name = DRIVER_NAME,
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> index 259b7b0..c230237 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> @@ -165,6 +165,13 @@ int mtk_drm_gem_mmap_buf(struct drm_gem_object *obj, struct vm_area_struct *vma)
> return mtk_drm_gem_object_mmap(obj, vma);
> }
>
> +void *mtk_drm_gem_vmap_buf(struct drm_gem_object *obj)
> +{
> + struct mtk_drm_gem_obj *mtk_gem = to_mtk_gem_obj(obj);
> +
> + return mtk_gem->cookie;
> +}
> +
> int mtk_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
> {
> struct drm_gem_object *obj;
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.h b/drivers/gpu/drm/mediatek/mtk_drm_gem.h
> index 534639b..3c48af9 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.h
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.h
> @@ -49,6 +49,7 @@ int mtk_drm_gem_dumb_create(struct drm_file *file_priv, struct drm_device *dev,
> int mtk_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
> int mtk_drm_gem_mmap_buf(struct drm_gem_object *obj,
> struct vm_area_struct *vma);
> +void *mtk_drm_gem_vmap_buf(struct drm_gem_object *obj);
> struct sg_table *mtk_gem_prime_get_sg_table(struct drm_gem_object *obj);
> struct drm_gem_object *mtk_gem_prime_import_sg_table(struct drm_device *dev,
> struct dma_buf_attachment *attach, struct sg_table *sg);