rockchip_drm_gem.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd
  3. * Author:Mark Yao <mark.yao@rock-chips.com>
  4. *
  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.
  8. *
  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.
  13. */
  14. #ifndef _ROCKCHIP_DRM_GEM_H
  15. #define _ROCKCHIP_DRM_GEM_H
  16. #define to_rockchip_obj(x) container_of(x, struct rockchip_gem_object, base)
  17. struct rockchip_gem_object {
  18. struct drm_gem_object base;
  19. unsigned int flags;
  20. void *kvaddr;
  21. dma_addr_t dma_addr;
  22. struct dma_attrs dma_attrs;
  23. };
  24. struct sg_table *rockchip_gem_prime_get_sg_table(struct drm_gem_object *obj);
  25. struct drm_gem_object *
  26. rockchip_gem_prime_import_sg_table(struct drm_device *dev, size_t size,
  27. struct sg_table *sgt);
  28. void *rockchip_gem_prime_vmap(struct drm_gem_object *obj);
  29. void rockchip_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
  30. /* drm driver mmap file operations */
  31. int rockchip_gem_mmap(struct file *filp, struct vm_area_struct *vma);
  32. /* mmap a gem object to userspace. */
  33. int rockchip_gem_mmap_buf(struct drm_gem_object *obj,
  34. struct vm_area_struct *vma);
  35. struct rockchip_gem_object *
  36. rockchip_gem_create_object(struct drm_device *drm, unsigned int size,
  37. bool alloc_kmap);
  38. void rockchip_gem_free_object(struct drm_gem_object *obj);
  39. int rockchip_gem_dumb_create(struct drm_file *file_priv,
  40. struct drm_device *dev,
  41. struct drm_mode_create_dumb *args);
  42. int rockchip_gem_dumb_map_offset(struct drm_file *file_priv,
  43. struct drm_device *dev, uint32_t handle,
  44. uint64_t *offset);
  45. #endif /* _ROCKCHIP_DRM_GEM_H */