kgsl_drm.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. #ifndef _KGSL_DRM_H_
  2. #define _KGSL_DRM_H_
  3. #include "drm.h"
  4. #define DRM_KGSL_GEM_CREATE 0x00
  5. #define DRM_KGSL_GEM_PREP 0x01
  6. #define DRM_KGSL_GEM_SETMEMTYPE 0x02
  7. #define DRM_KGSL_GEM_GETMEMTYPE 0x03
  8. #define DRM_KGSL_GEM_MMAP 0x04
  9. #define DRM_KGSL_GEM_ALLOC 0x05
  10. #define DRM_KGSL_GEM_BIND_GPU 0x06
  11. #define DRM_KGSL_GEM_UNBIND_GPU 0x07
  12. #define DRM_KGSL_GEM_GET_BUFINFO 0x08
  13. #define DRM_KGSL_GEM_SET_BUFCOUNT 0x09
  14. #define DRM_KGSL_GEM_SET_ACTIVE 0x0A
  15. #define DRM_KGSL_GEM_LOCK_HANDLE 0x0B
  16. #define DRM_KGSL_GEM_UNLOCK_HANDLE 0x0C
  17. #define DRM_KGSL_GEM_UNLOCK_ON_TS 0x0D
  18. #define DRM_KGSL_GEM_CREATE_FD 0x0E
  19. #define DRM_KGSL_GEM_GET_ION_FD 0x0F
  20. #define DRM_KGSL_GEM_CREATE_FROM_ION 0x10
  21. #define DRM_KGSL_GEM_SET_GLOCK_HANDLES_INFO 0x11
  22. #define DRM_KGSL_GEM_GET_GLOCK_HANDLES_INFO 0x12
  23. #define DRM_KGSL_GEM_GET_BUFCOUNT 0x13
  24. #define DRM_IOCTL_KGSL_GEM_CREATE \
  25. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_CREATE, struct drm_kgsl_gem_create)
  26. #define DRM_IOCTL_KGSL_GEM_PREP \
  27. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_PREP, struct drm_kgsl_gem_prep)
  28. #define DRM_IOCTL_KGSL_GEM_SETMEMTYPE \
  29. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_SETMEMTYPE, \
  30. struct drm_kgsl_gem_memtype)
  31. #define DRM_IOCTL_KGSL_GEM_GETMEMTYPE \
  32. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_GETMEMTYPE, \
  33. struct drm_kgsl_gem_memtype)
  34. #define DRM_IOCTL_KGSL_GEM_MMAP \
  35. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_MMAP, struct drm_kgsl_gem_mmap)
  36. #define DRM_IOCTL_KGSL_GEM_ALLOC \
  37. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_ALLOC, struct drm_kgsl_gem_alloc)
  38. #define DRM_IOCTL_KGSL_GEM_BIND_GPU \
  39. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_BIND_GPU, struct drm_kgsl_gem_bind_gpu)
  40. #define DRM_IOCTL_KGSL_GEM_UNBIND_GPU \
  41. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_UNBIND_GPU, \
  42. struct drm_kgsl_gem_bind_gpu)
  43. #define DRM_IOCTL_KGSL_GEM_GET_BUFINFO \
  44. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_GET_BUFINFO, \
  45. struct drm_kgsl_gem_bufinfo)
  46. #define DRM_IOCTL_KGSL_GEM_SET_BUFCOUNT \
  47. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_SET_BUFCOUNT, \
  48. struct drm_kgsl_gem_bufcount)
  49. #define DRM_IOCTL_KGSL_GEM_GET_BUFCOUNT \
  50. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_GET_BUFCOUNT, \
  51. struct drm_kgsl_gem_bufcount)
  52. #define DRM_IOCTL_KGSL_GEM_SET_ACTIVE \
  53. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_SET_ACTIVE, \
  54. struct drm_kgsl_gem_active)
  55. #define DRM_IOCTL_KGSL_GEM_LOCK_HANDLE \
  56. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_LOCK_HANDLE, \
  57. struct drm_kgsl_gem_lock_handles)
  58. #define DRM_IOCTL_KGSL_GEM_UNLOCK_HANDLE \
  59. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_UNLOCK_HANDLE, \
  60. struct drm_kgsl_gem_unlock_handles)
  61. #define DRM_IOCTL_KGSL_GEM_UNLOCK_ON_TS \
  62. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_UNLOCK_ON_TS, \
  63. struct drm_kgsl_gem_unlock_on_ts)
  64. #define DRM_IOCTL_KGSL_GEM_CREATE_FD \
  65. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_CREATE_FD, \
  66. struct drm_kgsl_gem_create_fd)
  67. #define DRM_IOCTL_KGSL_GEM_GET_ION_FD \
  68. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_GET_ION_FD, \
  69. struct drm_kgsl_gem_get_ion_fd)
  70. #define DRM_IOCTL_KGSL_GEM_CREATE_FROM_ION \
  71. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_CREATE_FROM_ION, \
  72. struct drm_kgsl_gem_create_from_ion)
  73. #define DRM_IOCTL_KGSL_GEM_SET_GLOCK_HANDLES_INFO \
  74. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_SET_GLOCK_HANDLES_INFO, \
  75. struct drm_kgsl_gem_glockinfo)
  76. #define DRM_IOCTL_KGSL_GEM_GET_GLOCK_HANDLES_INFO \
  77. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_GET_GLOCK_HANDLES_INFO, \
  78. struct drm_kgsl_gem_glockinfo)
  79. /* Maximum number of sub buffers per GEM object */
  80. #define DRM_KGSL_GEM_MAX_BUFFERS 3
  81. /* Memory types - these define the source and caching policies
  82. of the GEM memory chunk */
  83. /* Legacy definitions left for compatability */
  84. #define DRM_KGSL_GEM_TYPE_EBI 0
  85. #define DRM_KGSL_GEM_TYPE_SMI 1
  86. #define DRM_KGSL_GEM_TYPE_KMEM 2
  87. #define DRM_KGSL_GEM_TYPE_KMEM_NOCACHE 3
  88. #define DRM_KGSL_GEM_TYPE_MEM_MASK 0xF
  89. /* Contiguous memory (PMEM) */
  90. #define DRM_KGSL_GEM_TYPE_PMEM 0x000100
  91. /* PMEM memory types */
  92. #define DRM_KGSL_GEM_PMEM_EBI 0x001000
  93. #define DRM_KGSL_GEM_PMEM_SMI 0x002000
  94. /* Standard paged memory */
  95. #define DRM_KGSL_GEM_TYPE_MEM 0x010000
  96. /* Caching controls */
  97. #define DRM_KGSL_GEM_CACHE_NONE 0x000000
  98. #define DRM_KGSL_GEM_CACHE_WCOMBINE 0x100000
  99. #define DRM_KGSL_GEM_CACHE_WTHROUGH 0x200000
  100. #define DRM_KGSL_GEM_CACHE_WBACK 0x400000
  101. #define DRM_KGSL_GEM_CACHE_WBACKWA 0x800000
  102. #define DRM_KGSL_GEM_CACHE_MASK 0xF00000
  103. /* FD based objects */
  104. #define DRM_KGSL_GEM_TYPE_FD_FBMEM 0x1000000
  105. #define DRM_KGSL_GEM_TYPE_FD_MASK 0xF000000
  106. /* Timestamp types */
  107. #define DRM_KGSL_GEM_TS_3D 0x00000430
  108. #define DRM_KGSL_GEM_TS_2D 0x00000180
  109. struct drm_kgsl_gem_create {
  110. uint32_t size;
  111. uint32_t handle;
  112. };
  113. struct drm_kgsl_gem_prep {
  114. uint32_t handle;
  115. uint32_t phys;
  116. uint64_t offset;
  117. };
  118. struct drm_kgsl_gem_memtype {
  119. uint32_t handle;
  120. uint32_t type;
  121. };
  122. struct drm_kgsl_gem_mmap {
  123. uint32_t handle;
  124. uint32_t size;
  125. uint32_t hostptr;
  126. uint64_t offset;
  127. };
  128. struct drm_kgsl_gem_alloc {
  129. uint32_t handle;
  130. uint64_t offset;
  131. };
  132. struct drm_kgsl_gem_bind_gpu {
  133. uint32_t handle;
  134. uint32_t gpuptr;
  135. };
  136. struct drm_kgsl_gem_bufinfo {
  137. uint32_t handle;
  138. uint32_t count;
  139. uint32_t active;
  140. uint32_t offset[DRM_KGSL_GEM_MAX_BUFFERS];
  141. uint32_t gpuaddr[DRM_KGSL_GEM_MAX_BUFFERS];
  142. };
  143. struct drm_kgsl_gem_glockinfo {
  144. uint32_t handle;
  145. int glockhandle[DRM_KGSL_GEM_MAX_BUFFERS];
  146. };
  147. struct drm_kgsl_gem_bufcount {
  148. uint32_t handle;
  149. uint32_t bufcount;
  150. };
  151. struct drm_kgsl_gem_active {
  152. uint32_t handle;
  153. uint32_t active;
  154. };
  155. struct drm_kgsl_gem_lock_handles {
  156. uint32_t num_handles;
  157. uint32_t *handle_list;
  158. uint32_t pid;
  159. uint32_t lock_id; /* Returned lock id used for unlocking */
  160. };
  161. struct drm_kgsl_gem_unlock_handles {
  162. uint32_t lock_id;
  163. };
  164. struct drm_kgsl_gem_unlock_on_ts {
  165. uint32_t lock_id;
  166. uint32_t timestamp; /* This field is a hw generated ts */
  167. uint32_t type; /* Which pipe to check for ts generation */
  168. };
  169. struct drm_kgsl_gem_create_fd {
  170. uint32_t fd;
  171. uint32_t handle;
  172. };
  173. struct drm_kgsl_gem_get_ion_fd {
  174. uint32_t ion_fd;
  175. uint32_t handle;
  176. };
  177. struct drm_kgsl_gem_create_from_ion {
  178. uint32_t ion_fd;
  179. uint32_t handle;
  180. };
  181. #endif