treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / gpu / drm / mediatek / mtk_drm_gem.h
blobff9f976d980797899522789af879413fe20a516a
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Copyright (c) 2015 MediaTek Inc.
4 */
6 #ifndef _MTK_DRM_GEM_H_
7 #define _MTK_DRM_GEM_H_
9 #include <drm/drm_gem.h>
12 * mtk drm buffer structure.
14 * @base: a gem object.
15 * - a new handle to this gem object would be created
16 * by drm_gem_handle_create().
17 * @cookie: the return value of dma_alloc_attrs(), keep it for dma_free_attrs()
18 * @kvaddr: kernel virtual address of gem buffer.
19 * @dma_addr: dma address of gem buffer.
20 * @dma_attrs: dma attributes of gem buffer.
22 * P.S. this object would be transferred to user as kms_bo.handle so
23 * user can access the buffer through kms_bo.handle.
25 struct mtk_drm_gem_obj {
26 struct drm_gem_object base;
27 void *cookie;
28 void *kvaddr;
29 dma_addr_t dma_addr;
30 unsigned long dma_attrs;
31 struct sg_table *sg;
32 struct page **pages;
35 #define to_mtk_gem_obj(x) container_of(x, struct mtk_drm_gem_obj, base)
37 void mtk_drm_gem_free_object(struct drm_gem_object *gem);
38 struct mtk_drm_gem_obj *mtk_drm_gem_create(struct drm_device *dev, size_t size,
39 bool alloc_kmap);
40 int mtk_drm_gem_dumb_create(struct drm_file *file_priv, struct drm_device *dev,
41 struct drm_mode_create_dumb *args);
42 int mtk_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
43 int mtk_drm_gem_mmap_buf(struct drm_gem_object *obj,
44 struct vm_area_struct *vma);
45 struct sg_table *mtk_gem_prime_get_sg_table(struct drm_gem_object *obj);
46 struct drm_gem_object *mtk_gem_prime_import_sg_table(struct drm_device *dev,
47 struct dma_buf_attachment *attach, struct sg_table *sg);
48 void *mtk_drm_gem_prime_vmap(struct drm_gem_object *obj);
49 void mtk_drm_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
51 #endif