nouveau_drm.h 4.8 KB

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