nouveau_drm.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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 15
  27. struct drm_nouveau_channel_alloc {
  28. uint32_t fb_ctxdma_handle;
  29. uint32_t tt_ctxdma_handle;
  30. int channel;
  31. /* Notifier memory */
  32. uint32_t notifier_handle;
  33. /* DRM-enforced subchannel assignments */
  34. struct {
  35. uint32_t handle;
  36. uint32_t grclass;
  37. } subchan[8];
  38. uint32_t nr_subchan;
  39. };
  40. struct drm_nouveau_channel_free {
  41. int channel;
  42. };
  43. struct drm_nouveau_grobj_alloc {
  44. int channel;
  45. uint32_t handle;
  46. int class;
  47. };
  48. struct drm_nouveau_notifierobj_alloc {
  49. uint32_t channel;
  50. uint32_t handle;
  51. uint32_t size;
  52. uint32_t offset;
  53. };
  54. struct drm_nouveau_gpuobj_free {
  55. int channel;
  56. uint32_t handle;
  57. };
  58. /* FIXME : maybe unify {GET,SET}PARAMs */
  59. #define NOUVEAU_GETPARAM_PCI_VENDOR 3
  60. #define NOUVEAU_GETPARAM_PCI_DEVICE 4
  61. #define NOUVEAU_GETPARAM_BUS_TYPE 5
  62. #define NOUVEAU_GETPARAM_FB_PHYSICAL 6
  63. #define NOUVEAU_GETPARAM_AGP_PHYSICAL 7
  64. #define NOUVEAU_GETPARAM_FB_SIZE 8
  65. #define NOUVEAU_GETPARAM_AGP_SIZE 9
  66. #define NOUVEAU_GETPARAM_PCI_PHYSICAL 10
  67. #define NOUVEAU_GETPARAM_CHIPSET_ID 11
  68. #define NOUVEAU_GETPARAM_VM_VRAM_BASE 12
  69. struct drm_nouveau_getparam {
  70. uint64_t param;
  71. uint64_t value;
  72. };
  73. struct drm_nouveau_setparam {
  74. uint64_t param;
  75. uint64_t value;
  76. };
  77. #define NOUVEAU_GEM_DOMAIN_CPU (1 << 0)
  78. #define NOUVEAU_GEM_DOMAIN_VRAM (1 << 1)
  79. #define NOUVEAU_GEM_DOMAIN_GART (1 << 2)
  80. #define NOUVEAU_GEM_DOMAIN_MAPPABLE (1 << 3)
  81. struct drm_nouveau_gem_info {
  82. uint32_t handle;
  83. uint32_t domain;
  84. uint64_t size;
  85. uint64_t offset;
  86. uint64_t map_handle;
  87. uint32_t tile_mode;
  88. uint32_t tile_flags;
  89. };
  90. struct drm_nouveau_gem_new {
  91. struct drm_nouveau_gem_info info;
  92. uint32_t channel_hint;
  93. uint32_t align;
  94. };
  95. struct drm_nouveau_gem_pushbuf_bo {
  96. uint64_t user_priv;
  97. uint32_t handle;
  98. uint32_t read_domains;
  99. uint32_t write_domains;
  100. uint32_t valid_domains;
  101. uint32_t presumed_ok;
  102. uint32_t presumed_domain;
  103. uint64_t presumed_offset;
  104. };
  105. #define NOUVEAU_GEM_RELOC_LOW (1 << 0)
  106. #define NOUVEAU_GEM_RELOC_HIGH (1 << 1)
  107. #define NOUVEAU_GEM_RELOC_OR (1 << 2)
  108. struct drm_nouveau_gem_pushbuf_reloc {
  109. uint32_t bo_index;
  110. uint32_t reloc_index;
  111. uint32_t flags;
  112. uint32_t data;
  113. uint32_t vor;
  114. uint32_t tor;
  115. };
  116. #define NOUVEAU_GEM_MAX_BUFFERS 1024
  117. #define NOUVEAU_GEM_MAX_RELOCS 1024
  118. struct drm_nouveau_gem_pushbuf {
  119. uint32_t channel;
  120. uint32_t nr_dwords;
  121. uint32_t nr_buffers;
  122. uint32_t nr_relocs;
  123. uint64_t dwords;
  124. uint64_t buffers;
  125. uint64_t relocs;
  126. };
  127. struct drm_nouveau_gem_pushbuf_call {
  128. uint32_t channel;
  129. uint32_t handle;
  130. uint32_t offset;
  131. uint32_t nr_buffers;
  132. uint32_t nr_relocs;
  133. uint32_t nr_dwords;
  134. uint64_t buffers;
  135. uint64_t relocs;
  136. uint32_t suffix0;
  137. uint32_t suffix1;
  138. /* below only accessed for CALL2 */
  139. uint64_t vram_available;
  140. uint64_t gart_available;
  141. };
  142. struct drm_nouveau_gem_pin {
  143. uint32_t handle;
  144. uint32_t domain;
  145. uint64_t offset;
  146. };
  147. struct drm_nouveau_gem_unpin {
  148. uint32_t handle;
  149. };
  150. #define NOUVEAU_GEM_CPU_PREP_NOWAIT 0x00000001
  151. #define NOUVEAU_GEM_CPU_PREP_NOBLOCK 0x00000002
  152. #define NOUVEAU_GEM_CPU_PREP_WRITE 0x00000004
  153. struct drm_nouveau_gem_cpu_prep {
  154. uint32_t handle;
  155. uint32_t flags;
  156. };
  157. struct drm_nouveau_gem_cpu_fini {
  158. uint32_t handle;
  159. };
  160. struct drm_nouveau_gem_tile {
  161. uint32_t handle;
  162. uint32_t offset;
  163. uint32_t size;
  164. uint32_t tile_mode;
  165. uint32_t tile_flags;
  166. };
  167. enum nouveau_bus_type {
  168. NV_AGP = 0,
  169. NV_PCI = 1,
  170. NV_PCIE = 2,
  171. };
  172. struct drm_nouveau_sarea {
  173. };
  174. #define DRM_NOUVEAU_CARD_INIT 0x00
  175. #define DRM_NOUVEAU_GETPARAM 0x01
  176. #define DRM_NOUVEAU_SETPARAM 0x02
  177. #define DRM_NOUVEAU_CHANNEL_ALLOC 0x03
  178. #define DRM_NOUVEAU_CHANNEL_FREE 0x04
  179. #define DRM_NOUVEAU_GROBJ_ALLOC 0x05
  180. #define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC 0x06
  181. #define DRM_NOUVEAU_GPUOBJ_FREE 0x07
  182. #define DRM_NOUVEAU_GEM_NEW 0x40
  183. #define DRM_NOUVEAU_GEM_PUSHBUF 0x41
  184. #define DRM_NOUVEAU_GEM_PUSHBUF_CALL 0x42
  185. #define DRM_NOUVEAU_GEM_PIN 0x43 /* !KMS only */
  186. #define DRM_NOUVEAU_GEM_UNPIN 0x44 /* !KMS only */
  187. #define DRM_NOUVEAU_GEM_CPU_PREP 0x45
  188. #define DRM_NOUVEAU_GEM_CPU_FINI 0x46
  189. #define DRM_NOUVEAU_GEM_INFO 0x47
  190. #define DRM_NOUVEAU_GEM_PUSHBUF_CALL2 0x48
  191. #endif /* __NOUVEAU_DRM_H__ */