.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,
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)
{
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);
struct drm_gem_object base;
unsigned int flags;
- struct sg_table *sgt;
void *kvaddr;
dma_addr_t dma_addr;
struct dma_attrs dma_attrs;
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);