vmwgfx_drm.h 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219
  1. /**************************************************************************
  2. *
  3. * Copyright © 2009-2015 VMware, Inc., Palo Alto, CA., USA
  4. * All Rights Reserved.
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a
  7. * copy of this software and associated documentation files (the
  8. * "Software"), to deal in the Software without restriction, including
  9. * without limitation the rights to use, copy, modify, merge, publish,
  10. * distribute, sub license, and/or sell copies of the Software, and to
  11. * permit persons to whom the Software is furnished to do so, subject to
  12. * the following conditions:
  13. *
  14. * The above copyright notice and this permission notice (including the
  15. * next paragraph) shall be included in all copies or substantial portions
  16. * 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 NON-INFRINGEMENT. IN NO EVENT SHALL
  21. * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
  22. * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  23. * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  24. * USE OR OTHER DEALINGS IN THE SOFTWARE.
  25. *
  26. **************************************************************************/
  27. #ifndef __VMWGFX_DRM_H__
  28. #define __VMWGFX_DRM_H__
  29. #include "drm.h"
  30. #if defined(__cplusplus)
  31. extern "C" {
  32. #endif
  33. #define DRM_VMW_MAX_SURFACE_FACES 6
  34. #define DRM_VMW_MAX_MIP_LEVELS 24
  35. #define DRM_VMW_GET_PARAM 0
  36. #define DRM_VMW_ALLOC_DMABUF 1
  37. #define DRM_VMW_ALLOC_BO 1
  38. #define DRM_VMW_UNREF_DMABUF 2
  39. #define DRM_VMW_HANDLE_CLOSE 2
  40. #define DRM_VMW_CURSOR_BYPASS 3
  41. /* guarded by DRM_VMW_PARAM_NUM_STREAMS != 0*/
  42. #define DRM_VMW_CONTROL_STREAM 4
  43. #define DRM_VMW_CLAIM_STREAM 5
  44. #define DRM_VMW_UNREF_STREAM 6
  45. /* guarded by DRM_VMW_PARAM_3D == 1 */
  46. #define DRM_VMW_CREATE_CONTEXT 7
  47. #define DRM_VMW_UNREF_CONTEXT 8
  48. #define DRM_VMW_CREATE_SURFACE 9
  49. #define DRM_VMW_UNREF_SURFACE 10
  50. #define DRM_VMW_REF_SURFACE 11
  51. #define DRM_VMW_EXECBUF 12
  52. #define DRM_VMW_GET_3D_CAP 13
  53. #define DRM_VMW_FENCE_WAIT 14
  54. #define DRM_VMW_FENCE_SIGNALED 15
  55. #define DRM_VMW_FENCE_UNREF 16
  56. #define DRM_VMW_FENCE_EVENT 17
  57. #define DRM_VMW_PRESENT 18
  58. #define DRM_VMW_PRESENT_READBACK 19
  59. #define DRM_VMW_UPDATE_LAYOUT 20
  60. #define DRM_VMW_CREATE_SHADER 21
  61. #define DRM_VMW_UNREF_SHADER 22
  62. #define DRM_VMW_GB_SURFACE_CREATE 23
  63. #define DRM_VMW_GB_SURFACE_REF 24
  64. #define DRM_VMW_SYNCCPU 25
  65. #define DRM_VMW_CREATE_EXTENDED_CONTEXT 26
  66. #define DRM_VMW_GB_SURFACE_CREATE_EXT 27
  67. #define DRM_VMW_GB_SURFACE_REF_EXT 28
  68. /*************************************************************************/
  69. /**
  70. * DRM_VMW_GET_PARAM - get device information.
  71. *
  72. * DRM_VMW_PARAM_FIFO_OFFSET:
  73. * Offset to use to map the first page of the FIFO read-only.
  74. * The fifo is mapped using the mmap() system call on the drm device.
  75. *
  76. * DRM_VMW_PARAM_OVERLAY_IOCTL:
  77. * Does the driver support the overlay ioctl.
  78. *
  79. * DRM_VMW_PARAM_SM4_1
  80. * SM4_1 support is enabled.
  81. */
  82. #define DRM_VMW_PARAM_NUM_STREAMS 0
  83. #define DRM_VMW_PARAM_NUM_FREE_STREAMS 1
  84. #define DRM_VMW_PARAM_3D 2
  85. #define DRM_VMW_PARAM_HW_CAPS 3
  86. #define DRM_VMW_PARAM_FIFO_CAPS 4
  87. #define DRM_VMW_PARAM_MAX_FB_SIZE 5
  88. #define DRM_VMW_PARAM_FIFO_HW_VERSION 6
  89. #define DRM_VMW_PARAM_MAX_SURF_MEMORY 7
  90. #define DRM_VMW_PARAM_3D_CAPS_SIZE 8
  91. #define DRM_VMW_PARAM_MAX_MOB_MEMORY 9
  92. #define DRM_VMW_PARAM_MAX_MOB_SIZE 10
  93. #define DRM_VMW_PARAM_SCREEN_TARGET 11
  94. #define DRM_VMW_PARAM_DX 12
  95. #define DRM_VMW_PARAM_HW_CAPS2 13
  96. #define DRM_VMW_PARAM_SM4_1 14
  97. /**
  98. * enum drm_vmw_handle_type - handle type for ref ioctls
  99. *
  100. */
  101. enum drm_vmw_handle_type {
  102. DRM_VMW_HANDLE_LEGACY = 0,
  103. DRM_VMW_HANDLE_PRIME = 1
  104. };
  105. /**
  106. * struct drm_vmw_getparam_arg
  107. *
  108. * @value: Returned value. //Out
  109. * @param: Parameter to query. //In.
  110. *
  111. * Argument to the DRM_VMW_GET_PARAM Ioctl.
  112. */
  113. struct drm_vmw_getparam_arg {
  114. __u64 value;
  115. __u32 param;
  116. __u32 pad64;
  117. };
  118. /*************************************************************************/
  119. /**
  120. * DRM_VMW_CREATE_CONTEXT - Create a host context.
  121. *
  122. * Allocates a device unique context id, and queues a create context command
  123. * for the host. Does not wait for host completion.
  124. */
  125. /**
  126. * struct drm_vmw_context_arg
  127. *
  128. * @cid: Device unique context ID.
  129. *
  130. * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
  131. * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
  132. */
  133. struct drm_vmw_context_arg {
  134. __s32 cid;
  135. __u32 pad64;
  136. };
  137. /*************************************************************************/
  138. /**
  139. * DRM_VMW_UNREF_CONTEXT - Create a host context.
  140. *
  141. * Frees a global context id, and queues a destroy host command for the host.
  142. * Does not wait for host completion. The context ID can be used directly
  143. * in the command stream and shows up as the same context ID on the host.
  144. */
  145. /*************************************************************************/
  146. /**
  147. * DRM_VMW_CREATE_SURFACE - Create a host suface.
  148. *
  149. * Allocates a device unique surface id, and queues a create surface command
  150. * for the host. Does not wait for host completion. The surface ID can be
  151. * used directly in the command stream and shows up as the same surface
  152. * ID on the host.
  153. */
  154. /**
  155. * struct drm_wmv_surface_create_req
  156. *
  157. * @flags: Surface flags as understood by the host.
  158. * @format: Surface format as understood by the host.
  159. * @mip_levels: Number of mip levels for each face.
  160. * An unused face should have 0 encoded.
  161. * @size_addr: Address of a user-space array of sruct drm_vmw_size
  162. * cast to an __u64 for 32-64 bit compatibility.
  163. * The size of the array should equal the total number of mipmap levels.
  164. * @shareable: Boolean whether other clients (as identified by file descriptors)
  165. * may reference this surface.
  166. * @scanout: Boolean whether the surface is intended to be used as a
  167. * scanout.
  168. *
  169. * Input data to the DRM_VMW_CREATE_SURFACE Ioctl.
  170. * Output data from the DRM_VMW_REF_SURFACE Ioctl.
  171. */
  172. struct drm_vmw_surface_create_req {
  173. __u32 flags;
  174. __u32 format;
  175. __u32 mip_levels[DRM_VMW_MAX_SURFACE_FACES];
  176. __u64 size_addr;
  177. __s32 shareable;
  178. __s32 scanout;
  179. };
  180. /**
  181. * struct drm_wmv_surface_arg
  182. *
  183. * @sid: Surface id of created surface or surface to destroy or reference.
  184. * @handle_type: Handle type for DRM_VMW_REF_SURFACE Ioctl.
  185. *
  186. * Output data from the DRM_VMW_CREATE_SURFACE Ioctl.
  187. * Input argument to the DRM_VMW_UNREF_SURFACE Ioctl.
  188. * Input argument to the DRM_VMW_REF_SURFACE Ioctl.
  189. */
  190. struct drm_vmw_surface_arg {
  191. __s32 sid;
  192. enum drm_vmw_handle_type handle_type;
  193. };
  194. /**
  195. * struct drm_vmw_size ioctl.
  196. *
  197. * @width - mip level width
  198. * @height - mip level height
  199. * @depth - mip level depth
  200. *
  201. * Description of a mip level.
  202. * Input data to the DRM_WMW_CREATE_SURFACE Ioctl.
  203. */
  204. struct drm_vmw_size {
  205. __u32 width;
  206. __u32 height;
  207. __u32 depth;
  208. __u32 pad64;
  209. };
  210. /**
  211. * union drm_vmw_surface_create_arg
  212. *
  213. * @rep: Output data as described above.
  214. * @req: Input data as described above.
  215. *
  216. * Argument to the DRM_VMW_CREATE_SURFACE Ioctl.
  217. */
  218. union drm_vmw_surface_create_arg {
  219. struct drm_vmw_surface_arg rep;
  220. struct drm_vmw_surface_create_req req;
  221. };
  222. /*************************************************************************/
  223. /**
  224. * DRM_VMW_REF_SURFACE - Reference a host surface.
  225. *
  226. * Puts a reference on a host surface with a give sid, as previously
  227. * returned by the DRM_VMW_CREATE_SURFACE ioctl.
  228. * A reference will make sure the surface isn't destroyed while we hold
  229. * it and will allow the calling client to use the surface ID in the command
  230. * stream.
  231. *
  232. * On successful return, the Ioctl returns the surface information given
  233. * in the DRM_VMW_CREATE_SURFACE ioctl.
  234. */
  235. /**
  236. * union drm_vmw_surface_reference_arg
  237. *
  238. * @rep: Output data as described above.
  239. * @req: Input data as described above.
  240. *
  241. * Argument to the DRM_VMW_REF_SURFACE Ioctl.
  242. */
  243. union drm_vmw_surface_reference_arg {
  244. struct drm_vmw_surface_create_req rep;
  245. struct drm_vmw_surface_arg req;
  246. };
  247. /*************************************************************************/
  248. /**
  249. * DRM_VMW_UNREF_SURFACE - Unreference a host surface.
  250. *
  251. * Clear a reference previously put on a host surface.
  252. * When all references are gone, including the one implicitly placed
  253. * on creation,
  254. * a destroy surface command will be queued for the host.
  255. * Does not wait for completion.
  256. */
  257. /*************************************************************************/
  258. /**
  259. * DRM_VMW_EXECBUF
  260. *
  261. * Submit a command buffer for execution on the host, and return a
  262. * fence seqno that when signaled, indicates that the command buffer has
  263. * executed.
  264. */
  265. /**
  266. * struct drm_vmw_execbuf_arg
  267. *
  268. * @commands: User-space address of a command buffer cast to an __u64.
  269. * @command-size: Size in bytes of the command buffer.
  270. * @throttle-us: Sleep until software is less than @throttle_us
  271. * microseconds ahead of hardware. The driver may round this value
  272. * to the nearest kernel tick.
  273. * @fence_rep: User-space address of a struct drm_vmw_fence_rep cast to an
  274. * __u64.
  275. * @version: Allows expanding the execbuf ioctl parameters without breaking
  276. * backwards compatibility, since user-space will always tell the kernel
  277. * which version it uses.
  278. * @flags: Execbuf flags.
  279. * @imported_fence_fd: FD for a fence imported from another device
  280. *
  281. * Argument to the DRM_VMW_EXECBUF Ioctl.
  282. */
  283. #define DRM_VMW_EXECBUF_VERSION 2
  284. #define DRM_VMW_EXECBUF_FLAG_IMPORT_FENCE_FD (1 << 0)
  285. #define DRM_VMW_EXECBUF_FLAG_EXPORT_FENCE_FD (1 << 1)
  286. struct drm_vmw_execbuf_arg {
  287. __u64 commands;
  288. __u32 command_size;
  289. __u32 throttle_us;
  290. __u64 fence_rep;
  291. __u32 version;
  292. __u32 flags;
  293. __u32 context_handle;
  294. __s32 imported_fence_fd;
  295. };
  296. /**
  297. * struct drm_vmw_fence_rep
  298. *
  299. * @handle: Fence object handle for fence associated with a command submission.
  300. * @mask: Fence flags relevant for this fence object.
  301. * @seqno: Fence sequence number in fifo. A fence object with a lower
  302. * seqno will signal the EXEC flag before a fence object with a higher
  303. * seqno. This can be used by user-space to avoid kernel calls to determine
  304. * whether a fence has signaled the EXEC flag. Note that @seqno will
  305. * wrap at 32-bit.
  306. * @passed_seqno: The highest seqno number processed by the hardware
  307. * so far. This can be used to mark user-space fence objects as signaled, and
  308. * to determine whether a fence seqno might be stale.
  309. * @fd: FD associated with the fence, -1 if not exported
  310. * @error: This member should've been set to -EFAULT on submission.
  311. * The following actions should be take on completion:
  312. * error == -EFAULT: Fence communication failed. The host is synchronized.
  313. * Use the last fence id read from the FIFO fence register.
  314. * error != 0 && error != -EFAULT:
  315. * Fence submission failed. The host is synchronized. Use the fence_seq member.
  316. * error == 0: All is OK, The host may not be synchronized.
  317. * Use the fence_seq member.
  318. *
  319. * Input / Output data to the DRM_VMW_EXECBUF Ioctl.
  320. */
  321. struct drm_vmw_fence_rep {
  322. __u32 handle;
  323. __u32 mask;
  324. __u32 seqno;
  325. __u32 passed_seqno;
  326. __s32 fd;
  327. __s32 error;
  328. };
  329. /*************************************************************************/
  330. /**
  331. * DRM_VMW_ALLOC_BO
  332. *
  333. * Allocate a buffer object that is visible also to the host.
  334. * NOTE: The buffer is
  335. * identified by a handle and an offset, which are private to the guest, but
  336. * useable in the command stream. The guest kernel may translate these
  337. * and patch up the command stream accordingly. In the future, the offset may
  338. * be zero at all times, or it may disappear from the interface before it is
  339. * fixed.
  340. *
  341. * The buffer object may stay user-space mapped in the guest at all times,
  342. * and is thus suitable for sub-allocation.
  343. *
  344. * Buffer objects are mapped using the mmap() syscall on the drm device.
  345. */
  346. /**
  347. * struct drm_vmw_alloc_bo_req
  348. *
  349. * @size: Required minimum size of the buffer.
  350. *
  351. * Input data to the DRM_VMW_ALLOC_BO Ioctl.
  352. */
  353. struct drm_vmw_alloc_bo_req {
  354. __u32 size;
  355. __u32 pad64;
  356. };
  357. #define drm_vmw_alloc_dmabuf_req drm_vmw_alloc_bo_req
  358. /**
  359. * struct drm_vmw_bo_rep
  360. *
  361. * @map_handle: Offset to use in the mmap() call used to map the buffer.
  362. * @handle: Handle unique to this buffer. Used for unreferencing.
  363. * @cur_gmr_id: GMR id to use in the command stream when this buffer is
  364. * referenced. See not above.
  365. * @cur_gmr_offset: Offset to use in the command stream when this buffer is
  366. * referenced. See note above.
  367. *
  368. * Output data from the DRM_VMW_ALLOC_BO Ioctl.
  369. */
  370. struct drm_vmw_bo_rep {
  371. __u64 map_handle;
  372. __u32 handle;
  373. __u32 cur_gmr_id;
  374. __u32 cur_gmr_offset;
  375. __u32 pad64;
  376. };
  377. #define drm_vmw_dmabuf_rep drm_vmw_bo_rep
  378. /**
  379. * union drm_vmw_alloc_bo_arg
  380. *
  381. * @req: Input data as described above.
  382. * @rep: Output data as described above.
  383. *
  384. * Argument to the DRM_VMW_ALLOC_BO Ioctl.
  385. */
  386. union drm_vmw_alloc_bo_arg {
  387. struct drm_vmw_alloc_bo_req req;
  388. struct drm_vmw_bo_rep rep;
  389. };
  390. #define drm_vmw_alloc_dmabuf_arg drm_vmw_alloc_bo_arg
  391. /*************************************************************************/
  392. /**
  393. * DRM_VMW_CONTROL_STREAM - Control overlays, aka streams.
  394. *
  395. * This IOCTL controls the overlay units of the svga device.
  396. * The SVGA overlay units does not work like regular hardware units in
  397. * that they do not automaticaly read back the contents of the given dma
  398. * buffer. But instead only read back for each call to this ioctl, and
  399. * at any point between this call being made and a following call that
  400. * either changes the buffer or disables the stream.
  401. */
  402. /**
  403. * struct drm_vmw_rect
  404. *
  405. * Defines a rectangle. Used in the overlay ioctl to define
  406. * source and destination rectangle.
  407. */
  408. struct drm_vmw_rect {
  409. __s32 x;
  410. __s32 y;
  411. __u32 w;
  412. __u32 h;
  413. };
  414. /**
  415. * struct drm_vmw_control_stream_arg
  416. *
  417. * @stream_id: Stearm to control
  418. * @enabled: If false all following arguments are ignored.
  419. * @handle: Handle to buffer for getting data from.
  420. * @format: Format of the overlay as understood by the host.
  421. * @width: Width of the overlay.
  422. * @height: Height of the overlay.
  423. * @size: Size of the overlay in bytes.
  424. * @pitch: Array of pitches, the two last are only used for YUV12 formats.
  425. * @offset: Offset from start of dma buffer to overlay.
  426. * @src: Source rect, must be within the defined area above.
  427. * @dst: Destination rect, x and y may be negative.
  428. *
  429. * Argument to the DRM_VMW_CONTROL_STREAM Ioctl.
  430. */
  431. struct drm_vmw_control_stream_arg {
  432. __u32 stream_id;
  433. __u32 enabled;
  434. __u32 flags;
  435. __u32 color_key;
  436. __u32 handle;
  437. __u32 offset;
  438. __s32 format;
  439. __u32 size;
  440. __u32 width;
  441. __u32 height;
  442. __u32 pitch[3];
  443. __u32 pad64;
  444. struct drm_vmw_rect src;
  445. struct drm_vmw_rect dst;
  446. };
  447. /*************************************************************************/
  448. /**
  449. * DRM_VMW_CURSOR_BYPASS - Give extra information about cursor bypass.
  450. *
  451. */
  452. #define DRM_VMW_CURSOR_BYPASS_ALL (1 << 0)
  453. #define DRM_VMW_CURSOR_BYPASS_FLAGS (1)
  454. /**
  455. * struct drm_vmw_cursor_bypass_arg
  456. *
  457. * @flags: Flags.
  458. * @crtc_id: Crtc id, only used if DMR_CURSOR_BYPASS_ALL isn't passed.
  459. * @xpos: X position of cursor.
  460. * @ypos: Y position of cursor.
  461. * @xhot: X hotspot.
  462. * @yhot: Y hotspot.
  463. *
  464. * Argument to the DRM_VMW_CURSOR_BYPASS Ioctl.
  465. */
  466. struct drm_vmw_cursor_bypass_arg {
  467. __u32 flags;
  468. __u32 crtc_id;
  469. __s32 xpos;
  470. __s32 ypos;
  471. __s32 xhot;
  472. __s32 yhot;
  473. };
  474. /*************************************************************************/
  475. /**
  476. * DRM_VMW_CLAIM_STREAM - Claim a single stream.
  477. */
  478. /**
  479. * struct drm_vmw_context_arg
  480. *
  481. * @stream_id: Device unique context ID.
  482. *
  483. * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
  484. * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
  485. */
  486. struct drm_vmw_stream_arg {
  487. __u32 stream_id;
  488. __u32 pad64;
  489. };
  490. /*************************************************************************/
  491. /**
  492. * DRM_VMW_UNREF_STREAM - Unclaim a stream.
  493. *
  494. * Return a single stream that was claimed by this process. Also makes
  495. * sure that the stream has been stopped.
  496. */
  497. /*************************************************************************/
  498. /**
  499. * DRM_VMW_GET_3D_CAP
  500. *
  501. * Read 3D capabilities from the FIFO
  502. *
  503. */
  504. /**
  505. * struct drm_vmw_get_3d_cap_arg
  506. *
  507. * @buffer: Pointer to a buffer for capability data, cast to an __u64
  508. * @size: Max size to copy
  509. *
  510. * Input argument to the DRM_VMW_GET_3D_CAP_IOCTL
  511. * ioctls.
  512. */
  513. struct drm_vmw_get_3d_cap_arg {
  514. __u64 buffer;
  515. __u32 max_size;
  516. __u32 pad64;
  517. };
  518. /*************************************************************************/
  519. /**
  520. * DRM_VMW_FENCE_WAIT
  521. *
  522. * Waits for a fence object to signal. The wait is interruptible, so that
  523. * signals may be delivered during the interrupt. The wait may timeout,
  524. * in which case the calls returns -EBUSY. If the wait is restarted,
  525. * that is restarting without resetting @cookie_valid to zero,
  526. * the timeout is computed from the first call.
  527. *
  528. * The flags argument to the DRM_VMW_FENCE_WAIT ioctl indicates what to wait
  529. * on:
  530. * DRM_VMW_FENCE_FLAG_EXEC: All commands ahead of the fence in the command
  531. * stream
  532. * have executed.
  533. * DRM_VMW_FENCE_FLAG_QUERY: All query results resulting from query finish
  534. * commands
  535. * in the buffer given to the EXECBUF ioctl returning the fence object handle
  536. * are available to user-space.
  537. *
  538. * DRM_VMW_WAIT_OPTION_UNREF: If this wait option is given, and the
  539. * fenc wait ioctl returns 0, the fence object has been unreferenced after
  540. * the wait.
  541. */
  542. #define DRM_VMW_FENCE_FLAG_EXEC (1 << 0)
  543. #define DRM_VMW_FENCE_FLAG_QUERY (1 << 1)
  544. #define DRM_VMW_WAIT_OPTION_UNREF (1 << 0)
  545. /**
  546. * struct drm_vmw_fence_wait_arg
  547. *
  548. * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
  549. * @cookie_valid: Must be reset to 0 on first call. Left alone on restart.
  550. * @kernel_cookie: Set to 0 on first call. Left alone on restart.
  551. * @timeout_us: Wait timeout in microseconds. 0 for indefinite timeout.
  552. * @lazy: Set to 1 if timing is not critical. Allow more than a kernel tick
  553. * before returning.
  554. * @flags: Fence flags to wait on.
  555. * @wait_options: Options that control the behaviour of the wait ioctl.
  556. *
  557. * Input argument to the DRM_VMW_FENCE_WAIT ioctl.
  558. */
  559. struct drm_vmw_fence_wait_arg {
  560. __u32 handle;
  561. __s32 cookie_valid;
  562. __u64 kernel_cookie;
  563. __u64 timeout_us;
  564. __s32 lazy;
  565. __s32 flags;
  566. __s32 wait_options;
  567. __s32 pad64;
  568. };
  569. /*************************************************************************/
  570. /**
  571. * DRM_VMW_FENCE_SIGNALED
  572. *
  573. * Checks if a fence object is signaled..
  574. */
  575. /**
  576. * struct drm_vmw_fence_signaled_arg
  577. *
  578. * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
  579. * @flags: Fence object flags input to DRM_VMW_FENCE_SIGNALED ioctl
  580. * @signaled: Out: Flags signaled.
  581. * @sequence: Out: Highest sequence passed so far. Can be used to signal the
  582. * EXEC flag of user-space fence objects.
  583. *
  584. * Input/Output argument to the DRM_VMW_FENCE_SIGNALED and DRM_VMW_FENCE_UNREF
  585. * ioctls.
  586. */
  587. struct drm_vmw_fence_signaled_arg {
  588. __u32 handle;
  589. __u32 flags;
  590. __s32 signaled;
  591. __u32 passed_seqno;
  592. __u32 signaled_flags;
  593. __u32 pad64;
  594. };
  595. /*************************************************************************/
  596. /**
  597. * DRM_VMW_FENCE_UNREF
  598. *
  599. * Unreferences a fence object, and causes it to be destroyed if there are no
  600. * other references to it.
  601. *
  602. */
  603. /**
  604. * struct drm_vmw_fence_arg
  605. *
  606. * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
  607. *
  608. * Input/Output argument to the DRM_VMW_FENCE_UNREF ioctl..
  609. */
  610. struct drm_vmw_fence_arg {
  611. __u32 handle;
  612. __u32 pad64;
  613. };
  614. /*************************************************************************/
  615. /**
  616. * DRM_VMW_FENCE_EVENT
  617. *
  618. * Queues an event on a fence to be delivered on the drm character device
  619. * when the fence has signaled the DRM_VMW_FENCE_FLAG_EXEC flag.
  620. * Optionally the approximate time when the fence signaled is
  621. * given by the event.
  622. */
  623. /*
  624. * The event type
  625. */
  626. #define DRM_VMW_EVENT_FENCE_SIGNALED 0x80000000
  627. struct drm_vmw_event_fence {
  628. struct drm_event base;
  629. __u64 user_data;
  630. __u32 tv_sec;
  631. __u32 tv_usec;
  632. };
  633. /*
  634. * Flags that may be given to the command.
  635. */
  636. /* Request fence signaled time on the event. */
  637. #define DRM_VMW_FE_FLAG_REQ_TIME (1 << 0)
  638. /**
  639. * struct drm_vmw_fence_event_arg
  640. *
  641. * @fence_rep: Pointer to fence_rep structure cast to __u64 or 0 if
  642. * the fence is not supposed to be referenced by user-space.
  643. * @user_info: Info to be delivered with the event.
  644. * @handle: Attach the event to this fence only.
  645. * @flags: A set of flags as defined above.
  646. */
  647. struct drm_vmw_fence_event_arg {
  648. __u64 fence_rep;
  649. __u64 user_data;
  650. __u32 handle;
  651. __u32 flags;
  652. };
  653. /*************************************************************************/
  654. /**
  655. * DRM_VMW_PRESENT
  656. *
  657. * Executes an SVGA present on a given fb for a given surface. The surface
  658. * is placed on the framebuffer. Cliprects are given relative to the given
  659. * point (the point disignated by dest_{x|y}).
  660. *
  661. */
  662. /**
  663. * struct drm_vmw_present_arg
  664. * @fb_id: framebuffer id to present / read back from.
  665. * @sid: Surface id to present from.
  666. * @dest_x: X placement coordinate for surface.
  667. * @dest_y: Y placement coordinate for surface.
  668. * @clips_ptr: Pointer to an array of clip rects cast to an __u64.
  669. * @num_clips: Number of cliprects given relative to the framebuffer origin,
  670. * in the same coordinate space as the frame buffer.
  671. * @pad64: Unused 64-bit padding.
  672. *
  673. * Input argument to the DRM_VMW_PRESENT ioctl.
  674. */
  675. struct drm_vmw_present_arg {
  676. __u32 fb_id;
  677. __u32 sid;
  678. __s32 dest_x;
  679. __s32 dest_y;
  680. __u64 clips_ptr;
  681. __u32 num_clips;
  682. __u32 pad64;
  683. };
  684. /*************************************************************************/
  685. /**
  686. * DRM_VMW_PRESENT_READBACK
  687. *
  688. * Executes an SVGA present readback from a given fb to the dma buffer
  689. * currently bound as the fb. If there is no dma buffer bound to the fb,
  690. * an error will be returned.
  691. *
  692. */
  693. /**
  694. * struct drm_vmw_present_arg
  695. * @fb_id: fb_id to present / read back from.
  696. * @num_clips: Number of cliprects.
  697. * @clips_ptr: Pointer to an array of clip rects cast to an __u64.
  698. * @fence_rep: Pointer to a struct drm_vmw_fence_rep, cast to an __u64.
  699. * If this member is NULL, then the ioctl should not return a fence.
  700. */
  701. struct drm_vmw_present_readback_arg {
  702. __u32 fb_id;
  703. __u32 num_clips;
  704. __u64 clips_ptr;
  705. __u64 fence_rep;
  706. };
  707. /*************************************************************************/
  708. /**
  709. * DRM_VMW_UPDATE_LAYOUT - Update layout
  710. *
  711. * Updates the preferred modes and connection status for connectors. The
  712. * command consists of one drm_vmw_update_layout_arg pointing to an array
  713. * of num_outputs drm_vmw_rect's.
  714. */
  715. /**
  716. * struct drm_vmw_update_layout_arg
  717. *
  718. * @num_outputs: number of active connectors
  719. * @rects: pointer to array of drm_vmw_rect cast to an __u64
  720. *
  721. * Input argument to the DRM_VMW_UPDATE_LAYOUT Ioctl.
  722. */
  723. struct drm_vmw_update_layout_arg {
  724. __u32 num_outputs;
  725. __u32 pad64;
  726. __u64 rects;
  727. };
  728. /*************************************************************************/
  729. /**
  730. * DRM_VMW_CREATE_SHADER - Create shader
  731. *
  732. * Creates a shader and optionally binds it to a dma buffer containing
  733. * the shader byte-code.
  734. */
  735. /**
  736. * enum drm_vmw_shader_type - Shader types
  737. */
  738. enum drm_vmw_shader_type {
  739. drm_vmw_shader_type_vs = 0,
  740. drm_vmw_shader_type_ps,
  741. };
  742. /**
  743. * struct drm_vmw_shader_create_arg
  744. *
  745. * @shader_type: Shader type of the shader to create.
  746. * @size: Size of the byte-code in bytes.
  747. * where the shader byte-code starts
  748. * @buffer_handle: Buffer handle identifying the buffer containing the
  749. * shader byte-code
  750. * @shader_handle: On successful completion contains a handle that
  751. * can be used to subsequently identify the shader.
  752. * @offset: Offset in bytes into the buffer given by @buffer_handle,
  753. *
  754. * Input / Output argument to the DRM_VMW_CREATE_SHADER Ioctl.
  755. */
  756. struct drm_vmw_shader_create_arg {
  757. enum drm_vmw_shader_type shader_type;
  758. __u32 size;
  759. __u32 buffer_handle;
  760. __u32 shader_handle;
  761. __u64 offset;
  762. };
  763. /*************************************************************************/
  764. /**
  765. * DRM_VMW_UNREF_SHADER - Unreferences a shader
  766. *
  767. * Destroys a user-space reference to a shader, optionally destroying
  768. * it.
  769. */
  770. /**
  771. * struct drm_vmw_shader_arg
  772. *
  773. * @handle: Handle identifying the shader to destroy.
  774. *
  775. * Input argument to the DRM_VMW_UNREF_SHADER ioctl.
  776. */
  777. struct drm_vmw_shader_arg {
  778. __u32 handle;
  779. __u32 pad64;
  780. };
  781. /*************************************************************************/
  782. /**
  783. * DRM_VMW_GB_SURFACE_CREATE - Create a host guest-backed surface.
  784. *
  785. * Allocates a surface handle and queues a create surface command
  786. * for the host on the first use of the surface. The surface ID can
  787. * be used as the surface ID in commands referencing the surface.
  788. */
  789. /**
  790. * enum drm_vmw_surface_flags
  791. *
  792. * @drm_vmw_surface_flag_shareable: Whether the surface is shareable
  793. * @drm_vmw_surface_flag_scanout: Whether the surface is a scanout
  794. * surface.
  795. * @drm_vmw_surface_flag_create_buffer: Create a backup buffer if none is
  796. * given.
  797. */
  798. enum drm_vmw_surface_flags {
  799. drm_vmw_surface_flag_shareable = (1 << 0),
  800. drm_vmw_surface_flag_scanout = (1 << 1),
  801. drm_vmw_surface_flag_create_buffer = (1 << 2)
  802. };
  803. /**
  804. * struct drm_vmw_gb_surface_create_req
  805. *
  806. * @svga3d_flags: SVGA3d surface flags for the device.
  807. * @format: SVGA3d format.
  808. * @mip_level: Number of mip levels for all faces.
  809. * @drm_surface_flags Flags as described above.
  810. * @multisample_count Future use. Set to 0.
  811. * @autogen_filter Future use. Set to 0.
  812. * @buffer_handle Buffer handle of backup buffer. SVGA3D_INVALID_ID
  813. * if none.
  814. * @base_size Size of the base mip level for all faces.
  815. * @array_size Must be zero for non-DX hardware, and if non-zero
  816. * svga3d_flags must have proper bind flags setup.
  817. *
  818. * Input argument to the DRM_VMW_GB_SURFACE_CREATE Ioctl.
  819. * Part of output argument for the DRM_VMW_GB_SURFACE_REF Ioctl.
  820. */
  821. struct drm_vmw_gb_surface_create_req {
  822. __u32 svga3d_flags;
  823. __u32 format;
  824. __u32 mip_levels;
  825. enum drm_vmw_surface_flags drm_surface_flags;
  826. __u32 multisample_count;
  827. __u32 autogen_filter;
  828. __u32 buffer_handle;
  829. __u32 array_size;
  830. struct drm_vmw_size base_size;
  831. };
  832. /**
  833. * struct drm_vmw_gb_surface_create_rep
  834. *
  835. * @handle: Surface handle.
  836. * @backup_size: Size of backup buffers for this surface.
  837. * @buffer_handle: Handle of backup buffer. SVGA3D_INVALID_ID if none.
  838. * @buffer_size: Actual size of the buffer identified by
  839. * @buffer_handle
  840. * @buffer_map_handle: Offset into device address space for the buffer
  841. * identified by @buffer_handle.
  842. *
  843. * Part of output argument for the DRM_VMW_GB_SURFACE_REF ioctl.
  844. * Output argument for the DRM_VMW_GB_SURFACE_CREATE ioctl.
  845. */
  846. struct drm_vmw_gb_surface_create_rep {
  847. __u32 handle;
  848. __u32 backup_size;
  849. __u32 buffer_handle;
  850. __u32 buffer_size;
  851. __u64 buffer_map_handle;
  852. };
  853. /**
  854. * union drm_vmw_gb_surface_create_arg
  855. *
  856. * @req: Input argument as described above.
  857. * @rep: Output argument as described above.
  858. *
  859. * Argument to the DRM_VMW_GB_SURFACE_CREATE ioctl.
  860. */
  861. union drm_vmw_gb_surface_create_arg {
  862. struct drm_vmw_gb_surface_create_rep rep;
  863. struct drm_vmw_gb_surface_create_req req;
  864. };
  865. /*************************************************************************/
  866. /**
  867. * DRM_VMW_GB_SURFACE_REF - Reference a host surface.
  868. *
  869. * Puts a reference on a host surface with a given handle, as previously
  870. * returned by the DRM_VMW_GB_SURFACE_CREATE ioctl.
  871. * A reference will make sure the surface isn't destroyed while we hold
  872. * it and will allow the calling client to use the surface handle in
  873. * the command stream.
  874. *
  875. * On successful return, the Ioctl returns the surface information given
  876. * to and returned from the DRM_VMW_GB_SURFACE_CREATE ioctl.
  877. */
  878. /**
  879. * struct drm_vmw_gb_surface_reference_arg
  880. *
  881. * @creq: The data used as input when the surface was created, as described
  882. * above at "struct drm_vmw_gb_surface_create_req"
  883. * @crep: Additional data output when the surface was created, as described
  884. * above at "struct drm_vmw_gb_surface_create_rep"
  885. *
  886. * Output Argument to the DRM_VMW_GB_SURFACE_REF ioctl.
  887. */
  888. struct drm_vmw_gb_surface_ref_rep {
  889. struct drm_vmw_gb_surface_create_req creq;
  890. struct drm_vmw_gb_surface_create_rep crep;
  891. };
  892. /**
  893. * union drm_vmw_gb_surface_reference_arg
  894. *
  895. * @req: Input data as described above at "struct drm_vmw_surface_arg"
  896. * @rep: Output data as described above at "struct drm_vmw_gb_surface_ref_rep"
  897. *
  898. * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl.
  899. */
  900. union drm_vmw_gb_surface_reference_arg {
  901. struct drm_vmw_gb_surface_ref_rep rep;
  902. struct drm_vmw_surface_arg req;
  903. };
  904. /*************************************************************************/
  905. /**
  906. * DRM_VMW_SYNCCPU - Sync a DMA buffer / MOB for CPU access.
  907. *
  908. * Idles any previously submitted GPU operations on the buffer and
  909. * by default blocks command submissions that reference the buffer.
  910. * If the file descriptor used to grab a blocking CPU sync is closed, the
  911. * cpu sync is released.
  912. * The flags argument indicates how the grab / release operation should be
  913. * performed:
  914. */
  915. /**
  916. * enum drm_vmw_synccpu_flags - Synccpu flags:
  917. *
  918. * @drm_vmw_synccpu_read: Sync for read. If sync is done for read only, it's a
  919. * hint to the kernel to allow command submissions that references the buffer
  920. * for read-only.
  921. * @drm_vmw_synccpu_write: Sync for write. Block all command submissions
  922. * referencing this buffer.
  923. * @drm_vmw_synccpu_dontblock: Dont wait for GPU idle, but rather return
  924. * -EBUSY should the buffer be busy.
  925. * @drm_vmw_synccpu_allow_cs: Allow command submission that touches the buffer
  926. * while the buffer is synced for CPU. This is similar to the GEM bo idle
  927. * behavior.
  928. */
  929. enum drm_vmw_synccpu_flags {
  930. drm_vmw_synccpu_read = (1 << 0),
  931. drm_vmw_synccpu_write = (1 << 1),
  932. drm_vmw_synccpu_dontblock = (1 << 2),
  933. drm_vmw_synccpu_allow_cs = (1 << 3)
  934. };
  935. /**
  936. * enum drm_vmw_synccpu_op - Synccpu operations:
  937. *
  938. * @drm_vmw_synccpu_grab: Grab the buffer for CPU operations
  939. * @drm_vmw_synccpu_release: Release a previous grab.
  940. */
  941. enum drm_vmw_synccpu_op {
  942. drm_vmw_synccpu_grab,
  943. drm_vmw_synccpu_release
  944. };
  945. /**
  946. * struct drm_vmw_synccpu_arg
  947. *
  948. * @op: The synccpu operation as described above.
  949. * @handle: Handle identifying the buffer object.
  950. * @flags: Flags as described above.
  951. */
  952. struct drm_vmw_synccpu_arg {
  953. enum drm_vmw_synccpu_op op;
  954. enum drm_vmw_synccpu_flags flags;
  955. __u32 handle;
  956. __u32 pad64;
  957. };
  958. /*************************************************************************/
  959. /**
  960. * DRM_VMW_CREATE_EXTENDED_CONTEXT - Create a host context.
  961. *
  962. * Allocates a device unique context id, and queues a create context command
  963. * for the host. Does not wait for host completion.
  964. */
  965. enum drm_vmw_extended_context {
  966. drm_vmw_context_legacy,
  967. drm_vmw_context_dx
  968. };
  969. /**
  970. * union drm_vmw_extended_context_arg
  971. *
  972. * @req: Context type.
  973. * @rep: Context identifier.
  974. *
  975. * Argument to the DRM_VMW_CREATE_EXTENDED_CONTEXT Ioctl.
  976. */
  977. union drm_vmw_extended_context_arg {
  978. enum drm_vmw_extended_context req;
  979. struct drm_vmw_context_arg rep;
  980. };
  981. /*************************************************************************/
  982. /*
  983. * DRM_VMW_HANDLE_CLOSE - Close a user-space handle and release its
  984. * underlying resource.
  985. *
  986. * Note that this ioctl is overlaid on the deprecated DRM_VMW_UNREF_DMABUF
  987. * Ioctl.
  988. */
  989. /**
  990. * struct drm_vmw_handle_close_arg
  991. *
  992. * @handle: Handle to close.
  993. *
  994. * Argument to the DRM_VMW_HANDLE_CLOSE Ioctl.
  995. */
  996. struct drm_vmw_handle_close_arg {
  997. __u32 handle;
  998. __u32 pad64;
  999. };
  1000. #define drm_vmw_unref_dmabuf_arg drm_vmw_handle_close_arg
  1001. /*************************************************************************/
  1002. /**
  1003. * DRM_VMW_GB_SURFACE_CREATE_EXT - Create a host guest-backed surface.
  1004. *
  1005. * Allocates a surface handle and queues a create surface command
  1006. * for the host on the first use of the surface. The surface ID can
  1007. * be used as the surface ID in commands referencing the surface.
  1008. *
  1009. * This new command extends DRM_VMW_GB_SURFACE_CREATE by adding version
  1010. * parameter and 64 bit svga flag.
  1011. */
  1012. /**
  1013. * enum drm_vmw_surface_version
  1014. *
  1015. * @drm_vmw_surface_gb_v1: Corresponds to current gb surface format with
  1016. * svga3d surface flags split into 2, upper half and lower half.
  1017. */
  1018. enum drm_vmw_surface_version {
  1019. drm_vmw_gb_surface_v1
  1020. };
  1021. /**
  1022. * struct drm_vmw_gb_surface_create_ext_req
  1023. *
  1024. * @base: Surface create parameters.
  1025. * @version: Version of surface create ioctl.
  1026. * @svga3d_flags_upper_32_bits: Upper 32 bits of svga3d flags.
  1027. * @multisample_pattern: Multisampling pattern when msaa is supported.
  1028. * @quality_level: Precision settings for each sample.
  1029. * @must_be_zero: Reserved for future usage.
  1030. *
  1031. * Input argument to the DRM_VMW_GB_SURFACE_CREATE_EXT Ioctl.
  1032. * Part of output argument for the DRM_VMW_GB_SURFACE_REF_EXT Ioctl.
  1033. */
  1034. struct drm_vmw_gb_surface_create_ext_req {
  1035. struct drm_vmw_gb_surface_create_req base;
  1036. enum drm_vmw_surface_version version;
  1037. uint32_t svga3d_flags_upper_32_bits;
  1038. SVGA3dMSPattern multisample_pattern;
  1039. SVGA3dMSQualityLevel quality_level;
  1040. uint64_t must_be_zero;
  1041. };
  1042. /**
  1043. * union drm_vmw_gb_surface_create_ext_arg
  1044. *
  1045. * @req: Input argument as described above.
  1046. * @rep: Output argument as described above.
  1047. *
  1048. * Argument to the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl.
  1049. */
  1050. union drm_vmw_gb_surface_create_ext_arg {
  1051. struct drm_vmw_gb_surface_create_rep rep;
  1052. struct drm_vmw_gb_surface_create_ext_req req;
  1053. };
  1054. /*************************************************************************/
  1055. /**
  1056. * DRM_VMW_GB_SURFACE_REF_EXT - Reference a host surface.
  1057. *
  1058. * Puts a reference on a host surface with a given handle, as previously
  1059. * returned by the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl.
  1060. * A reference will make sure the surface isn't destroyed while we hold
  1061. * it and will allow the calling client to use the surface handle in
  1062. * the command stream.
  1063. *
  1064. * On successful return, the Ioctl returns the surface information given
  1065. * to and returned from the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl.
  1066. */
  1067. /**
  1068. * struct drm_vmw_gb_surface_ref_ext_rep
  1069. *
  1070. * @creq: The data used as input when the surface was created, as described
  1071. * above at "struct drm_vmw_gb_surface_create_ext_req"
  1072. * @crep: Additional data output when the surface was created, as described
  1073. * above at "struct drm_vmw_gb_surface_create_rep"
  1074. *
  1075. * Output Argument to the DRM_VMW_GB_SURFACE_REF_EXT ioctl.
  1076. */
  1077. struct drm_vmw_gb_surface_ref_ext_rep {
  1078. struct drm_vmw_gb_surface_create_ext_req creq;
  1079. struct drm_vmw_gb_surface_create_rep crep;
  1080. };
  1081. /**
  1082. * union drm_vmw_gb_surface_reference_ext_arg
  1083. *
  1084. * @req: Input data as described above at "struct drm_vmw_surface_arg"
  1085. * @rep: Output data as described above at
  1086. * "struct drm_vmw_gb_surface_ref_ext_rep"
  1087. *
  1088. * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl.
  1089. */
  1090. union drm_vmw_gb_surface_reference_ext_arg {
  1091. struct drm_vmw_gb_surface_ref_ext_rep rep;
  1092. struct drm_vmw_surface_arg req;
  1093. };
  1094. #if defined(__cplusplus)
  1095. }
  1096. #endif
  1097. #endif