/include/drm/kgsl_drm.h

https://bitbucket.org/thekraven/iscream_thunderc-2.6.35 · C++ Header · 221 lines · 139 code · 44 blank · 38 comment · 0 complexity · 0e05203a50a7feca9d50b6214a7d4749 MD5 · raw file

  1. /* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
  2. *
  3. * Redistribution and use in source and binary forms, with or without
  4. * modification, are permitted provided that the following conditions are
  5. * met:
  6. * * Redistributions of source code must retain the above copyright
  7. * notice, this list of conditions and the following disclaimer.
  8. * * Redistributions in binary form must reproduce the above
  9. * copyright notice, this list of conditions and the following
  10. * disclaimer in the documentation and/or other materials provided
  11. * with the distribution.
  12. * * Neither the name of Code Aurora Forum, Inc. nor the names of its
  13. * contributors may be used to endorse or promote products derived
  14. * from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
  17. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  18. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
  19. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
  20. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  21. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  22. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  23. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  24. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  25. * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  26. * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. *
  28. */
  29. #ifndef _KGSL_DRM_H_
  30. #define _KGSL_DRM_H_
  31. #include "drm.h"
  32. #define DRM_KGSL_GEM_CREATE 0x00
  33. #define DRM_KGSL_GEM_PREP 0x01
  34. #define DRM_KGSL_GEM_SETMEMTYPE 0x02
  35. #define DRM_KGSL_GEM_GETMEMTYPE 0x03
  36. #define DRM_KGSL_GEM_MMAP 0x04
  37. #define DRM_KGSL_GEM_ALLOC 0x05
  38. #define DRM_KGSL_GEM_BIND_GPU 0x06
  39. #define DRM_KGSL_GEM_UNBIND_GPU 0x07
  40. #define DRM_KGSL_GEM_GET_BUFINFO 0x08
  41. #define DRM_KGSL_GEM_SET_BUFCOUNT 0x09
  42. #define DRM_KGSL_GEM_SET_ACTIVE 0x0A
  43. #define DRM_KGSL_GEM_LOCK_HANDLE 0x0B
  44. #define DRM_KGSL_GEM_UNLOCK_HANDLE 0x0C
  45. #define DRM_KGSL_GEM_UNLOCK_ON_TS 0x0D
  46. #define DRM_KGSL_GEM_CREATE_FD 0x0E
  47. #define DRM_IOCTL_KGSL_GEM_CREATE \
  48. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_CREATE, struct drm_kgsl_gem_create)
  49. #define DRM_IOCTL_KGSL_GEM_PREP \
  50. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_PREP, struct drm_kgsl_gem_prep)
  51. #define DRM_IOCTL_KGSL_GEM_SETMEMTYPE \
  52. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_SETMEMTYPE, \
  53. struct drm_kgsl_gem_memtype)
  54. #define DRM_IOCTL_KGSL_GEM_GETMEMTYPE \
  55. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_GETMEMTYPE, \
  56. struct drm_kgsl_gem_memtype)
  57. #define DRM_IOCTL_KGSL_GEM_MMAP \
  58. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_MMAP, struct drm_kgsl_gem_mmap)
  59. #define DRM_IOCTL_KGSL_GEM_ALLOC \
  60. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_ALLOC, struct drm_kgsl_gem_alloc)
  61. #define DRM_IOCTL_KGSL_GEM_BIND_GPU \
  62. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_BIND_GPU, struct drm_kgsl_gem_bind_gpu)
  63. #define DRM_IOCTL_KGSL_GEM_UNBIND_GPU \
  64. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_UNBIND_GPU, \
  65. struct drm_kgsl_gem_bind_gpu)
  66. #define DRM_IOCTL_KGSL_GEM_GET_BUFINFO \
  67. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_GET_BUFINFO, \
  68. struct drm_kgsl_gem_bufinfo)
  69. #define DRM_IOCTL_KGSL_GEM_SET_BUFCOUNT \
  70. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_SET_BUFCOUNT, \
  71. struct drm_kgsl_gem_bufcount)
  72. #define DRM_IOCTL_KGSL_GEM_SET_ACTIVE \
  73. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_SET_ACTIVE, \
  74. struct drm_kgsl_gem_active)
  75. #define DRM_IOCTL_KGSL_GEM_LOCK_HANDLE \
  76. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_LOCK_HANDLE, \
  77. struct drm_kgsl_gem_lock_handles)
  78. #define DRM_IOCTL_KGSL_GEM_UNLOCK_HANDLE \
  79. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_UNLOCK_HANDLE, \
  80. struct drm_kgsl_gem_unlock_handles)
  81. #define DRM_IOCTL_KGSL_GEM_UNLOCK_ON_TS \
  82. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_UNLOCK_ON_TS, \
  83. struct drm_kgsl_gem_unlock_on_ts)
  84. #define DRM_IOCTL_KGSL_GEM_CREATE_FD \
  85. DRM_IOWR(DRM_COMMAND_BASE + DRM_KGSL_GEM_CREATE_FD, \
  86. struct drm_kgsl_gem_create_fd)
  87. /* Maximum number of sub buffers per GEM object */
  88. #define DRM_KGSL_GEM_MAX_BUFFERS 2
  89. /* Memory types - these define the source and caching policies
  90. of the GEM memory chunk */
  91. /* Legacy definitions left for compatability */
  92. #define DRM_KGSL_GEM_TYPE_EBI 0
  93. #define DRM_KGSL_GEM_TYPE_SMI 1
  94. #define DRM_KGSL_GEM_TYPE_KMEM 2
  95. #define DRM_KGSL_GEM_TYPE_KMEM_NOCACHE 3
  96. #define DRM_KGSL_GEM_TYPE_MEM_MASK 0xF
  97. /* Contiguous memory (PMEM) */
  98. #define DRM_KGSL_GEM_TYPE_PMEM 0x000100
  99. /* PMEM memory types */
  100. #define DRM_KGSL_GEM_PMEM_EBI 0x001000
  101. #define DRM_KGSL_GEM_PMEM_SMI 0x002000
  102. /* Standard paged memory */
  103. #define DRM_KGSL_GEM_TYPE_MEM 0x010000
  104. /* Caching controls */
  105. #define DRM_KGSL_GEM_CACHE_NONE 0x000000
  106. #define DRM_KGSL_GEM_CACHE_WCOMBINE 0x100000
  107. #define DRM_KGSL_GEM_CACHE_WTHROUGH 0x200000
  108. #define DRM_KGSL_GEM_CACHE_WBACK 0x400000
  109. #define DRM_KGSL_GEM_CACHE_WBACKWA 0x800000
  110. #define DRM_KGSL_GEM_CACHE_MASK 0xF00000
  111. /* FD based objects */
  112. #define DRM_KGSL_GEM_TYPE_FD_FBMEM 0x1000000
  113. #define DRM_KGSL_GEM_TYPE_FD_MASK 0xF000000
  114. /* Timestamp types */
  115. #define DRM_KGSL_GEM_TS_3D 0x00000430
  116. #define DRM_KGSL_GEM_TS_2D 0x00000180
  117. struct drm_kgsl_gem_create {
  118. uint32_t size;
  119. uint32_t handle;
  120. };
  121. struct drm_kgsl_gem_prep {
  122. uint32_t handle;
  123. uint32_t phys;
  124. uint64_t offset;
  125. };
  126. struct drm_kgsl_gem_memtype {
  127. uint32_t handle;
  128. uint32_t type;
  129. };
  130. struct drm_kgsl_gem_mmap {
  131. uint32_t handle;
  132. uint32_t size;
  133. uint32_t hostptr;
  134. uint64_t offset;
  135. };
  136. struct drm_kgsl_gem_alloc {
  137. uint32_t handle;
  138. uint64_t offset;
  139. };
  140. struct drm_kgsl_gem_bind_gpu {
  141. uint32_t handle;
  142. uint32_t gpuptr;
  143. };
  144. struct drm_kgsl_gem_bufinfo {
  145. uint32_t handle;
  146. uint32_t count;
  147. uint32_t active;
  148. uint32_t offset[DRM_KGSL_GEM_MAX_BUFFERS];
  149. uint32_t gpuaddr[DRM_KGSL_GEM_MAX_BUFFERS];
  150. };
  151. struct drm_kgsl_gem_bufcount {
  152. uint32_t handle;
  153. uint32_t bufcount;
  154. };
  155. struct drm_kgsl_gem_active {
  156. uint32_t handle;
  157. uint32_t active;
  158. };
  159. struct drm_kgsl_gem_lock_handles {
  160. uint32_t num_handles;
  161. uint32_t *handle_list;
  162. uint32_t pid;
  163. uint32_t lock_id; /* Returned lock id used for unlocking */
  164. };
  165. struct drm_kgsl_gem_unlock_handles {
  166. uint32_t lock_id;
  167. };
  168. struct drm_kgsl_gem_unlock_on_ts {
  169. uint32_t lock_id;
  170. uint32_t timestamp; /* This field is a hw generated ts */
  171. uint32_t type; /* Which pipe to check for ts generation */
  172. };
  173. struct drm_kgsl_gem_create_fd {
  174. uint32_t fd;
  175. uint32_t handle;
  176. };
  177. #endif