Lines Matching refs:bo
32 static inline struct tegra_bo *host1x_to_drm_bo(struct host1x_bo *bo) in host1x_to_drm_bo() argument
34 return container_of(bo, struct tegra_bo, base); in host1x_to_drm_bo()
37 static void tegra_bo_put(struct host1x_bo *bo) in tegra_bo_put() argument
39 struct tegra_bo *obj = host1x_to_drm_bo(bo); in tegra_bo_put()
47 static dma_addr_t tegra_bo_pin(struct host1x_bo *bo, struct sg_table **sgt) in tegra_bo_pin() argument
49 struct tegra_bo *obj = host1x_to_drm_bo(bo); in tegra_bo_pin()
54 static void tegra_bo_unpin(struct host1x_bo *bo, struct sg_table *sgt) in tegra_bo_unpin() argument
58 static void *tegra_bo_mmap(struct host1x_bo *bo) in tegra_bo_mmap() argument
60 struct tegra_bo *obj = host1x_to_drm_bo(bo); in tegra_bo_mmap()
65 static void tegra_bo_munmap(struct host1x_bo *bo, void *addr) in tegra_bo_munmap() argument
69 static void *tegra_bo_kmap(struct host1x_bo *bo, unsigned int page) in tegra_bo_kmap() argument
71 struct tegra_bo *obj = host1x_to_drm_bo(bo); in tegra_bo_kmap()
76 static void tegra_bo_kunmap(struct host1x_bo *bo, unsigned int page, in tegra_bo_kunmap() argument
81 static struct host1x_bo *tegra_bo_get(struct host1x_bo *bo) in tegra_bo_get() argument
83 struct tegra_bo *obj = host1x_to_drm_bo(bo); in tegra_bo_get()
90 return bo; in tegra_bo_get()
104 static void tegra_bo_destroy(struct drm_device *drm, struct tegra_bo *bo) in tegra_bo_destroy() argument
106 dma_free_writecombine(drm->dev, bo->gem.size, bo->vaddr, bo->paddr); in tegra_bo_destroy()
109 unsigned int tegra_bo_get_mmap_offset(struct tegra_bo *bo) in tegra_bo_get_mmap_offset() argument
111 return (unsigned int)bo->gem.map_list.hash.key << PAGE_SHIFT; in tegra_bo_get_mmap_offset()
116 struct tegra_bo *bo; in tegra_bo_create() local
119 bo = kzalloc(sizeof(*bo), GFP_KERNEL); in tegra_bo_create()
120 if (!bo) in tegra_bo_create()
123 host1x_bo_init(&bo->base, &tegra_bo_ops); in tegra_bo_create()
126 bo->vaddr = dma_alloc_writecombine(drm->dev, size, &bo->paddr, in tegra_bo_create()
128 if (!bo->vaddr) { in tegra_bo_create()
135 err = drm_gem_object_init(drm, &bo->gem, size); in tegra_bo_create()
139 err = drm_gem_create_mmap_offset(&bo->gem); in tegra_bo_create()
143 return bo; in tegra_bo_create()
146 drm_gem_object_release(&bo->gem); in tegra_bo_create()
148 tegra_bo_destroy(drm, bo); in tegra_bo_create()
150 kfree(bo); in tegra_bo_create()
161 struct tegra_bo *bo; in tegra_bo_create_with_handle() local
164 bo = tegra_bo_create(drm, size); in tegra_bo_create_with_handle()
165 if (IS_ERR(bo)) in tegra_bo_create_with_handle()
166 return bo; in tegra_bo_create_with_handle()
168 ret = drm_gem_handle_create(file, &bo->gem, handle); in tegra_bo_create_with_handle()
172 drm_gem_object_unreference_unlocked(&bo->gem); in tegra_bo_create_with_handle()
174 return bo; in tegra_bo_create_with_handle()
177 tegra_bo_free_object(&bo->gem); in tegra_bo_create_with_handle()
183 struct tegra_bo *bo = to_tegra_bo(gem); in tegra_bo_free_object() local
189 tegra_bo_destroy(gem->dev, bo); in tegra_bo_free_object()
191 kfree(bo); in tegra_bo_free_object()
198 struct tegra_bo *bo; in tegra_bo_dumb_create() local
206 bo = tegra_bo_create_with_handle(file, drm, args->size, in tegra_bo_dumb_create()
208 if (IS_ERR(bo)) in tegra_bo_dumb_create()
209 return PTR_ERR(bo); in tegra_bo_dumb_create()
218 struct tegra_bo *bo; in tegra_bo_dumb_map_offset() local
229 bo = to_tegra_bo(gem); in tegra_bo_dumb_map_offset()
231 *offset = tegra_bo_get_mmap_offset(bo); in tegra_bo_dumb_map_offset()
248 struct tegra_bo *bo; in tegra_drm_mmap() local
256 bo = to_tegra_bo(gem); in tegra_drm_mmap()
258 ret = remap_pfn_range(vma, vma->vm_start, bo->paddr >> PAGE_SHIFT, in tegra_drm_mmap()