omap_gem.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * omap_gem.h -- OMAP DRM GEM Object Management
  3. *
  4. * Copyright (C) 2011 Texas Instruments
  5. * Author: Rob Clark <rob@ti.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License version 2 as published by
  9. * the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope that it will be useful, but WITHOUT
  12. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  14. * more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along with
  17. * this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef __OMAPDRM_GEM_H__
  20. #define __OMAPDRM_GEM_H__
  21. #include <linux/types.h>
  22. enum dma_data_direction;
  23. struct dma_buf;
  24. struct drm_device;
  25. struct drm_file;
  26. struct drm_gem_object;
  27. struct drm_mode_create_dumb;
  28. struct file;
  29. struct list_head;
  30. struct page;
  31. struct seq_file;
  32. struct vm_area_struct;
  33. struct vm_fault;
  34. union omap_gem_size;
  35. /* Initialization and Cleanup */
  36. void omap_gem_init(struct drm_device *dev);
  37. void omap_gem_deinit(struct drm_device *dev);
  38. #ifdef CONFIG_PM
  39. int omap_gem_resume(struct drm_device *dev);
  40. #endif
  41. #ifdef CONFIG_DEBUG_FS
  42. void omap_gem_describe(struct drm_gem_object *obj, struct seq_file *m);
  43. void omap_gem_describe_objects(struct list_head *list, struct seq_file *m);
  44. #endif
  45. /* GEM Object Creation and Deletion */
  46. struct drm_gem_object *omap_gem_new(struct drm_device *dev,
  47. union omap_gem_size gsize, u32 flags);
  48. struct drm_gem_object *omap_gem_new_dmabuf(struct drm_device *dev, size_t size,
  49. struct sg_table *sgt);
  50. int omap_gem_new_handle(struct drm_device *dev, struct drm_file *file,
  51. union omap_gem_size gsize, u32 flags, u32 *handle);
  52. void omap_gem_free_object(struct drm_gem_object *obj);
  53. void *omap_gem_vaddr(struct drm_gem_object *obj);
  54. /* Dumb Buffers Interface */
  55. int omap_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,
  56. u32 handle, u64 *offset);
  57. int omap_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
  58. struct drm_mode_create_dumb *args);
  59. /* mmap() Interface */
  60. int omap_gem_mmap(struct file *filp, struct vm_area_struct *vma);
  61. int omap_gem_mmap_obj(struct drm_gem_object *obj,
  62. struct vm_area_struct *vma);
  63. u64 omap_gem_mmap_offset(struct drm_gem_object *obj);
  64. size_t omap_gem_mmap_size(struct drm_gem_object *obj);
  65. /* PRIME Interface */
  66. struct dma_buf *omap_gem_prime_export(struct drm_device *dev,
  67. struct drm_gem_object *obj, int flags);
  68. struct drm_gem_object *omap_gem_prime_import(struct drm_device *dev,
  69. struct dma_buf *buffer);
  70. int omap_gem_fault(struct vm_fault *vmf);
  71. int omap_gem_roll(struct drm_gem_object *obj, u32 roll);
  72. void omap_gem_cpu_sync_page(struct drm_gem_object *obj, int pgoff);
  73. void omap_gem_dma_sync_buffer(struct drm_gem_object *obj,
  74. enum dma_data_direction dir);
  75. int omap_gem_pin(struct drm_gem_object *obj, dma_addr_t *dma_addr);
  76. void omap_gem_unpin(struct drm_gem_object *obj);
  77. int omap_gem_get_pages(struct drm_gem_object *obj, struct page ***pages,
  78. bool remap);
  79. int omap_gem_put_pages(struct drm_gem_object *obj);
  80. u32 omap_gem_flags(struct drm_gem_object *obj);
  81. int omap_gem_rotated_dma_addr(struct drm_gem_object *obj, u32 orient,
  82. int x, int y, dma_addr_t *dma_addr);
  83. int omap_gem_tiled_stride(struct drm_gem_object *obj, u32 orient);
  84. #endif /* __OMAPDRM_GEM_H__ */