xf86drmMode.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  1. /*
  2. * \file xf86drmMode.h
  3. * Header for DRM modesetting interface.
  4. *
  5. * \author Jakob Bornecrantz <wallbraker@gmail.com>
  6. *
  7. * \par Acknowledgements:
  8. * Feb 2007, Dave Airlie <airlied@linux.ie>
  9. */
  10. /*
  11. * Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, Texas.
  12. * Copyright (c) 2007-2008 Dave Airlie <airlied@linux.ie>
  13. * Copyright (c) 2007-2008 Jakob Bornecrantz <wallbraker@gmail.com>
  14. *
  15. * Permission is hereby granted, free of charge, to any person obtaining a
  16. * copy of this software and associated documentation files (the "Software"),
  17. * to deal in the Software without restriction, including without limitation
  18. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  19. * and/or sell copies of the Software, and to permit persons to whom the
  20. * Software is furnished to do so, subject to the following conditions:
  21. *
  22. * The above copyright notice and this permission notice shall be included in
  23. * all copies or substantial portions of the Software.
  24. *
  25. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  26. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  27. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  28. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  29. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  30. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  31. * IN THE SOFTWARE.
  32. *
  33. */
  34. #ifndef _XF86DRMMODE_H_
  35. #define _XF86DRMMODE_H_
  36. #if defined(__cplusplus)
  37. extern "C" {
  38. #endif
  39. #include <drm.h>
  40. #include <stddef.h>
  41. #include <stdint.h>
  42. /*
  43. * This is the interface for modesetting for drm.
  44. *
  45. * In order to use this interface you must include either <stdint.h> or another
  46. * header defining uint32_t, int32_t and uint16_t.
  47. *
  48. * It aims to provide a randr1.2 compatible interface for modesettings in the
  49. * kernel, the interface is also meant to be used by libraries like EGL.
  50. *
  51. * More information can be found in randrproto.txt which can be found here:
  52. * http://gitweb.freedesktop.org/?p=xorg/proto/randrproto.git
  53. *
  54. * There are some major differences to be noted. Unlike the randr1.2 proto you
  55. * need to create the memory object of the framebuffer yourself with the ttm
  56. * buffer object interface. This object needs to be pinned.
  57. */
  58. /*
  59. * If we pickup an old version of drm.h which doesn't include drm_mode.h
  60. * we should redefine defines. This is so that builds doesn't breaks with
  61. * new libdrm on old kernels.
  62. */
  63. #ifndef _DRM_MODE_H
  64. #define DRM_DISPLAY_INFO_LEN 32
  65. #define DRM_CONNECTOR_NAME_LEN 32
  66. #define DRM_DISPLAY_MODE_LEN 32
  67. #define DRM_PROP_NAME_LEN 32
  68. #define DRM_MODE_TYPE_BUILTIN (1<<0)
  69. #define DRM_MODE_TYPE_CLOCK_C ((1<<1) | DRM_MODE_TYPE_BUILTIN)
  70. #define DRM_MODE_TYPE_CRTC_C ((1<<2) | DRM_MODE_TYPE_BUILTIN)
  71. #define DRM_MODE_TYPE_PREFERRED (1<<3)
  72. #define DRM_MODE_TYPE_DEFAULT (1<<4)
  73. #define DRM_MODE_TYPE_USERDEF (1<<5)
  74. #define DRM_MODE_TYPE_DRIVER (1<<6)
  75. /* Video mode flags */
  76. /* bit compatible with the xorg definitions. */
  77. #define DRM_MODE_FLAG_PHSYNC (1<<0)
  78. #define DRM_MODE_FLAG_NHSYNC (1<<1)
  79. #define DRM_MODE_FLAG_PVSYNC (1<<2)
  80. #define DRM_MODE_FLAG_NVSYNC (1<<3)
  81. #define DRM_MODE_FLAG_INTERLACE (1<<4)
  82. #define DRM_MODE_FLAG_DBLSCAN (1<<5)
  83. #define DRM_MODE_FLAG_CSYNC (1<<6)
  84. #define DRM_MODE_FLAG_PCSYNC (1<<7)
  85. #define DRM_MODE_FLAG_NCSYNC (1<<8)
  86. #define DRM_MODE_FLAG_HSKEW (1<<9) /* hskew provided */
  87. #define DRM_MODE_FLAG_BCAST (1<<10)
  88. #define DRM_MODE_FLAG_PIXMUX (1<<11)
  89. #define DRM_MODE_FLAG_DBLCLK (1<<12)
  90. #define DRM_MODE_FLAG_CLKDIV2 (1<<13)
  91. #define DRM_MODE_FLAG_3D_MASK (0x1f<<14)
  92. #define DRM_MODE_FLAG_3D_NONE (0<<14)
  93. #define DRM_MODE_FLAG_3D_FRAME_PACKING (1<<14)
  94. #define DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE (2<<14)
  95. #define DRM_MODE_FLAG_3D_LINE_ALTERNATIVE (3<<14)
  96. #define DRM_MODE_FLAG_3D_SIDE_BY_SIDE_FULL (4<<14)
  97. #define DRM_MODE_FLAG_3D_L_DEPTH (5<<14)
  98. #define DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH (6<<14)
  99. #define DRM_MODE_FLAG_3D_TOP_AND_BOTTOM (7<<14)
  100. #define DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF (8<<14)
  101. /* DPMS flags */
  102. /* bit compatible with the xorg definitions. */
  103. #define DRM_MODE_DPMS_ON 0
  104. #define DRM_MODE_DPMS_STANDBY 1
  105. #define DRM_MODE_DPMS_SUSPEND 2
  106. #define DRM_MODE_DPMS_OFF 3
  107. /* Scaling mode options */
  108. #define DRM_MODE_SCALE_NON_GPU 0
  109. #define DRM_MODE_SCALE_FULLSCREEN 1
  110. #define DRM_MODE_SCALE_NO_SCALE 2
  111. #define DRM_MODE_SCALE_ASPECT 3
  112. /* Dithering mode options */
  113. #define DRM_MODE_DITHERING_OFF 0
  114. #define DRM_MODE_DITHERING_ON 1
  115. #define DRM_MODE_ENCODER_NONE 0
  116. #define DRM_MODE_ENCODER_DAC 1
  117. #define DRM_MODE_ENCODER_TMDS 2
  118. #define DRM_MODE_ENCODER_LVDS 3
  119. #define DRM_MODE_ENCODER_TVDAC 4
  120. #define DRM_MODE_ENCODER_VIRTUAL 5
  121. #define DRM_MODE_ENCODER_DSI 6
  122. #define DRM_MODE_ENCODER_DPMST 7
  123. #define DRM_MODE_ENCODER_DPI 8
  124. #define DRM_MODE_SUBCONNECTOR_Automatic 0
  125. #define DRM_MODE_SUBCONNECTOR_Unknown 0
  126. #define DRM_MODE_SUBCONNECTOR_DVID 3
  127. #define DRM_MODE_SUBCONNECTOR_DVIA 4
  128. #define DRM_MODE_SUBCONNECTOR_Composite 5
  129. #define DRM_MODE_SUBCONNECTOR_SVIDEO 6
  130. #define DRM_MODE_SUBCONNECTOR_Component 8
  131. #define DRM_MODE_SUBCONNECTOR_SCART 9
  132. #define DRM_MODE_CONNECTOR_Unknown 0
  133. #define DRM_MODE_CONNECTOR_VGA 1
  134. #define DRM_MODE_CONNECTOR_DVII 2
  135. #define DRM_MODE_CONNECTOR_DVID 3
  136. #define DRM_MODE_CONNECTOR_DVIA 4
  137. #define DRM_MODE_CONNECTOR_Composite 5
  138. #define DRM_MODE_CONNECTOR_SVIDEO 6
  139. #define DRM_MODE_CONNECTOR_LVDS 7
  140. #define DRM_MODE_CONNECTOR_Component 8
  141. #define DRM_MODE_CONNECTOR_9PinDIN 9
  142. #define DRM_MODE_CONNECTOR_DisplayPort 10
  143. #define DRM_MODE_CONNECTOR_HDMIA 11
  144. #define DRM_MODE_CONNECTOR_HDMIB 12
  145. #define DRM_MODE_CONNECTOR_TV 13
  146. #define DRM_MODE_CONNECTOR_eDP 14
  147. #define DRM_MODE_CONNECTOR_VIRTUAL 15
  148. #define DRM_MODE_CONNECTOR_DSI 16
  149. #define DRM_MODE_CONNECTOR_DPI 17
  150. #define DRM_MODE_CONNECTOR_WRITEBACK 18
  151. #define DRM_MODE_PROP_PENDING (1<<0)
  152. #define DRM_MODE_PROP_RANGE (1<<1)
  153. #define DRM_MODE_PROP_IMMUTABLE (1<<2)
  154. #define DRM_MODE_PROP_ENUM (1<<3) /* enumerated type with text strings */
  155. #define DRM_MODE_PROP_BLOB (1<<4)
  156. #define DRM_MODE_CURSOR_BO (1<<0)
  157. #define DRM_MODE_CURSOR_MOVE (1<<1)
  158. #endif /* _DRM_MODE_H */
  159. /*
  160. * Feature defines
  161. *
  162. * Just because these are defined doesn't mean that the kernel
  163. * can do that feature, its just for new code vs old libdrm.
  164. */
  165. #define DRM_MODE_FEATURE_KMS 1
  166. #define DRM_MODE_FEATURE_DIRTYFB 1
  167. typedef struct _drmModeRes {
  168. int count_fbs;
  169. uint32_t *fbs;
  170. int count_crtcs;
  171. uint32_t *crtcs;
  172. int count_connectors;
  173. uint32_t *connectors;
  174. int count_encoders;
  175. uint32_t *encoders;
  176. uint32_t min_width, max_width;
  177. uint32_t min_height, max_height;
  178. } drmModeRes, *drmModeResPtr;
  179. typedef struct _drmModeModeInfo {
  180. uint32_t clock;
  181. uint16_t hdisplay, hsync_start, hsync_end, htotal, hskew;
  182. uint16_t vdisplay, vsync_start, vsync_end, vtotal, vscan;
  183. uint32_t vrefresh;
  184. uint32_t flags;
  185. uint32_t type;
  186. char name[DRM_DISPLAY_MODE_LEN];
  187. } drmModeModeInfo, *drmModeModeInfoPtr;
  188. typedef struct _drmModeFB {
  189. uint32_t fb_id;
  190. uint32_t width, height;
  191. uint32_t pitch;
  192. uint32_t bpp;
  193. uint32_t depth;
  194. /* driver specific handle */
  195. uint32_t handle;
  196. } drmModeFB, *drmModeFBPtr;
  197. typedef struct _drmModeFB2 {
  198. uint32_t fb_id;
  199. uint32_t width, height;
  200. uint32_t pixel_format; /* fourcc code from drm_fourcc.h */
  201. uint64_t modifier; /* applies to all buffers */
  202. uint32_t flags;
  203. /* per-plane GEM handle; may be duplicate entries for multiple planes */
  204. uint32_t handles[4];
  205. uint32_t pitches[4]; /* bytes */
  206. uint32_t offsets[4]; /* bytes */
  207. } drmModeFB2, *drmModeFB2Ptr;
  208. typedef struct drm_clip_rect drmModeClip, *drmModeClipPtr;
  209. typedef struct _drmModePropertyBlob {
  210. uint32_t id;
  211. uint32_t length;
  212. void *data;
  213. } drmModePropertyBlobRes, *drmModePropertyBlobPtr;
  214. typedef struct _drmModeProperty {
  215. uint32_t prop_id;
  216. uint32_t flags;
  217. char name[DRM_PROP_NAME_LEN];
  218. int count_values;
  219. uint64_t *values; /* store the blob lengths */
  220. int count_enums;
  221. struct drm_mode_property_enum *enums;
  222. int count_blobs;
  223. uint32_t *blob_ids; /* store the blob IDs */
  224. } drmModePropertyRes, *drmModePropertyPtr;
  225. static __inline int drm_property_type_is(drmModePropertyPtr property,
  226. uint32_t type)
  227. {
  228. /* instanceof for props.. handles extended type vs original types: */
  229. if (property->flags & DRM_MODE_PROP_EXTENDED_TYPE)
  230. return (property->flags & DRM_MODE_PROP_EXTENDED_TYPE) == type;
  231. return property->flags & type;
  232. }
  233. typedef struct _drmModeCrtc {
  234. uint32_t crtc_id;
  235. uint32_t buffer_id; /**< FB id to connect to 0 = disconnect */
  236. uint32_t x, y; /**< Position on the framebuffer */
  237. uint32_t width, height;
  238. int mode_valid;
  239. drmModeModeInfo mode;
  240. int gamma_size; /**< Number of gamma stops */
  241. } drmModeCrtc, *drmModeCrtcPtr;
  242. typedef struct _drmModeEncoder {
  243. uint32_t encoder_id;
  244. uint32_t encoder_type;
  245. uint32_t crtc_id;
  246. uint32_t possible_crtcs;
  247. uint32_t possible_clones;
  248. } drmModeEncoder, *drmModeEncoderPtr;
  249. typedef enum {
  250. DRM_MODE_CONNECTED = 1,
  251. DRM_MODE_DISCONNECTED = 2,
  252. DRM_MODE_UNKNOWNCONNECTION = 3
  253. } drmModeConnection;
  254. typedef enum {
  255. DRM_MODE_SUBPIXEL_UNKNOWN = 1,
  256. DRM_MODE_SUBPIXEL_HORIZONTAL_RGB = 2,
  257. DRM_MODE_SUBPIXEL_HORIZONTAL_BGR = 3,
  258. DRM_MODE_SUBPIXEL_VERTICAL_RGB = 4,
  259. DRM_MODE_SUBPIXEL_VERTICAL_BGR = 5,
  260. DRM_MODE_SUBPIXEL_NONE = 6
  261. } drmModeSubPixel;
  262. typedef struct _drmModeConnector {
  263. uint32_t connector_id;
  264. uint32_t encoder_id; /**< Encoder currently connected to */
  265. uint32_t connector_type;
  266. uint32_t connector_type_id;
  267. drmModeConnection connection;
  268. uint32_t mmWidth, mmHeight; /**< HxW in millimeters */
  269. drmModeSubPixel subpixel;
  270. int count_modes;
  271. drmModeModeInfoPtr modes;
  272. int count_props;
  273. uint32_t *props; /**< List of property ids */
  274. uint64_t *prop_values; /**< List of property values */
  275. int count_encoders;
  276. uint32_t *encoders; /**< List of encoder ids */
  277. } drmModeConnector, *drmModeConnectorPtr;
  278. #define DRM_PLANE_TYPE_OVERLAY 0
  279. #define DRM_PLANE_TYPE_PRIMARY 1
  280. #define DRM_PLANE_TYPE_CURSOR 2
  281. typedef struct _drmModeObjectProperties {
  282. uint32_t count_props;
  283. uint32_t *props;
  284. uint64_t *prop_values;
  285. } drmModeObjectProperties, *drmModeObjectPropertiesPtr;
  286. typedef struct _drmModeFormats {
  287. uint32_t count;
  288. struct {
  289. uint32_t format;
  290. uint32_t count_modifiers;
  291. uint64_t *modifiers;
  292. } formats[1];
  293. } drmModeFormats, *drmModeFormatsPtr;
  294. typedef struct _drmModePlane {
  295. uint32_t count_formats;
  296. uint32_t *formats;
  297. uint32_t plane_id;
  298. uint32_t crtc_id;
  299. uint32_t fb_id;
  300. uint32_t crtc_x, crtc_y;
  301. uint32_t x, y;
  302. uint32_t possible_crtcs;
  303. uint32_t gamma_size;
  304. } drmModePlane, *drmModePlanePtr;
  305. typedef struct _drmModePlaneRes {
  306. uint32_t count_planes;
  307. uint32_t *planes;
  308. } drmModePlaneRes, *drmModePlaneResPtr;
  309. extern void drmModeFreeModeInfo( drmModeModeInfoPtr ptr );
  310. extern void drmModeFreeResources( drmModeResPtr ptr );
  311. extern void drmModeFreeFB( drmModeFBPtr ptr );
  312. extern void drmModeFreeFB2( drmModeFB2Ptr ptr );
  313. extern void drmModeFreeCrtc( drmModeCrtcPtr ptr );
  314. extern void drmModeFreeConnector( drmModeConnectorPtr ptr );
  315. extern void drmModeFreeEncoder( drmModeEncoderPtr ptr );
  316. extern void drmModeFreePlane( drmModePlanePtr ptr );
  317. extern void drmModeFreePlaneResources(drmModePlaneResPtr ptr);
  318. /**
  319. * Retrieves all of the resources associated with a card.
  320. */
  321. extern drmModeResPtr drmModeGetResources(int fd);
  322. /*
  323. * FrameBuffer manipulation.
  324. */
  325. /**
  326. * Retrieve information about framebuffer bufferId
  327. */
  328. extern drmModeFBPtr drmModeGetFB(int fd, uint32_t bufferId);
  329. extern drmModeFB2Ptr drmModeGetFB2(int fd, uint32_t bufferId);
  330. /**
  331. * Creates a new framebuffer with an buffer object as its scanout buffer.
  332. */
  333. extern int drmModeAddFB(int fd, uint32_t width, uint32_t height, uint8_t depth,
  334. uint8_t bpp, uint32_t pitch, uint32_t bo_handle,
  335. uint32_t *buf_id);
  336. /* ...with a specific pixel format */
  337. extern int drmModeAddFB2(int fd, uint32_t width, uint32_t height,
  338. uint32_t pixel_format, const uint32_t bo_handles[4],
  339. const uint32_t pitches[4], const uint32_t offsets[4],
  340. uint32_t *buf_id, uint32_t flags);
  341. /* ...with format modifiers */
  342. int drmModeAddFB2WithModifiers(int fd, uint32_t width, uint32_t height,
  343. uint32_t pixel_format, const uint32_t bo_handles[4],
  344. const uint32_t pitches[4], const uint32_t offsets[4],
  345. const uint64_t modifier[4], uint32_t *buf_id,
  346. uint32_t flags);
  347. /**
  348. * Destroies the given framebuffer.
  349. */
  350. extern int drmModeRmFB(int fd, uint32_t bufferId);
  351. /**
  352. * Mark a region of a framebuffer as dirty.
  353. */
  354. extern int drmModeDirtyFB(int fd, uint32_t bufferId,
  355. drmModeClipPtr clips, uint32_t num_clips);
  356. /*
  357. * Crtc functions
  358. */
  359. /**
  360. * Retrieve information about the ctrt crtcId
  361. */
  362. extern drmModeCrtcPtr drmModeGetCrtc(int fd, uint32_t crtcId);
  363. /**
  364. * Set the mode on a crtc crtcId with the given mode modeId.
  365. */
  366. int drmModeSetCrtc(int fd, uint32_t crtcId, uint32_t bufferId,
  367. uint32_t x, uint32_t y, uint32_t *connectors, int count,
  368. drmModeModeInfoPtr mode);
  369. /*
  370. * Cursor functions
  371. */
  372. /**
  373. * Set the cursor on crtc
  374. */
  375. int drmModeSetCursor(int fd, uint32_t crtcId, uint32_t bo_handle, uint32_t width, uint32_t height);
  376. int drmModeSetCursor2(int fd, uint32_t crtcId, uint32_t bo_handle, uint32_t width, uint32_t height, int32_t hot_x, int32_t hot_y);
  377. /**
  378. * Move the cursor on crtc
  379. */
  380. int drmModeMoveCursor(int fd, uint32_t crtcId, int x, int y);
  381. /**
  382. * Encoder functions
  383. */
  384. drmModeEncoderPtr drmModeGetEncoder(int fd, uint32_t encoder_id);
  385. /*
  386. * Connector manipulation
  387. */
  388. /**
  389. * Retrieve all information about the connector connectorId. This will do a
  390. * forced probe on the connector to retrieve remote information such as EDIDs
  391. * from the display device.
  392. */
  393. extern drmModeConnectorPtr drmModeGetConnector(int fd,
  394. uint32_t connectorId);
  395. /**
  396. * Retrieve current information, i.e the currently active mode and encoder,
  397. * about the connector connectorId. This will not do any probing on the
  398. * connector or remote device, and only reports what is currently known.
  399. * For the complete set of modes and encoders associated with the connector
  400. * use drmModeGetConnector() which will do a probe to determine any display
  401. * link changes first.
  402. */
  403. extern drmModeConnectorPtr drmModeGetConnectorCurrent(int fd,
  404. uint32_t connector_id);
  405. /**
  406. * Attaches the given mode to an connector.
  407. */
  408. extern int drmModeAttachMode(int fd, uint32_t connectorId, drmModeModeInfoPtr mode_info);
  409. /**
  410. * Detaches a mode from the connector
  411. * must be unused, by the given mode.
  412. */
  413. extern int drmModeDetachMode(int fd, uint32_t connectorId, drmModeModeInfoPtr mode_info);
  414. extern drmModePropertyPtr drmModeGetProperty(int fd, uint32_t propertyId);
  415. extern void drmModeFreeProperty(drmModePropertyPtr ptr);
  416. extern drmModePropertyBlobPtr drmModeGetPropertyBlob(int fd, uint32_t blob_id);
  417. extern int drmModePopulateFormats(drmModePropertyBlobPtr ptr,
  418. drmModeFormatsPtr *out_formats);
  419. extern void drmModeFreeFormats(drmModeFormatsPtr ptr);
  420. extern void drmModeFreePropertyBlob(drmModePropertyBlobPtr ptr);
  421. extern int drmModeConnectorSetProperty(int fd, uint32_t connector_id, uint32_t property_id,
  422. uint64_t value);
  423. extern int drmCheckModesettingSupported(const char *busid);
  424. extern int drmModeCrtcSetGamma(int fd, uint32_t crtc_id, uint32_t size,
  425. uint16_t *red, uint16_t *green, uint16_t *blue);
  426. extern int drmModeCrtcGetGamma(int fd, uint32_t crtc_id, uint32_t size,
  427. uint16_t *red, uint16_t *green, uint16_t *blue);
  428. extern int drmModePageFlip(int fd, uint32_t crtc_id, uint32_t fb_id,
  429. uint32_t flags, void *user_data);
  430. extern int drmModePageFlipTarget(int fd, uint32_t crtc_id, uint32_t fb_id,
  431. uint32_t flags, void *user_data,
  432. uint32_t target_vblank);
  433. extern drmModePlaneResPtr drmModeGetPlaneResources(int fd);
  434. extern drmModePlanePtr drmModeGetPlane(int fd, uint32_t plane_id);
  435. extern int drmModeSetPlane(int fd, uint32_t plane_id, uint32_t crtc_id,
  436. uint32_t fb_id, uint32_t flags,
  437. int32_t crtc_x, int32_t crtc_y,
  438. uint32_t crtc_w, uint32_t crtc_h,
  439. uint32_t src_x, uint32_t src_y,
  440. uint32_t src_w, uint32_t src_h);
  441. extern drmModeObjectPropertiesPtr drmModeObjectGetProperties(int fd,
  442. uint32_t object_id,
  443. uint32_t object_type);
  444. extern void drmModeFreeObjectProperties(drmModeObjectPropertiesPtr ptr);
  445. extern int drmModeObjectSetProperty(int fd, uint32_t object_id,
  446. uint32_t object_type, uint32_t property_id,
  447. uint64_t value);
  448. typedef struct _drmModeAtomicReq drmModeAtomicReq, *drmModeAtomicReqPtr;
  449. extern drmModeAtomicReqPtr drmModeAtomicAlloc(void);
  450. extern drmModeAtomicReqPtr drmModeAtomicDuplicate(drmModeAtomicReqPtr req);
  451. extern int drmModeAtomicMerge(drmModeAtomicReqPtr base,
  452. drmModeAtomicReqPtr augment);
  453. extern void drmModeAtomicFree(drmModeAtomicReqPtr req);
  454. extern int drmModeAtomicGetCursor(drmModeAtomicReqPtr req);
  455. extern void drmModeAtomicSetCursor(drmModeAtomicReqPtr req, int cursor);
  456. extern int drmModeAtomicAddProperty(drmModeAtomicReqPtr req,
  457. uint32_t object_id,
  458. uint32_t property_id,
  459. uint64_t value);
  460. extern int drmModeAtomicCommit(int fd,
  461. drmModeAtomicReqPtr req,
  462. uint32_t flags,
  463. void *user_data);
  464. extern int drmModeCreatePropertyBlob(int fd, const void *data, size_t size,
  465. uint32_t *id);
  466. extern int drmModeDestroyPropertyBlob(int fd, uint32_t id);
  467. /*
  468. * DRM mode lease APIs. These create and manage new drm_masters with
  469. * access to a subset of the available DRM resources
  470. */
  471. extern int drmModeCreateLease(int fd, const uint32_t *objects, int num_objects, int flags, uint32_t *lessee_id);
  472. typedef struct drmModeLesseeList {
  473. uint32_t count;
  474. uint32_t lessees[0];
  475. } drmModeLesseeListRes, *drmModeLesseeListPtr;
  476. extern drmModeLesseeListPtr drmModeListLessees(int fd);
  477. typedef struct drmModeObjectList {
  478. uint32_t count;
  479. uint32_t objects[0];
  480. } drmModeObjectListRes, *drmModeObjectListPtr;
  481. extern drmModeObjectListPtr drmModeGetLease(int fd);
  482. extern int drmModeRevokeLease(int fd, uint32_t lessee_id);
  483. #if defined(__cplusplus)
  484. }
  485. #endif
  486. #endif