2 * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd
3 * Author:Mark Yao <mark.yao@rock-chips.com>
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
15 #ifndef _ROCKCHIP_DRM_GEM_H
16 #define _ROCKCHIP_DRM_GEM_H
18 #define to_rockchip_obj(x) container_of(x, struct rockchip_gem_object, base)
20 struct rockchip_gem_object
{
21 struct drm_gem_object base
;
26 unsigned long dma_attrs
;
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
, size_t size
,
32 struct sg_table
*sgt
);
33 void *rockchip_gem_prime_vmap(struct drm_gem_object
*obj
);
34 void rockchip_gem_prime_vunmap(struct drm_gem_object
*obj
, void *vaddr
);
36 /* drm driver mmap file operations */
37 int rockchip_gem_mmap(struct file
*filp
, struct vm_area_struct
*vma
);
39 /* mmap a gem object to userspace. */
40 int rockchip_gem_mmap_buf(struct drm_gem_object
*obj
,
41 struct vm_area_struct
*vma
);
43 struct rockchip_gem_object
*
44 rockchip_gem_create_object(struct drm_device
*drm
, unsigned int size
,
47 void rockchip_gem_free_object(struct drm_gem_object
*obj
);
49 int rockchip_gem_dumb_create(struct drm_file
*file_priv
,
50 struct drm_device
*dev
,
51 struct drm_mode_create_dumb
*args
);
52 int rockchip_gem_dumb_map_offset(struct drm_file
*file_priv
,
53 struct drm_device
*dev
, uint32_t handle
,
55 #endif /* _ROCKCHIP_DRM_GEM_H */