qxl_drm.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /*
  2. * Copyright 2013 Red Hat
  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. * THE AUTHORS 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 QXL_DRM_H
  25. #define QXL_DRM_H
  26. #include "drm.h"
  27. #if defined(__cplusplus)
  28. extern "C" {
  29. #endif
  30. /* Please note that modifications to all structs defined here are
  31. * subject to backwards-compatibility constraints.
  32. *
  33. * Do not use pointers, use __u64 instead for 32 bit / 64 bit user/kernel
  34. * compatibility Keep fields aligned to their size
  35. */
  36. #define QXL_GEM_DOMAIN_CPU 0
  37. #define QXL_GEM_DOMAIN_VRAM 1
  38. #define QXL_GEM_DOMAIN_SURFACE 2
  39. #define DRM_QXL_ALLOC 0x00
  40. #define DRM_QXL_MAP 0x01
  41. #define DRM_QXL_EXECBUFFER 0x02
  42. #define DRM_QXL_UPDATE_AREA 0x03
  43. #define DRM_QXL_GETPARAM 0x04
  44. #define DRM_QXL_CLIENTCAP 0x05
  45. #define DRM_QXL_ALLOC_SURF 0x06
  46. struct drm_qxl_alloc {
  47. __u32 size;
  48. __u32 handle; /* 0 is an invalid handle */
  49. };
  50. struct drm_qxl_map {
  51. __u64 offset; /* use for mmap system call */
  52. __u32 handle;
  53. __u32 pad;
  54. };
  55. /*
  56. * dest is the bo we are writing the relocation into
  57. * src is bo we are relocating.
  58. * *(dest_handle.base_addr + dest_offset) = physical_address(src_handle.addr +
  59. * src_offset)
  60. */
  61. #define QXL_RELOC_TYPE_BO 1
  62. #define QXL_RELOC_TYPE_SURF 2
  63. struct drm_qxl_reloc {
  64. __u64 src_offset; /* offset into src_handle or src buffer */
  65. __u64 dst_offset; /* offset in dest handle */
  66. __u32 src_handle; /* dest handle to compute address from */
  67. __u32 dst_handle; /* 0 if to command buffer */
  68. __u32 reloc_type;
  69. __u32 pad;
  70. };
  71. struct drm_qxl_command {
  72. __u64 command; /* void* */
  73. __u64 relocs; /* struct drm_qxl_reloc* */
  74. __u32 type;
  75. __u32 command_size;
  76. __u32 relocs_num;
  77. __u32 pad;
  78. };
  79. struct drm_qxl_execbuffer {
  80. __u32 flags; /* for future use */
  81. __u32 commands_num;
  82. __u64 commands; /* struct drm_qxl_command* */
  83. };
  84. struct drm_qxl_update_area {
  85. __u32 handle;
  86. __u32 top;
  87. __u32 left;
  88. __u32 bottom;
  89. __u32 right;
  90. __u32 pad;
  91. };
  92. #define QXL_PARAM_NUM_SURFACES 1 /* rom->n_surfaces */
  93. #define QXL_PARAM_MAX_RELOCS 2
  94. struct drm_qxl_getparam {
  95. __u64 param;
  96. __u64 value;
  97. };
  98. /* these are one bit values */
  99. struct drm_qxl_clientcap {
  100. __u32 index;
  101. __u32 pad;
  102. };
  103. struct drm_qxl_alloc_surf {
  104. __u32 format;
  105. __u32 width;
  106. __u32 height;
  107. __s32 stride;
  108. __u32 handle;
  109. __u32 pad;
  110. };
  111. #define DRM_IOCTL_QXL_ALLOC \
  112. DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_ALLOC, struct drm_qxl_alloc)
  113. #define DRM_IOCTL_QXL_MAP \
  114. DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_MAP, struct drm_qxl_map)
  115. #define DRM_IOCTL_QXL_EXECBUFFER \
  116. DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_EXECBUFFER,\
  117. struct drm_qxl_execbuffer)
  118. #define DRM_IOCTL_QXL_UPDATE_AREA \
  119. DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_UPDATE_AREA,\
  120. struct drm_qxl_update_area)
  121. #define DRM_IOCTL_QXL_GETPARAM \
  122. DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_GETPARAM,\
  123. struct drm_qxl_getparam)
  124. #define DRM_IOCTL_QXL_CLIENTCAP \
  125. DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_CLIENTCAP,\
  126. struct drm_qxl_clientcap)
  127. #define DRM_IOCTL_QXL_ALLOC_SURF \
  128. DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_ALLOC_SURF,\
  129. struct drm_qxl_alloc_surf)
  130. #if defined(__cplusplus)
  131. }
  132. #endif
  133. #endif