Lines Matching refs:exynos_gem
25 static int exynos_drm_alloc_buf(struct exynos_drm_gem *exynos_gem, bool kvmap) in exynos_drm_alloc_buf() argument
27 struct drm_device *dev = exynos_gem->base.dev; in exynos_drm_alloc_buf()
30 if (exynos_gem->dma_addr) { in exynos_drm_alloc_buf()
40 if (!(exynos_gem->flags & EXYNOS_BO_NONCONTIG)) in exynos_drm_alloc_buf()
47 if (exynos_gem->flags & EXYNOS_BO_WC || in exynos_drm_alloc_buf()
48 !(exynos_gem->flags & EXYNOS_BO_CACHABLE)) in exynos_drm_alloc_buf()
55 exynos_gem->dma_attrs = attr; in exynos_drm_alloc_buf()
56 exynos_gem->cookie = dma_alloc_attrs(to_dma_dev(dev), exynos_gem->size, in exynos_drm_alloc_buf()
57 &exynos_gem->dma_addr, GFP_KERNEL, in exynos_drm_alloc_buf()
58 exynos_gem->dma_attrs); in exynos_drm_alloc_buf()
59 if (!exynos_gem->cookie) { in exynos_drm_alloc_buf()
65 exynos_gem->kvaddr = exynos_gem->cookie; in exynos_drm_alloc_buf()
68 (unsigned long)exynos_gem->dma_addr, exynos_gem->size); in exynos_drm_alloc_buf()
72 static void exynos_drm_free_buf(struct exynos_drm_gem *exynos_gem) in exynos_drm_free_buf() argument
74 struct drm_device *dev = exynos_gem->base.dev; in exynos_drm_free_buf()
76 if (!exynos_gem->dma_addr) { in exynos_drm_free_buf()
82 (unsigned long)exynos_gem->dma_addr, exynos_gem->size); in exynos_drm_free_buf()
84 dma_free_attrs(to_dma_dev(dev), exynos_gem->size, exynos_gem->cookie, in exynos_drm_free_buf()
85 (dma_addr_t)exynos_gem->dma_addr, in exynos_drm_free_buf()
86 exynos_gem->dma_attrs); in exynos_drm_free_buf()
111 void exynos_drm_gem_destroy(struct exynos_drm_gem *exynos_gem) in exynos_drm_gem_destroy() argument
113 struct drm_gem_object *obj = &exynos_gem->base; in exynos_drm_gem_destroy()
125 drm_prime_gem_destroy(obj, exynos_gem->sgt); in exynos_drm_gem_destroy()
127 exynos_drm_free_buf(exynos_gem); in exynos_drm_gem_destroy()
132 kfree(exynos_gem); in exynos_drm_gem_destroy()
150 struct exynos_drm_gem *exynos_gem; in exynos_drm_gem_init() local
154 exynos_gem = kzalloc(sizeof(*exynos_gem), GFP_KERNEL); in exynos_drm_gem_init()
155 if (!exynos_gem) in exynos_drm_gem_init()
158 exynos_gem->size = size; in exynos_drm_gem_init()
159 obj = &exynos_gem->base; in exynos_drm_gem_init()
166 kfree(exynos_gem); in exynos_drm_gem_init()
173 kfree(exynos_gem); in exynos_drm_gem_init()
179 return exynos_gem; in exynos_drm_gem_init()
187 struct exynos_drm_gem *exynos_gem; in exynos_drm_gem_create() local
203 exynos_gem = exynos_drm_gem_init(dev, size); in exynos_drm_gem_create()
204 if (IS_ERR(exynos_gem)) in exynos_drm_gem_create()
205 return exynos_gem; in exynos_drm_gem_create()
217 exynos_gem->flags = flags; in exynos_drm_gem_create()
219 ret = exynos_drm_alloc_buf(exynos_gem, kvmap); in exynos_drm_gem_create()
221 drm_gem_object_release(&exynos_gem->base); in exynos_drm_gem_create()
222 kfree(exynos_gem); in exynos_drm_gem_create()
226 return exynos_gem; in exynos_drm_gem_create()
233 struct exynos_drm_gem *exynos_gem; in exynos_drm_gem_create_ioctl() local
236 exynos_gem = exynos_drm_gem_create(dev, args->flags, args->size, false); in exynos_drm_gem_create_ioctl()
237 if (IS_ERR(exynos_gem)) in exynos_drm_gem_create_ioctl()
238 return PTR_ERR(exynos_gem); in exynos_drm_gem_create_ioctl()
240 ret = exynos_drm_gem_handle_create(&exynos_gem->base, file_priv, in exynos_drm_gem_create_ioctl()
243 exynos_drm_gem_destroy(exynos_gem); in exynos_drm_gem_create_ioctl()
270 static int exynos_drm_gem_mmap_buffer(struct exynos_drm_gem *exynos_gem, in exynos_drm_gem_mmap_buffer() argument
273 struct drm_device *drm_dev = exynos_gem->base.dev; in exynos_drm_gem_mmap_buffer()
283 if (vm_size > exynos_gem->size) in exynos_drm_gem_mmap_buffer()
286 ret = dma_mmap_attrs(to_dma_dev(drm_dev), vma, exynos_gem->cookie, in exynos_drm_gem_mmap_buffer()
287 exynos_gem->dma_addr, exynos_gem->size, in exynos_drm_gem_mmap_buffer()
288 exynos_gem->dma_attrs); in exynos_drm_gem_mmap_buffer()
300 struct exynos_drm_gem *exynos_gem; in exynos_drm_gem_get_ioctl() local
310 exynos_gem = to_exynos_gem(obj); in exynos_drm_gem_get_ioctl()
312 args->flags = exynos_gem->flags; in exynos_drm_gem_get_ioctl()
313 args->size = exynos_gem->size; in exynos_drm_gem_get_ioctl()
329 struct exynos_drm_gem *exynos_gem; in exynos_drm_gem_dumb_create() local
347 exynos_gem = exynos_drm_gem_create(dev, flags, args->size, false); in exynos_drm_gem_dumb_create()
348 if (IS_ERR(exynos_gem)) { in exynos_drm_gem_dumb_create()
350 return PTR_ERR(exynos_gem); in exynos_drm_gem_dumb_create()
353 ret = exynos_drm_gem_handle_create(&exynos_gem->base, file_priv, in exynos_drm_gem_dumb_create()
356 exynos_drm_gem_destroy(exynos_gem); in exynos_drm_gem_dumb_create()
365 struct exynos_drm_gem *exynos_gem = to_exynos_gem(obj); in exynos_drm_gem_mmap() local
374 exynos_gem->flags); in exynos_drm_gem_mmap()
377 if (exynos_gem->flags & EXYNOS_BO_CACHABLE) in exynos_drm_gem_mmap()
379 else if (exynos_gem->flags & EXYNOS_BO_WC) in exynos_drm_gem_mmap()
386 ret = exynos_drm_gem_mmap_buffer(exynos_gem, vma); in exynos_drm_gem_mmap()
407 struct exynos_drm_gem *exynos_gem = to_exynos_gem(obj); in exynos_drm_gem_prime_get_sg_table() local
416 ret = dma_get_sgtable_attrs(to_dma_dev(drm_dev), sgt, exynos_gem->cookie, in exynos_drm_gem_prime_get_sg_table()
417 exynos_gem->dma_addr, exynos_gem->size, in exynos_drm_gem_prime_get_sg_table()
418 exynos_gem->dma_attrs); in exynos_drm_gem_prime_get_sg_table()
433 struct exynos_drm_gem *exynos_gem; in exynos_drm_gem_prime_import_sg_table() local
441 exynos_gem = exynos_drm_gem_init(dev, attach->dmabuf->size); in exynos_drm_gem_prime_import_sg_table()
442 if (IS_ERR(exynos_gem)) in exynos_drm_gem_prime_import_sg_table()
443 return ERR_CAST(exynos_gem); in exynos_drm_gem_prime_import_sg_table()
451 exynos_gem->flags |= EXYNOS_BO_NONCONTIG; in exynos_drm_gem_prime_import_sg_table()
453 exynos_gem->flags |= EXYNOS_BO_CONTIG; in exynos_drm_gem_prime_import_sg_table()
455 exynos_gem->dma_addr = sg_dma_address(sgt->sgl); in exynos_drm_gem_prime_import_sg_table()
456 exynos_gem->sgt = sgt; in exynos_drm_gem_prime_import_sg_table()
457 return &exynos_gem->base; in exynos_drm_gem_prime_import_sg_table()