From 6bab72066b991bc84a16b2555f249cbbbddee9b0 Mon Sep 17 00:00:00 2001 From: Jeffy Chen Date: Fri, 18 Nov 2016 21:17:31 +0800 Subject: [PATCH] Revert "drm/rockchip: gem: import dma_buf to gem" This reverts commit a05932da07ecc0a214bd24322ffbcec79be5d5e0. Change-Id: I91f9efb690fe4f82b5bf34debca6f7612bbd9e4e Signed-off-by: Randy Li --- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 1 - drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 32 ++------------------- drivers/gpu/drm/rockchip/rockchip_drm_gem.h | 4 +-- 3 files changed, 4 insertions(+), 33 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index 13ccdc0c9bba..dc541007f4fe 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -1041,7 +1041,6 @@ static struct drm_driver rockchip_drm_driver = { .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_prime_import = drm_gem_prime_import, - .gem_prime_import_sg_table = rockchip_gem_prime_import_sg_table, .gem_prime_export = drm_gem_prime_export, .gem_prime_get_sg_table = rockchip_gem_prime_get_sg_table, .gem_prime_vmap = rockchip_gem_prime_vmap, diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c index 92dc967d71f3..b215dc890adb 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c @@ -109,29 +109,6 @@ int rockchip_gem_mmap(struct file *filp, struct vm_area_struct *vma) return rockchip_drm_gem_object_mmap(obj, vma); } -struct drm_gem_object * -rockchip_gem_prime_import_sg_table(struct drm_device *drm, - struct dma_buf_attachment *attach, - struct sg_table *sgt) -{ - struct rockchip_gem_object *rk_obj; - struct drm_gem_object *obj; - - rk_obj = kzalloc(sizeof(*rk_obj), GFP_KERNEL); - if (!rk_obj) - return ERR_PTR(-ENOMEM); - - obj = &rk_obj->base; - - drm_gem_private_object_init(drm, obj, attach->dmabuf->size); - - rk_obj->dma_addr = sg_dma_address(sgt->sgl); - rk_obj->sgt = sgt; - sg_dma_len(sgt->sgl) = obj->size; - - return obj; -} - struct rockchip_gem_object * rockchip_gem_create_object(struct drm_device *drm, unsigned int size, bool alloc_kmap) @@ -169,14 +146,11 @@ void rockchip_gem_free_object(struct drm_gem_object *obj) { struct rockchip_gem_object *rk_obj; + drm_gem_free_mmap_offset(obj); + rk_obj = to_rockchip_obj(obj); - if (obj->import_attach) { - drm_prime_gem_destroy(obj, rk_obj->sgt); - } else { - drm_gem_free_mmap_offset(obj); - rockchip_gem_free_buf(rk_obj); - } + rockchip_gem_free_buf(rk_obj); #ifdef CONFIG_DRM_DMA_SYNC drm_fence_signal_and_put(&rk_obj->acquire_fence); diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.h b/drivers/gpu/drm/rockchip/rockchip_drm_gem.h index c10582ec0b59..0cbe8606e4d1 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.h +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.h @@ -21,7 +21,6 @@ struct rockchip_gem_object { struct drm_gem_object base; unsigned int flags; - struct sg_table *sgt; void *kvaddr; dma_addr_t dma_addr; struct dma_attrs dma_attrs; @@ -46,8 +45,7 @@ struct rockchip_gem_object_node { struct sg_table *rockchip_gem_prime_get_sg_table(struct drm_gem_object *obj); struct drm_gem_object * -rockchip_gem_prime_import_sg_table(struct drm_device *dev, - struct dma_buf_attachment *attach, +rockchip_gem_prime_import_sg_table(struct drm_device *dev, size_t size, struct sg_table *sgt); void *rockchip_gem_prime_vmap(struct drm_gem_object *obj); void rockchip_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr); -- 2.34.1