tegra_drm.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. /*
  2. * Copyright (c) 2012-2013, NVIDIA CORPORATION. All rights reserved.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. * OTHER DEALINGS IN THE SOFTWARE.
  21. */
  22. #ifndef _UAPI_TEGRA_DRM_H_
  23. #define _UAPI_TEGRA_DRM_H_
  24. #include "drm.h"
  25. #if defined(__cplusplus)
  26. extern "C" {
  27. #endif
  28. #define DRM_TEGRA_GEM_CREATE_TILED (1 << 0)
  29. #define DRM_TEGRA_GEM_CREATE_BOTTOM_UP (1 << 1)
  30. struct drm_tegra_gem_create {
  31. __u64 size;
  32. __u32 flags;
  33. __u32 handle;
  34. };
  35. struct drm_tegra_gem_mmap {
  36. __u32 handle;
  37. __u32 pad;
  38. __u64 offset;
  39. };
  40. struct drm_tegra_syncpt_read {
  41. __u32 id;
  42. __u32 value;
  43. };
  44. struct drm_tegra_syncpt_incr {
  45. __u32 id;
  46. __u32 pad;
  47. };
  48. struct drm_tegra_syncpt_wait {
  49. __u32 id;
  50. __u32 thresh;
  51. __u32 timeout;
  52. __u32 value;
  53. };
  54. #define DRM_TEGRA_NO_TIMEOUT (0xffffffff)
  55. struct drm_tegra_open_channel {
  56. __u32 client;
  57. __u32 pad;
  58. __u64 context;
  59. };
  60. struct drm_tegra_close_channel {
  61. __u64 context;
  62. };
  63. struct drm_tegra_get_syncpt {
  64. __u64 context;
  65. __u32 index;
  66. __u32 id;
  67. };
  68. struct drm_tegra_get_syncpt_base {
  69. __u64 context;
  70. __u32 syncpt;
  71. __u32 id;
  72. };
  73. struct drm_tegra_syncpt {
  74. __u32 id;
  75. __u32 incrs;
  76. };
  77. struct drm_tegra_cmdbuf {
  78. __u32 handle;
  79. __u32 offset;
  80. __u32 words;
  81. __u32 pad;
  82. };
  83. struct drm_tegra_reloc {
  84. struct {
  85. __u32 handle;
  86. __u32 offset;
  87. } cmdbuf;
  88. struct {
  89. __u32 handle;
  90. __u32 offset;
  91. } target;
  92. __u32 shift;
  93. __u32 pad;
  94. };
  95. struct drm_tegra_waitchk {
  96. __u32 handle;
  97. __u32 offset;
  98. __u32 syncpt;
  99. __u32 thresh;
  100. };
  101. struct drm_tegra_submit {
  102. __u64 context;
  103. __u32 num_syncpts;
  104. __u32 num_cmdbufs;
  105. __u32 num_relocs;
  106. __u32 num_waitchks;
  107. __u32 waitchk_mask;
  108. __u32 timeout;
  109. __u64 syncpts;
  110. __u64 cmdbufs;
  111. __u64 relocs;
  112. __u64 waitchks;
  113. __u32 fence; /* Return value */
  114. __u32 reserved[5]; /* future expansion */
  115. };
  116. #define DRM_TEGRA_GEM_TILING_MODE_PITCH 0
  117. #define DRM_TEGRA_GEM_TILING_MODE_TILED 1
  118. #define DRM_TEGRA_GEM_TILING_MODE_BLOCK 2
  119. struct drm_tegra_gem_set_tiling {
  120. /* input */
  121. __u32 handle;
  122. __u32 mode;
  123. __u32 value;
  124. __u32 pad;
  125. };
  126. struct drm_tegra_gem_get_tiling {
  127. /* input */
  128. __u32 handle;
  129. /* output */
  130. __u32 mode;
  131. __u32 value;
  132. __u32 pad;
  133. };
  134. #define DRM_TEGRA_GEM_BOTTOM_UP (1 << 0)
  135. #define DRM_TEGRA_GEM_FLAGS (DRM_TEGRA_GEM_BOTTOM_UP)
  136. struct drm_tegra_gem_set_flags {
  137. /* input */
  138. __u32 handle;
  139. /* output */
  140. __u32 flags;
  141. };
  142. struct drm_tegra_gem_get_flags {
  143. /* input */
  144. __u32 handle;
  145. /* output */
  146. __u32 flags;
  147. };
  148. #define DRM_TEGRA_GEM_CREATE 0x00
  149. #define DRM_TEGRA_GEM_MMAP 0x01
  150. #define DRM_TEGRA_SYNCPT_READ 0x02
  151. #define DRM_TEGRA_SYNCPT_INCR 0x03
  152. #define DRM_TEGRA_SYNCPT_WAIT 0x04
  153. #define DRM_TEGRA_OPEN_CHANNEL 0x05
  154. #define DRM_TEGRA_CLOSE_CHANNEL 0x06
  155. #define DRM_TEGRA_GET_SYNCPT 0x07
  156. #define DRM_TEGRA_SUBMIT 0x08
  157. #define DRM_TEGRA_GET_SYNCPT_BASE 0x09
  158. #define DRM_TEGRA_GEM_SET_TILING 0x0a
  159. #define DRM_TEGRA_GEM_GET_TILING 0x0b
  160. #define DRM_TEGRA_GEM_SET_FLAGS 0x0c
  161. #define DRM_TEGRA_GEM_GET_FLAGS 0x0d
  162. #define DRM_IOCTL_TEGRA_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_CREATE, struct drm_tegra_gem_create)
  163. #define DRM_IOCTL_TEGRA_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_MMAP, struct drm_tegra_gem_mmap)
  164. #define DRM_IOCTL_TEGRA_SYNCPT_READ DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SYNCPT_READ, struct drm_tegra_syncpt_read)
  165. #define DRM_IOCTL_TEGRA_SYNCPT_INCR DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SYNCPT_INCR, struct drm_tegra_syncpt_incr)
  166. #define DRM_IOCTL_TEGRA_SYNCPT_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SYNCPT_WAIT, struct drm_tegra_syncpt_wait)
  167. #define DRM_IOCTL_TEGRA_OPEN_CHANNEL DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_OPEN_CHANNEL, struct drm_tegra_open_channel)
  168. #define DRM_IOCTL_TEGRA_CLOSE_CHANNEL DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_CLOSE_CHANNEL, struct drm_tegra_open_channel)
  169. #define DRM_IOCTL_TEGRA_GET_SYNCPT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT, struct drm_tegra_get_syncpt)
  170. #define DRM_IOCTL_TEGRA_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SUBMIT, struct drm_tegra_submit)
  171. #define DRM_IOCTL_TEGRA_GET_SYNCPT_BASE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT_BASE, struct drm_tegra_get_syncpt_base)
  172. #define DRM_IOCTL_TEGRA_GEM_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_SET_TILING, struct drm_tegra_gem_set_tiling)
  173. #define DRM_IOCTL_TEGRA_GEM_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_GET_TILING, struct drm_tegra_gem_get_tiling)
  174. #define DRM_IOCTL_TEGRA_GEM_SET_FLAGS DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_SET_FLAGS, struct drm_tegra_gem_set_flags)
  175. #define DRM_IOCTL_TEGRA_GEM_GET_FLAGS DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_GET_FLAGS, struct drm_tegra_gem_get_flags)
  176. #if defined(__cplusplus)
  177. }
  178. #endif
  179. #endif