diff options
Diffstat (limited to 'drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c')
-rw-r--r-- | drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c index b93618c1aa69..62b47972a52e 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c @@ -23,10 +23,12 @@ struct sg_table *etnaviv_gem_prime_get_sg_table(struct drm_gem_object *obj) { struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj); + int npages = obj->size >> PAGE_SHIFT; - BUG_ON(!etnaviv_obj->sgt); /* should have already pinned! */ + if (WARN_ON(!etnaviv_obj->pages)) /* should have already pinned! */ + return NULL; - return etnaviv_obj->sgt; + return drm_prime_pages_to_sg(etnaviv_obj->pages, npages); } void *etnaviv_gem_prime_vmap(struct drm_gem_object *obj) @@ -39,6 +41,19 @@ void etnaviv_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr) /* TODO msm_gem_vunmap() */ } +int etnaviv_gem_prime_mmap(struct drm_gem_object *obj, + struct vm_area_struct *vma) +{ + struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj); + int ret; + + ret = drm_gem_mmap_obj(obj, obj->size, vma); + if (ret < 0) + return ret; + + return etnaviv_obj->ops->mmap(etnaviv_obj, vma); +} + int etnaviv_gem_prime_pin(struct drm_gem_object *obj) { if (!obj->import_attach) { |