1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd
4 * Author:Mark Yao <mark.yao@rock-chips.com>
7 #ifndef _ROCKCHIP_DRM_GEM_H
8 #define _ROCKCHIP_DRM_GEM_H
10 #define to_rockchip_obj(x) container_of(x, struct rockchip_gem_object, base)
12 struct rockchip_gem_object {
13 struct drm_gem_object base;
18 /* Used when IOMMU is disabled */
19 unsigned long dma_attrs;
21 /* Used when IOMMU is enabled */
22 struct drm_mm_node mm;
23 unsigned long num_pages;
29 struct sg_table *rockchip_gem_prime_get_sg_table(struct drm_gem_object *obj);
30 struct drm_gem_object *
31 rockchip_gem_prime_import_sg_table(struct drm_device *dev,
32 struct dma_buf_attachment *attach,
34 int rockchip_gem_prime_vmap(struct drm_gem_object *obj, struct dma_buf_map *map);
35 void rockchip_gem_prime_vunmap(struct drm_gem_object *obj, struct dma_buf_map *map);
37 /* drm driver mmap file operations */
38 int rockchip_gem_mmap(struct file *filp, struct vm_area_struct *vma);
40 /* mmap a gem object to userspace. */
41 int rockchip_gem_mmap_buf(struct drm_gem_object *obj,
42 struct vm_area_struct *vma);
44 struct rockchip_gem_object *
45 rockchip_gem_create_object(struct drm_device *drm, unsigned int size,
48 void rockchip_gem_free_object(struct drm_gem_object *obj);
50 int rockchip_gem_dumb_create(struct drm_file *file_priv,
51 struct drm_device *dev,
52 struct drm_mode_create_dumb *args);
53 #endif /* _ROCKCHIP_DRM_GEM_H */