nouveau_drm.h 4.7 KB

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