drm_mode.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. /*
  2. * Copyright (c) 2007 Dave Airlie <airlied@linux.ie>
  3. * Copyright (c) 2007 Jakob Bornecrantz <wallbraker@gmail.com>
  4. * Copyright (c) 2008 Red Hat Inc.
  5. * Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA
  6. * Copyright (c) 2007-2008 Intel Corporation
  7. *
  8. * Permission is hereby granted, free of charge, to any person obtaining a
  9. * copy of this software and associated documentation files (the "Software"),
  10. * to deal in the Software without restriction, including without limitation
  11. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  12. * and/or sell copies of the Software, and to permit persons to whom the
  13. * Software is furnished to do so, subject to the following conditions:
  14. *
  15. * The above copyright notice and this permission notice shall be included in
  16. * all copies or substantial portions of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  23. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  24. * IN THE SOFTWARE.
  25. */
  26. #ifndef _DRM_MODE_H
  27. #define _DRM_MODE_H
  28. #include <linux/kernel.h>
  29. #include <linux/types.h>
  30. #define DRM_DISPLAY_INFO_LEN 32
  31. #define DRM_CONNECTOR_NAME_LEN 32
  32. #define DRM_DISPLAY_MODE_LEN 32
  33. #define DRM_PROP_NAME_LEN 32
  34. #define DRM_MODE_TYPE_BUILTIN (1<<0)
  35. #define DRM_MODE_TYPE_CLOCK_C ((1<<1) | DRM_MODE_TYPE_BUILTIN)
  36. #define DRM_MODE_TYPE_CRTC_C ((1<<2) | DRM_MODE_TYPE_BUILTIN)
  37. #define DRM_MODE_TYPE_PREFERRED (1<<3)
  38. #define DRM_MODE_TYPE_DEFAULT (1<<4)
  39. #define DRM_MODE_TYPE_USERDEF (1<<5)
  40. #define DRM_MODE_TYPE_DRIVER (1<<6)
  41. /* Video mode flags */
  42. /* bit compatible with the xorg definitions. */
  43. #define DRM_MODE_FLAG_PHSYNC (1<<0)
  44. #define DRM_MODE_FLAG_NHSYNC (1<<1)
  45. #define DRM_MODE_FLAG_PVSYNC (1<<2)
  46. #define DRM_MODE_FLAG_NVSYNC (1<<3)
  47. #define DRM_MODE_FLAG_INTERLACE (1<<4)
  48. #define DRM_MODE_FLAG_DBLSCAN (1<<5)
  49. #define DRM_MODE_FLAG_CSYNC (1<<6)
  50. #define DRM_MODE_FLAG_PCSYNC (1<<7)
  51. #define DRM_MODE_FLAG_NCSYNC (1<<8)
  52. #define DRM_MODE_FLAG_HSKEW (1<<9) /* hskew provided */
  53. #define DRM_MODE_FLAG_BCAST (1<<10)
  54. #define DRM_MODE_FLAG_PIXMUX (1<<11)
  55. #define DRM_MODE_FLAG_DBLCLK (1<<12)
  56. #define DRM_MODE_FLAG_CLKDIV2 (1<<13)
  57. /* DPMS flags */
  58. /* bit compatible with the xorg definitions. */
  59. #define DRM_MODE_DPMS_ON 0
  60. #define DRM_MODE_DPMS_STANDBY 1
  61. #define DRM_MODE_DPMS_SUSPEND 2
  62. #define DRM_MODE_DPMS_OFF 3
  63. /* Scaling mode options */
  64. #define DRM_MODE_SCALE_NON_GPU 0
  65. #define DRM_MODE_SCALE_FULLSCREEN 1
  66. #define DRM_MODE_SCALE_NO_SCALE 2
  67. #define DRM_MODE_SCALE_ASPECT 3
  68. /* Dithering mode options */
  69. #define DRM_MODE_DITHERING_OFF 0
  70. #define DRM_MODE_DITHERING_ON 1
  71. struct drm_mode_modeinfo {
  72. __u32 clock;
  73. __u16 hdisplay, hsync_start, hsync_end, htotal, hskew;
  74. __u16 vdisplay, vsync_start, vsync_end, vtotal, vscan;
  75. __u32 vrefresh; /* vertical refresh * 1000 */
  76. __u32 flags;
  77. __u32 type;
  78. char name[DRM_DISPLAY_MODE_LEN];
  79. };
  80. struct drm_mode_card_res {
  81. __u64 fb_id_ptr;
  82. __u64 crtc_id_ptr;
  83. __u64 connector_id_ptr;
  84. __u64 encoder_id_ptr;
  85. __u32 count_fbs;
  86. __u32 count_crtcs;
  87. __u32 count_connectors;
  88. __u32 count_encoders;
  89. __u32 min_width, max_width;
  90. __u32 min_height, max_height;
  91. };
  92. struct drm_mode_crtc {
  93. __u64 set_connectors_ptr;
  94. __u32 count_connectors;
  95. __u32 crtc_id; /**< Id */
  96. __u32 fb_id; /**< Id of framebuffer */
  97. __u32 x, y; /**< Position on the frameuffer */
  98. __u32 gamma_size;
  99. __u32 mode_valid;
  100. struct drm_mode_modeinfo mode;
  101. };
  102. #define DRM_MODE_ENCODER_NONE 0
  103. #define DRM_MODE_ENCODER_DAC 1
  104. #define DRM_MODE_ENCODER_TMDS 2
  105. #define DRM_MODE_ENCODER_LVDS 3
  106. #define DRM_MODE_ENCODER_TVDAC 4
  107. struct drm_mode_get_encoder {
  108. __u32 encoder_id;
  109. __u32 encoder_type;
  110. __u32 crtc_id; /**< Id of crtc */
  111. __u32 possible_crtcs;
  112. __u32 possible_clones;
  113. };
  114. /* This is for connectors with multiple signal types. */
  115. /* Try to match DRM_MODE_CONNECTOR_X as closely as possible. */
  116. #define DRM_MODE_SUBCONNECTOR_Automatic 0
  117. #define DRM_MODE_SUBCONNECTOR_Unknown 0
  118. #define DRM_MODE_SUBCONNECTOR_DVID 3
  119. #define DRM_MODE_SUBCONNECTOR_DVIA 4
  120. #define DRM_MODE_SUBCONNECTOR_Composite 5
  121. #define DRM_MODE_SUBCONNECTOR_SVIDEO 6
  122. #define DRM_MODE_SUBCONNECTOR_Component 8
  123. #define DRM_MODE_CONNECTOR_Unknown 0
  124. #define DRM_MODE_CONNECTOR_VGA 1
  125. #define DRM_MODE_CONNECTOR_DVII 2
  126. #define DRM_MODE_CONNECTOR_DVID 3
  127. #define DRM_MODE_CONNECTOR_DVIA 4
  128. #define DRM_MODE_CONNECTOR_Composite 5
  129. #define DRM_MODE_CONNECTOR_SVIDEO 6
  130. #define DRM_MODE_CONNECTOR_LVDS 7
  131. #define DRM_MODE_CONNECTOR_Component 8
  132. #define DRM_MODE_CONNECTOR_9PinDIN 9
  133. #define DRM_MODE_CONNECTOR_DisplayPort 10
  134. #define DRM_MODE_CONNECTOR_HDMIA 11
  135. #define DRM_MODE_CONNECTOR_HDMIB 12
  136. struct drm_mode_get_connector {
  137. __u64 encoders_ptr;
  138. __u64 modes_ptr;
  139. __u64 props_ptr;
  140. __u64 prop_values_ptr;
  141. __u32 count_modes;
  142. __u32 count_props;
  143. __u32 count_encoders;
  144. __u32 encoder_id; /**< Current Encoder */
  145. __u32 connector_id; /**< Id */
  146. __u32 connector_type;
  147. __u32 connector_type_id;
  148. __u32 connection;
  149. __u32 mm_width, mm_height; /**< HxW in millimeters */
  150. __u32 subpixel;
  151. };
  152. #define DRM_MODE_PROP_PENDING (1<<0)
  153. #define DRM_MODE_PROP_RANGE (1<<1)
  154. #define DRM_MODE_PROP_IMMUTABLE (1<<2)
  155. #define DRM_MODE_PROP_ENUM (1<<3) /* enumerated type with text strings */
  156. #define DRM_MODE_PROP_BLOB (1<<4)
  157. struct drm_mode_property_enum {
  158. __u64 value;
  159. char name[DRM_PROP_NAME_LEN];
  160. };
  161. struct drm_mode_get_property {
  162. __u64 values_ptr; /* values and blob lengths */
  163. __u64 enum_blob_ptr; /* enum and blob id ptrs */
  164. __u32 prop_id;
  165. __u32 flags;
  166. char name[DRM_PROP_NAME_LEN];
  167. __u32 count_values;
  168. __u32 count_enum_blobs;
  169. };
  170. struct drm_mode_connector_set_property {
  171. __u64 value;
  172. __u32 prop_id;
  173. __u32 connector_id;
  174. };
  175. struct drm_mode_get_blob {
  176. __u32 blob_id;
  177. __u32 length;
  178. __u64 data;
  179. };
  180. struct drm_mode_fb_cmd {
  181. __u32 fb_id;
  182. __u32 width, height;
  183. __u32 pitch;
  184. __u32 bpp;
  185. __u32 depth;
  186. /* driver specific handle */
  187. __u32 handle;
  188. };
  189. struct drm_mode_mode_cmd {
  190. __u32 connector_id;
  191. struct drm_mode_modeinfo mode;
  192. };
  193. #define DRM_MODE_CURSOR_BO (1<<0)
  194. #define DRM_MODE_CURSOR_MOVE (1<<1)
  195. /*
  196. * depending on the value in flags diffrent members are used.
  197. *
  198. * CURSOR_BO uses
  199. * crtc
  200. * width
  201. * height
  202. * handle - if 0 turns the cursor of
  203. *
  204. * CURSOR_MOVE uses
  205. * crtc
  206. * x
  207. * y
  208. */
  209. struct drm_mode_cursor {
  210. __u32 flags;
  211. __u32 crtc_id;
  212. __s32 x;
  213. __s32 y;
  214. __u32 width;
  215. __u32 height;
  216. /* driver specific handle */
  217. __u32 handle;
  218. };
  219. struct drm_mode_crtc_lut {
  220. __u32 crtc_id;
  221. __u32 gamma_size;
  222. /* pointers to arrays */
  223. __u64 red;
  224. __u64 green;
  225. __u64 blue;
  226. };
  227. #endif