nouveau_drm.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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 DRM_NOUVEAU_EVENT_NVIF 0x80000000
  27. /* reserved object handles when using deprecated object APIs - these
  28. * are here so that libdrm can allow interoperability with the new
  29. * object APIs
  30. */
  31. #define NOUVEAU_ABI16_CLIENT 0xffffffff
  32. #define NOUVEAU_ABI16_DEVICE 0xdddddddd
  33. #define NOUVEAU_ABI16_CHAN(n) (0xcccc0000 | (n))
  34. #define NOUVEAU_GEM_DOMAIN_CPU (1 << 0)
  35. #define NOUVEAU_GEM_DOMAIN_VRAM (1 << 1)
  36. #define NOUVEAU_GEM_DOMAIN_GART (1 << 2)
  37. #define NOUVEAU_GEM_DOMAIN_MAPPABLE (1 << 3)
  38. #define NOUVEAU_GEM_DOMAIN_COHERENT (1 << 4)
  39. #define NOUVEAU_GEM_TILE_COMP 0x00030000 /* nv50-only */
  40. #define NOUVEAU_GEM_TILE_LAYOUT_MASK 0x0000ff00
  41. #define NOUVEAU_GEM_TILE_16BPP 0x00000001
  42. #define NOUVEAU_GEM_TILE_32BPP 0x00000002
  43. #define NOUVEAU_GEM_TILE_ZETA 0x00000004
  44. #define NOUVEAU_GEM_TILE_NONCONTIG 0x00000008
  45. struct drm_nouveau_gem_info {
  46. uint32_t handle;
  47. uint32_t domain;
  48. uint64_t size;
  49. uint64_t offset;
  50. uint64_t map_handle;
  51. uint32_t tile_mode;
  52. uint32_t tile_flags;
  53. };
  54. struct drm_nouveau_gem_new {
  55. struct drm_nouveau_gem_info info;
  56. uint32_t channel_hint;
  57. uint32_t align;
  58. };
  59. #define NOUVEAU_GEM_MAX_BUFFERS 1024
  60. struct drm_nouveau_gem_pushbuf_bo_presumed {
  61. uint32_t valid;
  62. uint32_t domain;
  63. uint64_t offset;
  64. };
  65. struct drm_nouveau_gem_pushbuf_bo {
  66. uint64_t user_priv;
  67. uint32_t handle;
  68. uint32_t read_domains;
  69. uint32_t write_domains;
  70. uint32_t valid_domains;
  71. struct drm_nouveau_gem_pushbuf_bo_presumed presumed;
  72. };
  73. #define NOUVEAU_GEM_RELOC_LOW (1 << 0)
  74. #define NOUVEAU_GEM_RELOC_HIGH (1 << 1)
  75. #define NOUVEAU_GEM_RELOC_OR (1 << 2)
  76. #define NOUVEAU_GEM_MAX_RELOCS 1024
  77. struct drm_nouveau_gem_pushbuf_reloc {
  78. uint32_t reloc_bo_index;
  79. uint32_t reloc_bo_offset;
  80. uint32_t bo_index;
  81. uint32_t flags;
  82. uint32_t data;
  83. uint32_t vor;
  84. uint32_t tor;
  85. };
  86. #define NOUVEAU_GEM_MAX_PUSH 512
  87. struct drm_nouveau_gem_pushbuf_push {
  88. uint32_t bo_index;
  89. uint32_t pad;
  90. uint64_t offset;
  91. uint64_t length;
  92. };
  93. struct drm_nouveau_gem_pushbuf {
  94. uint32_t channel;
  95. uint32_t nr_buffers;
  96. uint64_t buffers;
  97. uint32_t nr_relocs;
  98. uint32_t nr_push;
  99. uint64_t relocs;
  100. uint64_t push;
  101. uint32_t suffix0;
  102. uint32_t suffix1;
  103. uint64_t vram_available;
  104. uint64_t gart_available;
  105. };
  106. #define NOUVEAU_GEM_CPU_PREP_NOWAIT 0x00000001
  107. #define NOUVEAU_GEM_CPU_PREP_WRITE 0x00000004
  108. struct drm_nouveau_gem_cpu_prep {
  109. uint32_t handle;
  110. uint32_t flags;
  111. };
  112. struct drm_nouveau_gem_cpu_fini {
  113. uint32_t handle;
  114. };
  115. #define DRM_NOUVEAU_GETPARAM 0x00 /* deprecated */
  116. #define DRM_NOUVEAU_SETPARAM 0x01 /* deprecated */
  117. #define DRM_NOUVEAU_CHANNEL_ALLOC 0x02 /* deprecated */
  118. #define DRM_NOUVEAU_CHANNEL_FREE 0x03 /* deprecated */
  119. #define DRM_NOUVEAU_GROBJ_ALLOC 0x04 /* deprecated */
  120. #define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC 0x05 /* deprecated */
  121. #define DRM_NOUVEAU_GPUOBJ_FREE 0x06 /* deprecated */
  122. #define DRM_NOUVEAU_NVIF 0x07
  123. #define DRM_NOUVEAU_GEM_NEW 0x40
  124. #define DRM_NOUVEAU_GEM_PUSHBUF 0x41
  125. #define DRM_NOUVEAU_GEM_CPU_PREP 0x42
  126. #define DRM_NOUVEAU_GEM_CPU_FINI 0x43
  127. #define DRM_NOUVEAU_GEM_INFO 0x44
  128. #define DRM_IOCTL_NOUVEAU_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_NEW, struct drm_nouveau_gem_new)
  129. #define DRM_IOCTL_NOUVEAU_GEM_PUSHBUF DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_PUSHBUF, struct drm_nouveau_gem_pushbuf)
  130. #define DRM_IOCTL_NOUVEAU_GEM_CPU_PREP DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_CPU_PREP, struct drm_nouveau_gem_cpu_prep)
  131. #define DRM_IOCTL_NOUVEAU_GEM_CPU_FINI DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_CPU_FINI, struct drm_nouveau_gem_cpu_fini)
  132. #define DRM_IOCTL_NOUVEAU_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_INFO, struct drm_nouveau_gem_info)
  133. #endif /* __NOUVEAU_DRM_H__ */