nouveau_drm.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. /*
  2. * Copyright 2005 Stephane Marchesin.
  3. * All Rights Reserved.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining a
  6. * copy of this software and associated documentation files (the "Software"),
  7. * to deal in the Software without restriction, including without limitation
  8. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  9. * and/or sell copies of the Software, and to permit persons to whom the
  10. * Software is furnished to do so, subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice (including the next
  13. * paragraph) shall be included in all copies or substantial portions of the
  14. * Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  19. * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  20. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  21. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  22. * OTHER DEALINGS IN THE SOFTWARE.
  23. */
  24. #ifndef __NOUVEAU_DRM_H__
  25. #define __NOUVEAU_DRM_H__
  26. #define NOUVEAU_DRM_HEADER_PATCHLEVEL 16
  27. struct drm_nouveau_channel_alloc {
  28. uint32_t fb_ctxdma_handle;
  29. uint32_t tt_ctxdma_handle;
  30. int channel;
  31. uint32_t pushbuf_domains;
  32. /* Notifier memory */
  33. uint32_t notifier_handle;
  34. /* DRM-enforced subchannel assignments */
  35. struct {
  36. uint32_t handle;
  37. uint32_t grclass;
  38. } subchan[8];
  39. uint32_t nr_subchan;
  40. };
  41. struct drm_nouveau_channel_free {
  42. int channel;
  43. };
  44. struct drm_nouveau_grobj_alloc {
  45. int channel;
  46. uint32_t handle;
  47. int class;
  48. };
  49. struct drm_nouveau_notifierobj_alloc {
  50. uint32_t channel;
  51. uint32_t handle;
  52. uint32_t size;
  53. uint32_t offset;
  54. };
  55. struct drm_nouveau_gpuobj_free {
  56. int channel;
  57. uint32_t handle;
  58. };
  59. /* FIXME : maybe unify {GET,SET}PARAMs */
  60. #define NOUVEAU_GETPARAM_PCI_VENDOR 3
  61. #define NOUVEAU_GETPARAM_PCI_DEVICE 4
  62. #define NOUVEAU_GETPARAM_BUS_TYPE 5
  63. #define NOUVEAU_GETPARAM_FB_SIZE 8
  64. #define NOUVEAU_GETPARAM_AGP_SIZE 9
  65. #define NOUVEAU_GETPARAM_CHIPSET_ID 11
  66. #define NOUVEAU_GETPARAM_VM_VRAM_BASE 12
  67. #define NOUVEAU_GETPARAM_GRAPH_UNITS 13
  68. #define NOUVEAU_GETPARAM_PTIMER_TIME 14
  69. #define NOUVEAU_GETPARAM_HAS_BO_USAGE 15
  70. #define NOUVEAU_GETPARAM_HAS_PAGEFLIP 16
  71. struct drm_nouveau_getparam {
  72. uint64_t param;
  73. uint64_t value;
  74. };
  75. struct drm_nouveau_setparam {
  76. uint64_t param;
  77. uint64_t value;
  78. };
  79. #define NOUVEAU_GEM_DOMAIN_CPU (1 << 0)
  80. #define NOUVEAU_GEM_DOMAIN_VRAM (1 << 1)
  81. #define NOUVEAU_GEM_DOMAIN_GART (1 << 2)
  82. #define NOUVEAU_GEM_DOMAIN_MAPPABLE (1 << 3)
  83. #define NOUVEAU_GEM_TILE_COMP 0x00030000 /* nv50-only */
  84. #define NOUVEAU_GEM_TILE_LAYOUT_MASK 0x0000ff00
  85. #define NOUVEAU_GEM_TILE_16BPP 0x00000001
  86. #define NOUVEAU_GEM_TILE_32BPP 0x00000002
  87. #define NOUVEAU_GEM_TILE_ZETA 0x00000004
  88. #define NOUVEAU_GEM_TILE_NONCONTIG 0x00000008
  89. struct drm_nouveau_gem_info {
  90. uint32_t handle;
  91. uint32_t domain;
  92. uint64_t size;
  93. uint64_t offset;
  94. uint64_t map_handle;
  95. uint32_t tile_mode;
  96. uint32_t tile_flags;
  97. };
  98. struct drm_nouveau_gem_new {
  99. struct drm_nouveau_gem_info info;
  100. uint32_t channel_hint;
  101. uint32_t align;
  102. };
  103. #define NOUVEAU_GEM_MAX_BUFFERS 1024
  104. struct drm_nouveau_gem_pushbuf_bo_presumed {
  105. uint32_t valid;
  106. uint32_t domain;
  107. uint64_t offset;
  108. };
  109. struct drm_nouveau_gem_pushbuf_bo {
  110. uint64_t user_priv;
  111. uint32_t handle;
  112. uint32_t read_domains;
  113. uint32_t write_domains;
  114. uint32_t valid_domains;
  115. struct drm_nouveau_gem_pushbuf_bo_presumed presumed;
  116. };
  117. #define NOUVEAU_GEM_RELOC_LOW (1 << 0)
  118. #define NOUVEAU_GEM_RELOC_HIGH (1 << 1)
  119. #define NOUVEAU_GEM_RELOC_OR (1 << 2)
  120. #define NOUVEAU_GEM_MAX_RELOCS 1024
  121. struct drm_nouveau_gem_pushbuf_reloc {
  122. uint32_t reloc_bo_index;
  123. uint32_t reloc_bo_offset;
  124. uint32_t bo_index;
  125. uint32_t flags;
  126. uint32_t data;
  127. uint32_t vor;
  128. uint32_t tor;
  129. };
  130. #define NOUVEAU_GEM_MAX_PUSH 512
  131. struct drm_nouveau_gem_pushbuf_push {
  132. uint32_t bo_index;
  133. uint32_t pad;
  134. uint64_t offset;
  135. uint64_t length;
  136. };
  137. struct drm_nouveau_gem_pushbuf {
  138. uint32_t channel;
  139. uint32_t nr_buffers;
  140. uint64_t buffers;
  141. uint32_t nr_relocs;
  142. uint32_t nr_push;
  143. uint64_t relocs;
  144. uint64_t push;
  145. uint32_t suffix0;
  146. uint32_t suffix1;
  147. uint64_t vram_available;
  148. uint64_t gart_available;
  149. };
  150. #define NOUVEAU_GEM_CPU_PREP_NOWAIT 0x00000001
  151. #define NOUVEAU_GEM_CPU_PREP_WRITE 0x00000004
  152. struct drm_nouveau_gem_cpu_prep {
  153. uint32_t handle;
  154. uint32_t flags;
  155. };
  156. struct drm_nouveau_gem_cpu_fini {
  157. uint32_t handle;
  158. };
  159. enum nouveau_bus_type {
  160. NV_AGP = 0,
  161. NV_PCI = 1,
  162. NV_PCIE = 2,
  163. };
  164. struct drm_nouveau_sarea {
  165. };
  166. #define DRM_NOUVEAU_GETPARAM 0x00
  167. #define DRM_NOUVEAU_SETPARAM 0x01
  168. #define DRM_NOUVEAU_CHANNEL_ALLOC 0x02
  169. #define DRM_NOUVEAU_CHANNEL_FREE 0x03
  170. #define DRM_NOUVEAU_GROBJ_ALLOC 0x04
  171. #define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC 0x05
  172. #define DRM_NOUVEAU_GPUOBJ_FREE 0x06
  173. #define DRM_NOUVEAU_GEM_NEW 0x40
  174. #define DRM_NOUVEAU_GEM_PUSHBUF 0x41
  175. #define DRM_NOUVEAU_GEM_CPU_PREP 0x42
  176. #define DRM_NOUVEAU_GEM_CPU_FINI 0x43
  177. #define DRM_NOUVEAU_GEM_INFO 0x44
  178. #define DRM_IOCTL_NOUVEAU_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GETPARAM, struct drm_nouveau_getparam)
  179. #define DRM_IOCTL_NOUVEAU_SETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_SETPARAM, struct drm_nouveau_setparam)
  180. #define DRM_IOCTL_NOUVEAU_CHANNEL_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_CHANNEL_ALLOC, struct drm_nouveau_channel_alloc)
  181. #define DRM_IOCTL_NOUVEAU_CHANNEL_FREE DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_CHANNEL_FREE, struct drm_nouveau_channel_free)
  182. #define DRM_IOCTL_NOUVEAU_GROBJ_ALLOC DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GROBJ_ALLOC, struct drm_nouveau_grobj_alloc)
  183. #define DRM_IOCTL_NOUVEAU_NOTIFIEROBJ_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_NOTIFIEROBJ_ALLOC, struct drm_nouveau_notifierobj_alloc)
  184. #define DRM_IOCTL_NOUVEAU_GPUOBJ_FREE DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GPUOBJ_FREE, struct drm_nouveau_gpuobj_free)
  185. #define DRM_IOCTL_NOUVEAU_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_NEW, struct drm_nouveau_gem_new)
  186. #define DRM_IOCTL_NOUVEAU_GEM_PUSHBUF DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_PUSHBUF, struct drm_nouveau_gem_pushbuf)
  187. #define DRM_IOCTL_NOUVEAU_GEM_CPU_PREP DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_CPU_PREP, struct drm_nouveau_gem_cpu_prep)
  188. #define DRM_IOCTL_NOUVEAU_GEM_CPU_FINI DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_CPU_FINI, struct drm_nouveau_gem_cpu_fini)
  189. #define DRM_IOCTL_NOUVEAU_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_INFO, struct drm_nouveau_gem_info)
  190. #endif /* __NOUVEAU_DRM_H__ */