xref: /openbmc/linux/include/uapi/drm/vmwgfx_drm.h (revision abaad3d9)
1718dceddSDavid Howells /**************************************************************************
2718dceddSDavid Howells  *
354fbde8aSSinclair Yeh  * Copyright © 2009-2015 VMware, Inc., Palo Alto, CA., USA
4718dceddSDavid Howells  * All Rights Reserved.
5718dceddSDavid Howells  *
6718dceddSDavid Howells  * Permission is hereby granted, free of charge, to any person obtaining a
7718dceddSDavid Howells  * copy of this software and associated documentation files (the
8718dceddSDavid Howells  * "Software"), to deal in the Software without restriction, including
9718dceddSDavid Howells  * without limitation the rights to use, copy, modify, merge, publish,
10718dceddSDavid Howells  * distribute, sub license, and/or sell copies of the Software, and to
11718dceddSDavid Howells  * permit persons to whom the Software is furnished to do so, subject to
12718dceddSDavid Howells  * the following conditions:
13718dceddSDavid Howells  *
14718dceddSDavid Howells  * The above copyright notice and this permission notice (including the
15718dceddSDavid Howells  * next paragraph) shall be included in all copies or substantial portions
16718dceddSDavid Howells  * of the Software.
17718dceddSDavid Howells  *
18718dceddSDavid Howells  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19718dceddSDavid Howells  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20718dceddSDavid Howells  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21718dceddSDavid Howells  * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22718dceddSDavid Howells  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23718dceddSDavid Howells  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24718dceddSDavid Howells  * USE OR OTHER DEALINGS IN THE SOFTWARE.
25718dceddSDavid Howells  *
26718dceddSDavid Howells  **************************************************************************/
27718dceddSDavid Howells 
28718dceddSDavid Howells #ifndef __VMWGFX_DRM_H__
29718dceddSDavid Howells #define __VMWGFX_DRM_H__
30718dceddSDavid Howells 
313a4197afSGabriel Laskar #include "drm.h"
321d7a5cbfSThomas Hellstrom 
33d3450e00SEmil Velikov #if defined(__cplusplus)
34d3450e00SEmil Velikov extern "C" {
35d3450e00SEmil Velikov #endif
36d3450e00SEmil Velikov 
37718dceddSDavid Howells #define DRM_VMW_MAX_SURFACE_FACES 6
38718dceddSDavid Howells #define DRM_VMW_MAX_MIP_LEVELS 24
39718dceddSDavid Howells 
40718dceddSDavid Howells 
41718dceddSDavid Howells #define DRM_VMW_GET_PARAM            0
42718dceddSDavid Howells #define DRM_VMW_ALLOC_DMABUF         1
43f1d34bfdSThomas Hellstrom #define DRM_VMW_ALLOC_BO             1
44718dceddSDavid Howells #define DRM_VMW_UNREF_DMABUF         2
452f9545ceSThomas Hellstrom #define DRM_VMW_HANDLE_CLOSE         2
46718dceddSDavid Howells #define DRM_VMW_CURSOR_BYPASS        3
47718dceddSDavid Howells /* guarded by DRM_VMW_PARAM_NUM_STREAMS != 0*/
48718dceddSDavid Howells #define DRM_VMW_CONTROL_STREAM       4
49718dceddSDavid Howells #define DRM_VMW_CLAIM_STREAM         5
50718dceddSDavid Howells #define DRM_VMW_UNREF_STREAM         6
51718dceddSDavid Howells /* guarded by DRM_VMW_PARAM_3D == 1 */
52718dceddSDavid Howells #define DRM_VMW_CREATE_CONTEXT       7
53718dceddSDavid Howells #define DRM_VMW_UNREF_CONTEXT        8
54718dceddSDavid Howells #define DRM_VMW_CREATE_SURFACE       9
55718dceddSDavid Howells #define DRM_VMW_UNREF_SURFACE        10
56718dceddSDavid Howells #define DRM_VMW_REF_SURFACE          11
57718dceddSDavid Howells #define DRM_VMW_EXECBUF              12
58718dceddSDavid Howells #define DRM_VMW_GET_3D_CAP           13
59718dceddSDavid Howells #define DRM_VMW_FENCE_WAIT           14
60718dceddSDavid Howells #define DRM_VMW_FENCE_SIGNALED       15
61718dceddSDavid Howells #define DRM_VMW_FENCE_UNREF          16
62718dceddSDavid Howells #define DRM_VMW_FENCE_EVENT          17
63718dceddSDavid Howells #define DRM_VMW_PRESENT              18
64718dceddSDavid Howells #define DRM_VMW_PRESENT_READBACK     19
65718dceddSDavid Howells #define DRM_VMW_UPDATE_LAYOUT        20
66cfe4d53eSThomas Hellstrom #define DRM_VMW_CREATE_SHADER        21
67cfe4d53eSThomas Hellstrom #define DRM_VMW_UNREF_SHADER         22
68cfe4d53eSThomas Hellstrom #define DRM_VMW_GB_SURFACE_CREATE    23
69cfe4d53eSThomas Hellstrom #define DRM_VMW_GB_SURFACE_REF       24
701d7a5cbfSThomas Hellstrom #define DRM_VMW_SYNCCPU              25
71d80efd5cSThomas Hellstrom #define DRM_VMW_CREATE_EXTENDED_CONTEXT 26
7214b1c33eSDeepak Rawat #define DRM_VMW_GB_SURFACE_CREATE_EXT   27
7314b1c33eSDeepak Rawat #define DRM_VMW_GB_SURFACE_REF_EXT      28
74cb92a323SRoland Scheidegger #define DRM_VMW_MSG                     29
757a7a933eSMartin Krastev #define DRM_VMW_MKSSTAT_RESET           30
767a7a933eSMartin Krastev #define DRM_VMW_MKSSTAT_ADD             31
777a7a933eSMartin Krastev #define DRM_VMW_MKSSTAT_REMOVE          32
78718dceddSDavid Howells 
79718dceddSDavid Howells /*************************************************************************/
80718dceddSDavid Howells /**
81718dceddSDavid Howells  * DRM_VMW_GET_PARAM - get device information.
82718dceddSDavid Howells  *
83718dceddSDavid Howells  * DRM_VMW_PARAM_FIFO_OFFSET:
84718dceddSDavid Howells  * Offset to use to map the first page of the FIFO read-only.
85718dceddSDavid Howells  * The fifo is mapped using the mmap() system call on the drm device.
86718dceddSDavid Howells  *
87718dceddSDavid Howells  * DRM_VMW_PARAM_OVERLAY_IOCTL:
88718dceddSDavid Howells  * Does the driver support the overlay ioctl.
899b07b287SDeepak Rawat  *
909b07b287SDeepak Rawat  * DRM_VMW_PARAM_SM4_1
919b07b287SDeepak Rawat  * SM4_1 support is enabled.
92f0fce233SDeepak Rawat  *
93f0fce233SDeepak Rawat  * DRM_VMW_PARAM_SM5
94f0fce233SDeepak Rawat  * SM5 support is enabled.
95718dceddSDavid Howells  */
96718dceddSDavid Howells 
97718dceddSDavid Howells #define DRM_VMW_PARAM_NUM_STREAMS      0
98718dceddSDavid Howells #define DRM_VMW_PARAM_NUM_FREE_STREAMS 1
99718dceddSDavid Howells #define DRM_VMW_PARAM_3D               2
100718dceddSDavid Howells #define DRM_VMW_PARAM_HW_CAPS          3
101718dceddSDavid Howells #define DRM_VMW_PARAM_FIFO_CAPS        4
102718dceddSDavid Howells #define DRM_VMW_PARAM_MAX_FB_SIZE      5
103718dceddSDavid Howells #define DRM_VMW_PARAM_FIFO_HW_VERSION  6
104cfe4d53eSThomas Hellstrom #define DRM_VMW_PARAM_MAX_SURF_MEMORY  7
105cfe4d53eSThomas Hellstrom #define DRM_VMW_PARAM_3D_CAPS_SIZE     8
106311474dbSThomas Hellstrom #define DRM_VMW_PARAM_MAX_MOB_MEMORY   9
107857aea1cSCharmaine Lee #define DRM_VMW_PARAM_MAX_MOB_SIZE     10
10835c05125SSinclair Yeh #define DRM_VMW_PARAM_SCREEN_TARGET    11
109d80efd5cSThomas Hellstrom #define DRM_VMW_PARAM_DX               12
1103b4c2511SNeha Bhende #define DRM_VMW_PARAM_HW_CAPS2         13
1119b07b287SDeepak Rawat #define DRM_VMW_PARAM_SM4_1            14
112f0fce233SDeepak Rawat #define DRM_VMW_PARAM_SM5              15
113*abaad3d9SZack Rusin #define DRM_VMW_PARAM_GL43             16
114718dceddSDavid Howells 
115718dceddSDavid Howells /**
116adebcb20SThomas Hellstrom  * enum drm_vmw_handle_type - handle type for ref ioctls
117adebcb20SThomas Hellstrom  *
118adebcb20SThomas Hellstrom  */
119adebcb20SThomas Hellstrom enum drm_vmw_handle_type {
120adebcb20SThomas Hellstrom 	DRM_VMW_HANDLE_LEGACY = 0,
121adebcb20SThomas Hellstrom 	DRM_VMW_HANDLE_PRIME = 1
122adebcb20SThomas Hellstrom };
123adebcb20SThomas Hellstrom 
124adebcb20SThomas Hellstrom /**
125718dceddSDavid Howells  * struct drm_vmw_getparam_arg
126718dceddSDavid Howells  *
127718dceddSDavid Howells  * @value: Returned value. //Out
128718dceddSDavid Howells  * @param: Parameter to query. //In.
129718dceddSDavid Howells  *
130718dceddSDavid Howells  * Argument to the DRM_VMW_GET_PARAM Ioctl.
131718dceddSDavid Howells  */
132718dceddSDavid Howells 
133718dceddSDavid Howells struct drm_vmw_getparam_arg {
13421de2fdaSMikko Rapeli 	__u64 value;
13521de2fdaSMikko Rapeli 	__u32 param;
13621de2fdaSMikko Rapeli 	__u32 pad64;
137718dceddSDavid Howells };
138718dceddSDavid Howells 
139718dceddSDavid Howells /*************************************************************************/
140718dceddSDavid Howells /**
141718dceddSDavid Howells  * DRM_VMW_CREATE_CONTEXT - Create a host context.
142718dceddSDavid Howells  *
143718dceddSDavid Howells  * Allocates a device unique context id, and queues a create context command
144718dceddSDavid Howells  * for the host. Does not wait for host completion.
145718dceddSDavid Howells  */
146718dceddSDavid Howells 
147718dceddSDavid Howells /**
148718dceddSDavid Howells  * struct drm_vmw_context_arg
149718dceddSDavid Howells  *
150718dceddSDavid Howells  * @cid: Device unique context ID.
151718dceddSDavid Howells  *
152718dceddSDavid Howells  * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
153718dceddSDavid Howells  * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
154718dceddSDavid Howells  */
155718dceddSDavid Howells 
156718dceddSDavid Howells struct drm_vmw_context_arg {
15721de2fdaSMikko Rapeli 	__s32 cid;
15821de2fdaSMikko Rapeli 	__u32 pad64;
159718dceddSDavid Howells };
160718dceddSDavid Howells 
161718dceddSDavid Howells /*************************************************************************/
162718dceddSDavid Howells /**
163718dceddSDavid Howells  * DRM_VMW_UNREF_CONTEXT - Create a host context.
164718dceddSDavid Howells  *
165718dceddSDavid Howells  * Frees a global context id, and queues a destroy host command for the host.
166718dceddSDavid Howells  * Does not wait for host completion. The context ID can be used directly
167718dceddSDavid Howells  * in the command stream and shows up as the same context ID on the host.
168718dceddSDavid Howells  */
169718dceddSDavid Howells 
170718dceddSDavid Howells /*************************************************************************/
171718dceddSDavid Howells /**
172718dceddSDavid Howells  * DRM_VMW_CREATE_SURFACE - Create a host suface.
173718dceddSDavid Howells  *
174718dceddSDavid Howells  * Allocates a device unique surface id, and queues a create surface command
175718dceddSDavid Howells  * for the host. Does not wait for host completion. The surface ID can be
176718dceddSDavid Howells  * used directly in the command stream and shows up as the same surface
177718dceddSDavid Howells  * ID on the host.
178718dceddSDavid Howells  */
179718dceddSDavid Howells 
180718dceddSDavid Howells /**
181718dceddSDavid Howells  * struct drm_wmv_surface_create_req
182718dceddSDavid Howells  *
183718dceddSDavid Howells  * @flags: Surface flags as understood by the host.
184718dceddSDavid Howells  * @format: Surface format as understood by the host.
185718dceddSDavid Howells  * @mip_levels: Number of mip levels for each face.
186718dceddSDavid Howells  * An unused face should have 0 encoded.
187718dceddSDavid Howells  * @size_addr: Address of a user-space array of sruct drm_vmw_size
18821de2fdaSMikko Rapeli  * cast to an __u64 for 32-64 bit compatibility.
189718dceddSDavid Howells  * The size of the array should equal the total number of mipmap levels.
190718dceddSDavid Howells  * @shareable: Boolean whether other clients (as identified by file descriptors)
191718dceddSDavid Howells  * may reference this surface.
192718dceddSDavid Howells  * @scanout: Boolean whether the surface is intended to be used as a
193718dceddSDavid Howells  * scanout.
194718dceddSDavid Howells  *
195718dceddSDavid Howells  * Input data to the DRM_VMW_CREATE_SURFACE Ioctl.
196718dceddSDavid Howells  * Output data from the DRM_VMW_REF_SURFACE Ioctl.
197718dceddSDavid Howells  */
198718dceddSDavid Howells 
199718dceddSDavid Howells struct drm_vmw_surface_create_req {
20021de2fdaSMikko Rapeli 	__u32 flags;
20121de2fdaSMikko Rapeli 	__u32 format;
20221de2fdaSMikko Rapeli 	__u32 mip_levels[DRM_VMW_MAX_SURFACE_FACES];
20321de2fdaSMikko Rapeli 	__u64 size_addr;
20421de2fdaSMikko Rapeli 	__s32 shareable;
20521de2fdaSMikko Rapeli 	__s32 scanout;
206718dceddSDavid Howells };
207718dceddSDavid Howells 
208718dceddSDavid Howells /**
209718dceddSDavid Howells  * struct drm_wmv_surface_arg
210718dceddSDavid Howells  *
211718dceddSDavid Howells  * @sid: Surface id of created surface or surface to destroy or reference.
212adebcb20SThomas Hellstrom  * @handle_type: Handle type for DRM_VMW_REF_SURFACE Ioctl.
213718dceddSDavid Howells  *
214718dceddSDavid Howells  * Output data from the DRM_VMW_CREATE_SURFACE Ioctl.
215718dceddSDavid Howells  * Input argument to the DRM_VMW_UNREF_SURFACE Ioctl.
216718dceddSDavid Howells  * Input argument to the DRM_VMW_REF_SURFACE Ioctl.
217718dceddSDavid Howells  */
218718dceddSDavid Howells 
219718dceddSDavid Howells struct drm_vmw_surface_arg {
22021de2fdaSMikko Rapeli 	__s32 sid;
221adebcb20SThomas Hellstrom 	enum drm_vmw_handle_type handle_type;
222718dceddSDavid Howells };
223718dceddSDavid Howells 
224718dceddSDavid Howells /**
225718dceddSDavid Howells  * struct drm_vmw_size ioctl.
226718dceddSDavid Howells  *
227718dceddSDavid Howells  * @width - mip level width
228718dceddSDavid Howells  * @height - mip level height
229718dceddSDavid Howells  * @depth - mip level depth
230718dceddSDavid Howells  *
231718dceddSDavid Howells  * Description of a mip level.
232718dceddSDavid Howells  * Input data to the DRM_WMW_CREATE_SURFACE Ioctl.
233718dceddSDavid Howells  */
234718dceddSDavid Howells 
235718dceddSDavid Howells struct drm_vmw_size {
23621de2fdaSMikko Rapeli 	__u32 width;
23721de2fdaSMikko Rapeli 	__u32 height;
23821de2fdaSMikko Rapeli 	__u32 depth;
23921de2fdaSMikko Rapeli 	__u32 pad64;
240718dceddSDavid Howells };
241718dceddSDavid Howells 
242718dceddSDavid Howells /**
243718dceddSDavid Howells  * union drm_vmw_surface_create_arg
244718dceddSDavid Howells  *
245718dceddSDavid Howells  * @rep: Output data as described above.
246718dceddSDavid Howells  * @req: Input data as described above.
247718dceddSDavid Howells  *
248718dceddSDavid Howells  * Argument to the DRM_VMW_CREATE_SURFACE Ioctl.
249718dceddSDavid Howells  */
250718dceddSDavid Howells 
251718dceddSDavid Howells union drm_vmw_surface_create_arg {
252718dceddSDavid Howells 	struct drm_vmw_surface_arg rep;
253718dceddSDavid Howells 	struct drm_vmw_surface_create_req req;
254718dceddSDavid Howells };
255718dceddSDavid Howells 
256718dceddSDavid Howells /*************************************************************************/
257718dceddSDavid Howells /**
258718dceddSDavid Howells  * DRM_VMW_REF_SURFACE - Reference a host surface.
259718dceddSDavid Howells  *
260718dceddSDavid Howells  * Puts a reference on a host surface with a give sid, as previously
261718dceddSDavid Howells  * returned by the DRM_VMW_CREATE_SURFACE ioctl.
262718dceddSDavid Howells  * A reference will make sure the surface isn't destroyed while we hold
263718dceddSDavid Howells  * it and will allow the calling client to use the surface ID in the command
264718dceddSDavid Howells  * stream.
265718dceddSDavid Howells  *
266718dceddSDavid Howells  * On successful return, the Ioctl returns the surface information given
267718dceddSDavid Howells  * in the DRM_VMW_CREATE_SURFACE ioctl.
268718dceddSDavid Howells  */
269718dceddSDavid Howells 
270718dceddSDavid Howells /**
271718dceddSDavid Howells  * union drm_vmw_surface_reference_arg
272718dceddSDavid Howells  *
273718dceddSDavid Howells  * @rep: Output data as described above.
274718dceddSDavid Howells  * @req: Input data as described above.
275718dceddSDavid Howells  *
276718dceddSDavid Howells  * Argument to the DRM_VMW_REF_SURFACE Ioctl.
277718dceddSDavid Howells  */
278718dceddSDavid Howells 
279718dceddSDavid Howells union drm_vmw_surface_reference_arg {
280718dceddSDavid Howells 	struct drm_vmw_surface_create_req rep;
281718dceddSDavid Howells 	struct drm_vmw_surface_arg req;
282718dceddSDavid Howells };
283718dceddSDavid Howells 
284718dceddSDavid Howells /*************************************************************************/
285718dceddSDavid Howells /**
286718dceddSDavid Howells  * DRM_VMW_UNREF_SURFACE - Unreference a host surface.
287718dceddSDavid Howells  *
288718dceddSDavid Howells  * Clear a reference previously put on a host surface.
289718dceddSDavid Howells  * When all references are gone, including the one implicitly placed
290718dceddSDavid Howells  * on creation,
291718dceddSDavid Howells  * a destroy surface command will be queued for the host.
292718dceddSDavid Howells  * Does not wait for completion.
293718dceddSDavid Howells  */
294718dceddSDavid Howells 
295718dceddSDavid Howells /*************************************************************************/
296718dceddSDavid Howells /**
297718dceddSDavid Howells  * DRM_VMW_EXECBUF
298718dceddSDavid Howells  *
299718dceddSDavid Howells  * Submit a command buffer for execution on the host, and return a
300718dceddSDavid Howells  * fence seqno that when signaled, indicates that the command buffer has
301718dceddSDavid Howells  * executed.
302718dceddSDavid Howells  */
303718dceddSDavid Howells 
304718dceddSDavid Howells /**
305718dceddSDavid Howells  * struct drm_vmw_execbuf_arg
306718dceddSDavid Howells  *
30721de2fdaSMikko Rapeli  * @commands: User-space address of a command buffer cast to an __u64.
308718dceddSDavid Howells  * @command-size: Size in bytes of the command buffer.
309718dceddSDavid Howells  * @throttle-us: Sleep until software is less than @throttle_us
310718dceddSDavid Howells  * microseconds ahead of hardware. The driver may round this value
311718dceddSDavid Howells  * to the nearest kernel tick.
312718dceddSDavid Howells  * @fence_rep: User-space address of a struct drm_vmw_fence_rep cast to an
31321de2fdaSMikko Rapeli  * __u64.
314718dceddSDavid Howells  * @version: Allows expanding the execbuf ioctl parameters without breaking
315718dceddSDavid Howells  * backwards compatibility, since user-space will always tell the kernel
316718dceddSDavid Howells  * which version it uses.
3172cfa0bb2SSinclair Yeh  * @flags: Execbuf flags.
3182cfa0bb2SSinclair Yeh  * @imported_fence_fd:  FD for a fence imported from another device
319718dceddSDavid Howells  *
320718dceddSDavid Howells  * Argument to the DRM_VMW_EXECBUF Ioctl.
321718dceddSDavid Howells  */
322718dceddSDavid Howells 
323d80efd5cSThomas Hellstrom #define DRM_VMW_EXECBUF_VERSION 2
324718dceddSDavid Howells 
3252cfa0bb2SSinclair Yeh #define DRM_VMW_EXECBUF_FLAG_IMPORT_FENCE_FD (1 << 0)
3262cfa0bb2SSinclair Yeh #define DRM_VMW_EXECBUF_FLAG_EXPORT_FENCE_FD (1 << 1)
3272cfa0bb2SSinclair Yeh 
328718dceddSDavid Howells struct drm_vmw_execbuf_arg {
32921de2fdaSMikko Rapeli 	__u64 commands;
33021de2fdaSMikko Rapeli 	__u32 command_size;
33121de2fdaSMikko Rapeli 	__u32 throttle_us;
33221de2fdaSMikko Rapeli 	__u64 fence_rep;
33321de2fdaSMikko Rapeli 	__u32 version;
33421de2fdaSMikko Rapeli 	__u32 flags;
33521de2fdaSMikko Rapeli 	__u32 context_handle;
3362cfa0bb2SSinclair Yeh 	__s32 imported_fence_fd;
337718dceddSDavid Howells };
338718dceddSDavid Howells 
339718dceddSDavid Howells /**
340718dceddSDavid Howells  * struct drm_vmw_fence_rep
341718dceddSDavid Howells  *
342718dceddSDavid Howells  * @handle: Fence object handle for fence associated with a command submission.
343718dceddSDavid Howells  * @mask: Fence flags relevant for this fence object.
344718dceddSDavid Howells  * @seqno: Fence sequence number in fifo. A fence object with a lower
345718dceddSDavid Howells  * seqno will signal the EXEC flag before a fence object with a higher
346718dceddSDavid Howells  * seqno. This can be used by user-space to avoid kernel calls to determine
347718dceddSDavid Howells  * whether a fence has signaled the EXEC flag. Note that @seqno will
348718dceddSDavid Howells  * wrap at 32-bit.
349718dceddSDavid Howells  * @passed_seqno: The highest seqno number processed by the hardware
350718dceddSDavid Howells  * so far. This can be used to mark user-space fence objects as signaled, and
351718dceddSDavid Howells  * to determine whether a fence seqno might be stale.
3522cfa0bb2SSinclair Yeh  * @fd: FD associated with the fence, -1 if not exported
353718dceddSDavid Howells  * @error: This member should've been set to -EFAULT on submission.
354718dceddSDavid Howells  * The following actions should be take on completion:
355718dceddSDavid Howells  * error == -EFAULT: Fence communication failed. The host is synchronized.
356718dceddSDavid Howells  * Use the last fence id read from the FIFO fence register.
357718dceddSDavid Howells  * error != 0 && error != -EFAULT:
358718dceddSDavid Howells  * Fence submission failed. The host is synchronized. Use the fence_seq member.
359718dceddSDavid Howells  * error == 0: All is OK, The host may not be synchronized.
360718dceddSDavid Howells  * Use the fence_seq member.
361718dceddSDavid Howells  *
362718dceddSDavid Howells  * Input / Output data to the DRM_VMW_EXECBUF Ioctl.
363718dceddSDavid Howells  */
364718dceddSDavid Howells 
365718dceddSDavid Howells struct drm_vmw_fence_rep {
36621de2fdaSMikko Rapeli 	__u32 handle;
36721de2fdaSMikko Rapeli 	__u32 mask;
36821de2fdaSMikko Rapeli 	__u32 seqno;
36921de2fdaSMikko Rapeli 	__u32 passed_seqno;
3702cfa0bb2SSinclair Yeh 	__s32 fd;
37121de2fdaSMikko Rapeli 	__s32 error;
372718dceddSDavid Howells };
373718dceddSDavid Howells 
374718dceddSDavid Howells /*************************************************************************/
375718dceddSDavid Howells /**
376f1d34bfdSThomas Hellstrom  * DRM_VMW_ALLOC_BO
377718dceddSDavid Howells  *
378f1d34bfdSThomas Hellstrom  * Allocate a buffer object that is visible also to the host.
379718dceddSDavid Howells  * NOTE: The buffer is
380718dceddSDavid Howells  * identified by a handle and an offset, which are private to the guest, but
381718dceddSDavid Howells  * useable in the command stream. The guest kernel may translate these
382718dceddSDavid Howells  * and patch up the command stream accordingly. In the future, the offset may
383718dceddSDavid Howells  * be zero at all times, or it may disappear from the interface before it is
384718dceddSDavid Howells  * fixed.
385718dceddSDavid Howells  *
386f1d34bfdSThomas Hellstrom  * The buffer object may stay user-space mapped in the guest at all times,
387718dceddSDavid Howells  * and is thus suitable for sub-allocation.
388718dceddSDavid Howells  *
389f1d34bfdSThomas Hellstrom  * Buffer objects are mapped using the mmap() syscall on the drm device.
390718dceddSDavid Howells  */
391718dceddSDavid Howells 
392718dceddSDavid Howells /**
393f1d34bfdSThomas Hellstrom  * struct drm_vmw_alloc_bo_req
394718dceddSDavid Howells  *
395718dceddSDavid Howells  * @size: Required minimum size of the buffer.
396718dceddSDavid Howells  *
397f1d34bfdSThomas Hellstrom  * Input data to the DRM_VMW_ALLOC_BO Ioctl.
398718dceddSDavid Howells  */
399718dceddSDavid Howells 
400f1d34bfdSThomas Hellstrom struct drm_vmw_alloc_bo_req {
40121de2fdaSMikko Rapeli 	__u32 size;
40221de2fdaSMikko Rapeli 	__u32 pad64;
403718dceddSDavid Howells };
404f1d34bfdSThomas Hellstrom #define drm_vmw_alloc_dmabuf_req drm_vmw_alloc_bo_req
405718dceddSDavid Howells 
406718dceddSDavid Howells /**
407f1d34bfdSThomas Hellstrom  * struct drm_vmw_bo_rep
408718dceddSDavid Howells  *
409718dceddSDavid Howells  * @map_handle: Offset to use in the mmap() call used to map the buffer.
410718dceddSDavid Howells  * @handle: Handle unique to this buffer. Used for unreferencing.
411718dceddSDavid Howells  * @cur_gmr_id: GMR id to use in the command stream when this buffer is
412718dceddSDavid Howells  * referenced. See not above.
413718dceddSDavid Howells  * @cur_gmr_offset: Offset to use in the command stream when this buffer is
414718dceddSDavid Howells  * referenced. See note above.
415718dceddSDavid Howells  *
416f1d34bfdSThomas Hellstrom  * Output data from the DRM_VMW_ALLOC_BO Ioctl.
417718dceddSDavid Howells  */
418718dceddSDavid Howells 
419f1d34bfdSThomas Hellstrom struct drm_vmw_bo_rep {
42021de2fdaSMikko Rapeli 	__u64 map_handle;
42121de2fdaSMikko Rapeli 	__u32 handle;
42221de2fdaSMikko Rapeli 	__u32 cur_gmr_id;
42321de2fdaSMikko Rapeli 	__u32 cur_gmr_offset;
42421de2fdaSMikko Rapeli 	__u32 pad64;
425718dceddSDavid Howells };
426f1d34bfdSThomas Hellstrom #define drm_vmw_dmabuf_rep drm_vmw_bo_rep
427718dceddSDavid Howells 
428718dceddSDavid Howells /**
429f1d34bfdSThomas Hellstrom  * union drm_vmw_alloc_bo_arg
430718dceddSDavid Howells  *
431718dceddSDavid Howells  * @req: Input data as described above.
432718dceddSDavid Howells  * @rep: Output data as described above.
433718dceddSDavid Howells  *
434f1d34bfdSThomas Hellstrom  * Argument to the DRM_VMW_ALLOC_BO Ioctl.
435718dceddSDavid Howells  */
436718dceddSDavid Howells 
437f1d34bfdSThomas Hellstrom union drm_vmw_alloc_bo_arg {
438f1d34bfdSThomas Hellstrom 	struct drm_vmw_alloc_bo_req req;
439f1d34bfdSThomas Hellstrom 	struct drm_vmw_bo_rep rep;
440718dceddSDavid Howells };
441f1d34bfdSThomas Hellstrom #define drm_vmw_alloc_dmabuf_arg drm_vmw_alloc_bo_arg
442718dceddSDavid Howells 
443718dceddSDavid Howells /*************************************************************************/
444718dceddSDavid Howells /**
445718dceddSDavid Howells  * DRM_VMW_CONTROL_STREAM - Control overlays, aka streams.
446718dceddSDavid Howells  *
447718dceddSDavid Howells  * This IOCTL controls the overlay units of the svga device.
448718dceddSDavid Howells  * The SVGA overlay units does not work like regular hardware units in
449718dceddSDavid Howells  * that they do not automaticaly read back the contents of the given dma
450718dceddSDavid Howells  * buffer. But instead only read back for each call to this ioctl, and
451718dceddSDavid Howells  * at any point between this call being made and a following call that
452718dceddSDavid Howells  * either changes the buffer or disables the stream.
453718dceddSDavid Howells  */
454718dceddSDavid Howells 
455718dceddSDavid Howells /**
456718dceddSDavid Howells  * struct drm_vmw_rect
457718dceddSDavid Howells  *
458718dceddSDavid Howells  * Defines a rectangle. Used in the overlay ioctl to define
459718dceddSDavid Howells  * source and destination rectangle.
460718dceddSDavid Howells  */
461718dceddSDavid Howells 
462718dceddSDavid Howells struct drm_vmw_rect {
46321de2fdaSMikko Rapeli 	__s32 x;
46421de2fdaSMikko Rapeli 	__s32 y;
46521de2fdaSMikko Rapeli 	__u32 w;
46621de2fdaSMikko Rapeli 	__u32 h;
467718dceddSDavid Howells };
468718dceddSDavid Howells 
469718dceddSDavid Howells /**
470718dceddSDavid Howells  * struct drm_vmw_control_stream_arg
471718dceddSDavid Howells  *
472718dceddSDavid Howells  * @stream_id: Stearm to control
473718dceddSDavid Howells  * @enabled: If false all following arguments are ignored.
474718dceddSDavid Howells  * @handle: Handle to buffer for getting data from.
475718dceddSDavid Howells  * @format: Format of the overlay as understood by the host.
476718dceddSDavid Howells  * @width: Width of the overlay.
477718dceddSDavid Howells  * @height: Height of the overlay.
478718dceddSDavid Howells  * @size: Size of the overlay in bytes.
479718dceddSDavid Howells  * @pitch: Array of pitches, the two last are only used for YUV12 formats.
480718dceddSDavid Howells  * @offset: Offset from start of dma buffer to overlay.
481718dceddSDavid Howells  * @src: Source rect, must be within the defined area above.
482718dceddSDavid Howells  * @dst: Destination rect, x and y may be negative.
483718dceddSDavid Howells  *
484718dceddSDavid Howells  * Argument to the DRM_VMW_CONTROL_STREAM Ioctl.
485718dceddSDavid Howells  */
486718dceddSDavid Howells 
487718dceddSDavid Howells struct drm_vmw_control_stream_arg {
48821de2fdaSMikko Rapeli 	__u32 stream_id;
48921de2fdaSMikko Rapeli 	__u32 enabled;
490718dceddSDavid Howells 
49121de2fdaSMikko Rapeli 	__u32 flags;
49221de2fdaSMikko Rapeli 	__u32 color_key;
493718dceddSDavid Howells 
49421de2fdaSMikko Rapeli 	__u32 handle;
49521de2fdaSMikko Rapeli 	__u32 offset;
49621de2fdaSMikko Rapeli 	__s32 format;
49721de2fdaSMikko Rapeli 	__u32 size;
49821de2fdaSMikko Rapeli 	__u32 width;
49921de2fdaSMikko Rapeli 	__u32 height;
50021de2fdaSMikko Rapeli 	__u32 pitch[3];
501718dceddSDavid Howells 
50221de2fdaSMikko Rapeli 	__u32 pad64;
503718dceddSDavid Howells 	struct drm_vmw_rect src;
504718dceddSDavid Howells 	struct drm_vmw_rect dst;
505718dceddSDavid Howells };
506718dceddSDavid Howells 
507718dceddSDavid Howells /*************************************************************************/
508718dceddSDavid Howells /**
509718dceddSDavid Howells  * DRM_VMW_CURSOR_BYPASS - Give extra information about cursor bypass.
510718dceddSDavid Howells  *
511718dceddSDavid Howells  */
512718dceddSDavid Howells 
513718dceddSDavid Howells #define DRM_VMW_CURSOR_BYPASS_ALL    (1 << 0)
514718dceddSDavid Howells #define DRM_VMW_CURSOR_BYPASS_FLAGS       (1)
515718dceddSDavid Howells 
516718dceddSDavid Howells /**
517718dceddSDavid Howells  * struct drm_vmw_cursor_bypass_arg
518718dceddSDavid Howells  *
519718dceddSDavid Howells  * @flags: Flags.
520718dceddSDavid Howells  * @crtc_id: Crtc id, only used if DMR_CURSOR_BYPASS_ALL isn't passed.
521718dceddSDavid Howells  * @xpos: X position of cursor.
522718dceddSDavid Howells  * @ypos: Y position of cursor.
523718dceddSDavid Howells  * @xhot: X hotspot.
524718dceddSDavid Howells  * @yhot: Y hotspot.
525718dceddSDavid Howells  *
526718dceddSDavid Howells  * Argument to the DRM_VMW_CURSOR_BYPASS Ioctl.
527718dceddSDavid Howells  */
528718dceddSDavid Howells 
529718dceddSDavid Howells struct drm_vmw_cursor_bypass_arg {
53021de2fdaSMikko Rapeli 	__u32 flags;
53121de2fdaSMikko Rapeli 	__u32 crtc_id;
53221de2fdaSMikko Rapeli 	__s32 xpos;
53321de2fdaSMikko Rapeli 	__s32 ypos;
53421de2fdaSMikko Rapeli 	__s32 xhot;
53521de2fdaSMikko Rapeli 	__s32 yhot;
536718dceddSDavid Howells };
537718dceddSDavid Howells 
538718dceddSDavid Howells /*************************************************************************/
539718dceddSDavid Howells /**
540718dceddSDavid Howells  * DRM_VMW_CLAIM_STREAM - Claim a single stream.
541718dceddSDavid Howells  */
542718dceddSDavid Howells 
543718dceddSDavid Howells /**
544718dceddSDavid Howells  * struct drm_vmw_context_arg
545718dceddSDavid Howells  *
546718dceddSDavid Howells  * @stream_id: Device unique context ID.
547718dceddSDavid Howells  *
548718dceddSDavid Howells  * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
549718dceddSDavid Howells  * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
550718dceddSDavid Howells  */
551718dceddSDavid Howells 
552718dceddSDavid Howells struct drm_vmw_stream_arg {
55321de2fdaSMikko Rapeli 	__u32 stream_id;
55421de2fdaSMikko Rapeli 	__u32 pad64;
555718dceddSDavid Howells };
556718dceddSDavid Howells 
557718dceddSDavid Howells /*************************************************************************/
558718dceddSDavid Howells /**
559718dceddSDavid Howells  * DRM_VMW_UNREF_STREAM - Unclaim a stream.
560718dceddSDavid Howells  *
561718dceddSDavid Howells  * Return a single stream that was claimed by this process. Also makes
562718dceddSDavid Howells  * sure that the stream has been stopped.
563718dceddSDavid Howells  */
564718dceddSDavid Howells 
565718dceddSDavid Howells /*************************************************************************/
566718dceddSDavid Howells /**
567718dceddSDavid Howells  * DRM_VMW_GET_3D_CAP
568718dceddSDavid Howells  *
569718dceddSDavid Howells  * Read 3D capabilities from the FIFO
570718dceddSDavid Howells  *
571718dceddSDavid Howells  */
572718dceddSDavid Howells 
573718dceddSDavid Howells /**
574718dceddSDavid Howells  * struct drm_vmw_get_3d_cap_arg
575718dceddSDavid Howells  *
57621de2fdaSMikko Rapeli  * @buffer: Pointer to a buffer for capability data, cast to an __u64
577718dceddSDavid Howells  * @size: Max size to copy
578718dceddSDavid Howells  *
579718dceddSDavid Howells  * Input argument to the DRM_VMW_GET_3D_CAP_IOCTL
580718dceddSDavid Howells  * ioctls.
581718dceddSDavid Howells  */
582718dceddSDavid Howells 
583718dceddSDavid Howells struct drm_vmw_get_3d_cap_arg {
58421de2fdaSMikko Rapeli 	__u64 buffer;
58521de2fdaSMikko Rapeli 	__u32 max_size;
58621de2fdaSMikko Rapeli 	__u32 pad64;
587718dceddSDavid Howells };
588718dceddSDavid Howells 
589718dceddSDavid Howells /*************************************************************************/
590718dceddSDavid Howells /**
591718dceddSDavid Howells  * DRM_VMW_FENCE_WAIT
592718dceddSDavid Howells  *
593718dceddSDavid Howells  * Waits for a fence object to signal. The wait is interruptible, so that
594718dceddSDavid Howells  * signals may be delivered during the interrupt. The wait may timeout,
595718dceddSDavid Howells  * in which case the calls returns -EBUSY. If the wait is restarted,
596718dceddSDavid Howells  * that is restarting without resetting @cookie_valid to zero,
597718dceddSDavid Howells  * the timeout is computed from the first call.
598718dceddSDavid Howells  *
599718dceddSDavid Howells  * The flags argument to the DRM_VMW_FENCE_WAIT ioctl indicates what to wait
600718dceddSDavid Howells  * on:
601718dceddSDavid Howells  * DRM_VMW_FENCE_FLAG_EXEC: All commands ahead of the fence in the command
602718dceddSDavid Howells  * stream
603718dceddSDavid Howells  * have executed.
604718dceddSDavid Howells  * DRM_VMW_FENCE_FLAG_QUERY: All query results resulting from query finish
605718dceddSDavid Howells  * commands
606718dceddSDavid Howells  * in the buffer given to the EXECBUF ioctl returning the fence object handle
607718dceddSDavid Howells  * are available to user-space.
608718dceddSDavid Howells  *
609718dceddSDavid Howells  * DRM_VMW_WAIT_OPTION_UNREF: If this wait option is given, and the
610718dceddSDavid Howells  * fenc wait ioctl returns 0, the fence object has been unreferenced after
611718dceddSDavid Howells  * the wait.
612718dceddSDavid Howells  */
613718dceddSDavid Howells 
614718dceddSDavid Howells #define DRM_VMW_FENCE_FLAG_EXEC   (1 << 0)
615718dceddSDavid Howells #define DRM_VMW_FENCE_FLAG_QUERY  (1 << 1)
616718dceddSDavid Howells 
617718dceddSDavid Howells #define DRM_VMW_WAIT_OPTION_UNREF (1 << 0)
618718dceddSDavid Howells 
619718dceddSDavid Howells /**
620718dceddSDavid Howells  * struct drm_vmw_fence_wait_arg
621718dceddSDavid Howells  *
622718dceddSDavid Howells  * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
623718dceddSDavid Howells  * @cookie_valid: Must be reset to 0 on first call. Left alone on restart.
624718dceddSDavid Howells  * @kernel_cookie: Set to 0 on first call. Left alone on restart.
625718dceddSDavid Howells  * @timeout_us: Wait timeout in microseconds. 0 for indefinite timeout.
626718dceddSDavid Howells  * @lazy: Set to 1 if timing is not critical. Allow more than a kernel tick
627718dceddSDavid Howells  * before returning.
628718dceddSDavid Howells  * @flags: Fence flags to wait on.
629718dceddSDavid Howells  * @wait_options: Options that control the behaviour of the wait ioctl.
630718dceddSDavid Howells  *
631718dceddSDavid Howells  * Input argument to the DRM_VMW_FENCE_WAIT ioctl.
632718dceddSDavid Howells  */
633718dceddSDavid Howells 
634718dceddSDavid Howells struct drm_vmw_fence_wait_arg {
63521de2fdaSMikko Rapeli 	__u32 handle;
63621de2fdaSMikko Rapeli 	__s32  cookie_valid;
63721de2fdaSMikko Rapeli 	__u64 kernel_cookie;
63821de2fdaSMikko Rapeli 	__u64 timeout_us;
63921de2fdaSMikko Rapeli 	__s32 lazy;
64021de2fdaSMikko Rapeli 	__s32 flags;
64121de2fdaSMikko Rapeli 	__s32 wait_options;
64221de2fdaSMikko Rapeli 	__s32 pad64;
643718dceddSDavid Howells };
644718dceddSDavid Howells 
645718dceddSDavid Howells /*************************************************************************/
646718dceddSDavid Howells /**
647718dceddSDavid Howells  * DRM_VMW_FENCE_SIGNALED
648718dceddSDavid Howells  *
649718dceddSDavid Howells  * Checks if a fence object is signaled..
650718dceddSDavid Howells  */
651718dceddSDavid Howells 
652718dceddSDavid Howells /**
653718dceddSDavid Howells  * struct drm_vmw_fence_signaled_arg
654718dceddSDavid Howells  *
655718dceddSDavid Howells  * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
656718dceddSDavid Howells  * @flags: Fence object flags input to DRM_VMW_FENCE_SIGNALED ioctl
657718dceddSDavid Howells  * @signaled: Out: Flags signaled.
658718dceddSDavid Howells  * @sequence: Out: Highest sequence passed so far. Can be used to signal the
659718dceddSDavid Howells  * EXEC flag of user-space fence objects.
660718dceddSDavid Howells  *
661718dceddSDavid Howells  * Input/Output argument to the DRM_VMW_FENCE_SIGNALED and DRM_VMW_FENCE_UNREF
662718dceddSDavid Howells  * ioctls.
663718dceddSDavid Howells  */
664718dceddSDavid Howells 
665718dceddSDavid Howells struct drm_vmw_fence_signaled_arg {
66621de2fdaSMikko Rapeli 	 __u32 handle;
66721de2fdaSMikko Rapeli 	 __u32 flags;
66821de2fdaSMikko Rapeli 	 __s32 signaled;
66921de2fdaSMikko Rapeli 	 __u32 passed_seqno;
67021de2fdaSMikko Rapeli 	 __u32 signaled_flags;
67121de2fdaSMikko Rapeli 	 __u32 pad64;
672718dceddSDavid Howells };
673718dceddSDavid Howells 
674718dceddSDavid Howells /*************************************************************************/
675718dceddSDavid Howells /**
676718dceddSDavid Howells  * DRM_VMW_FENCE_UNREF
677718dceddSDavid Howells  *
678718dceddSDavid Howells  * Unreferences a fence object, and causes it to be destroyed if there are no
679718dceddSDavid Howells  * other references to it.
680718dceddSDavid Howells  *
681718dceddSDavid Howells  */
682718dceddSDavid Howells 
683718dceddSDavid Howells /**
684718dceddSDavid Howells  * struct drm_vmw_fence_arg
685718dceddSDavid Howells  *
686718dceddSDavid Howells  * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
687718dceddSDavid Howells  *
688718dceddSDavid Howells  * Input/Output argument to the DRM_VMW_FENCE_UNREF ioctl..
689718dceddSDavid Howells  */
690718dceddSDavid Howells 
691718dceddSDavid Howells struct drm_vmw_fence_arg {
69221de2fdaSMikko Rapeli 	 __u32 handle;
69321de2fdaSMikko Rapeli 	 __u32 pad64;
694718dceddSDavid Howells };
695718dceddSDavid Howells 
696718dceddSDavid Howells 
697718dceddSDavid Howells /*************************************************************************/
698718dceddSDavid Howells /**
699718dceddSDavid Howells  * DRM_VMW_FENCE_EVENT
700718dceddSDavid Howells  *
701718dceddSDavid Howells  * Queues an event on a fence to be delivered on the drm character device
702718dceddSDavid Howells  * when the fence has signaled the DRM_VMW_FENCE_FLAG_EXEC flag.
703718dceddSDavid Howells  * Optionally the approximate time when the fence signaled is
704718dceddSDavid Howells  * given by the event.
705718dceddSDavid Howells  */
706718dceddSDavid Howells 
707718dceddSDavid Howells /*
708718dceddSDavid Howells  * The event type
709718dceddSDavid Howells  */
710718dceddSDavid Howells #define DRM_VMW_EVENT_FENCE_SIGNALED 0x80000000
711718dceddSDavid Howells 
712718dceddSDavid Howells struct drm_vmw_event_fence {
713718dceddSDavid Howells 	struct drm_event base;
71421de2fdaSMikko Rapeli 	__u64 user_data;
71521de2fdaSMikko Rapeli 	__u32 tv_sec;
71621de2fdaSMikko Rapeli 	__u32 tv_usec;
717718dceddSDavid Howells };
718718dceddSDavid Howells 
719718dceddSDavid Howells /*
720718dceddSDavid Howells  * Flags that may be given to the command.
721718dceddSDavid Howells  */
722718dceddSDavid Howells /* Request fence signaled time on the event. */
723718dceddSDavid Howells #define DRM_VMW_FE_FLAG_REQ_TIME (1 << 0)
724718dceddSDavid Howells 
725718dceddSDavid Howells /**
726718dceddSDavid Howells  * struct drm_vmw_fence_event_arg
727718dceddSDavid Howells  *
72821de2fdaSMikko Rapeli  * @fence_rep: Pointer to fence_rep structure cast to __u64 or 0 if
729718dceddSDavid Howells  * the fence is not supposed to be referenced by user-space.
730718dceddSDavid Howells  * @user_info: Info to be delivered with the event.
731718dceddSDavid Howells  * @handle: Attach the event to this fence only.
732718dceddSDavid Howells  * @flags: A set of flags as defined above.
733718dceddSDavid Howells  */
734718dceddSDavid Howells struct drm_vmw_fence_event_arg {
73521de2fdaSMikko Rapeli 	__u64 fence_rep;
73621de2fdaSMikko Rapeli 	__u64 user_data;
73721de2fdaSMikko Rapeli 	__u32 handle;
73821de2fdaSMikko Rapeli 	__u32 flags;
739718dceddSDavid Howells };
740718dceddSDavid Howells 
741718dceddSDavid Howells 
742718dceddSDavid Howells /*************************************************************************/
743718dceddSDavid Howells /**
744718dceddSDavid Howells  * DRM_VMW_PRESENT
745718dceddSDavid Howells  *
746718dceddSDavid Howells  * Executes an SVGA present on a given fb for a given surface. The surface
747718dceddSDavid Howells  * is placed on the framebuffer. Cliprects are given relative to the given
748718dceddSDavid Howells  * point (the point disignated by dest_{x|y}).
749718dceddSDavid Howells  *
750718dceddSDavid Howells  */
751718dceddSDavid Howells 
752718dceddSDavid Howells /**
753718dceddSDavid Howells  * struct drm_vmw_present_arg
754718dceddSDavid Howells  * @fb_id: framebuffer id to present / read back from.
755718dceddSDavid Howells  * @sid: Surface id to present from.
756718dceddSDavid Howells  * @dest_x: X placement coordinate for surface.
757718dceddSDavid Howells  * @dest_y: Y placement coordinate for surface.
75821de2fdaSMikko Rapeli  * @clips_ptr: Pointer to an array of clip rects cast to an __u64.
759718dceddSDavid Howells  * @num_clips: Number of cliprects given relative to the framebuffer origin,
760718dceddSDavid Howells  * in the same coordinate space as the frame buffer.
761718dceddSDavid Howells  * @pad64: Unused 64-bit padding.
762718dceddSDavid Howells  *
763718dceddSDavid Howells  * Input argument to the DRM_VMW_PRESENT ioctl.
764718dceddSDavid Howells  */
765718dceddSDavid Howells 
766718dceddSDavid Howells struct drm_vmw_present_arg {
76721de2fdaSMikko Rapeli 	__u32 fb_id;
76821de2fdaSMikko Rapeli 	__u32 sid;
76921de2fdaSMikko Rapeli 	__s32 dest_x;
77021de2fdaSMikko Rapeli 	__s32 dest_y;
77121de2fdaSMikko Rapeli 	__u64 clips_ptr;
77221de2fdaSMikko Rapeli 	__u32 num_clips;
77321de2fdaSMikko Rapeli 	__u32 pad64;
774718dceddSDavid Howells };
775718dceddSDavid Howells 
776718dceddSDavid Howells 
777718dceddSDavid Howells /*************************************************************************/
778718dceddSDavid Howells /**
779718dceddSDavid Howells  * DRM_VMW_PRESENT_READBACK
780718dceddSDavid Howells  *
781718dceddSDavid Howells  * Executes an SVGA present readback from a given fb to the dma buffer
782718dceddSDavid Howells  * currently bound as the fb. If there is no dma buffer bound to the fb,
783718dceddSDavid Howells  * an error will be returned.
784718dceddSDavid Howells  *
785718dceddSDavid Howells  */
786718dceddSDavid Howells 
787718dceddSDavid Howells /**
788718dceddSDavid Howells  * struct drm_vmw_present_arg
789718dceddSDavid Howells  * @fb_id: fb_id to present / read back from.
790718dceddSDavid Howells  * @num_clips: Number of cliprects.
79121de2fdaSMikko Rapeli  * @clips_ptr: Pointer to an array of clip rects cast to an __u64.
79221de2fdaSMikko Rapeli  * @fence_rep: Pointer to a struct drm_vmw_fence_rep, cast to an __u64.
793718dceddSDavid Howells  * If this member is NULL, then the ioctl should not return a fence.
794718dceddSDavid Howells  */
795718dceddSDavid Howells 
796718dceddSDavid Howells struct drm_vmw_present_readback_arg {
79721de2fdaSMikko Rapeli 	 __u32 fb_id;
79821de2fdaSMikko Rapeli 	 __u32 num_clips;
79921de2fdaSMikko Rapeli 	 __u64 clips_ptr;
80021de2fdaSMikko Rapeli 	 __u64 fence_rep;
801718dceddSDavid Howells };
802718dceddSDavid Howells 
803718dceddSDavid Howells /*************************************************************************/
804718dceddSDavid Howells /**
805718dceddSDavid Howells  * DRM_VMW_UPDATE_LAYOUT - Update layout
806718dceddSDavid Howells  *
807718dceddSDavid Howells  * Updates the preferred modes and connection status for connectors. The
808718dceddSDavid Howells  * command consists of one drm_vmw_update_layout_arg pointing to an array
809718dceddSDavid Howells  * of num_outputs drm_vmw_rect's.
810718dceddSDavid Howells  */
811718dceddSDavid Howells 
812718dceddSDavid Howells /**
813718dceddSDavid Howells  * struct drm_vmw_update_layout_arg
814718dceddSDavid Howells  *
815718dceddSDavid Howells  * @num_outputs: number of active connectors
81621de2fdaSMikko Rapeli  * @rects: pointer to array of drm_vmw_rect cast to an __u64
817718dceddSDavid Howells  *
818718dceddSDavid Howells  * Input argument to the DRM_VMW_UPDATE_LAYOUT Ioctl.
819718dceddSDavid Howells  */
820718dceddSDavid Howells struct drm_vmw_update_layout_arg {
82121de2fdaSMikko Rapeli 	__u32 num_outputs;
82221de2fdaSMikko Rapeli 	__u32 pad64;
82321de2fdaSMikko Rapeli 	__u64 rects;
824718dceddSDavid Howells };
825718dceddSDavid Howells 
826cfe4d53eSThomas Hellstrom 
827cfe4d53eSThomas Hellstrom /*************************************************************************/
828cfe4d53eSThomas Hellstrom /**
829cfe4d53eSThomas Hellstrom  * DRM_VMW_CREATE_SHADER - Create shader
830cfe4d53eSThomas Hellstrom  *
831cfe4d53eSThomas Hellstrom  * Creates a shader and optionally binds it to a dma buffer containing
832cfe4d53eSThomas Hellstrom  * the shader byte-code.
833cfe4d53eSThomas Hellstrom  */
834cfe4d53eSThomas Hellstrom 
835cfe4d53eSThomas Hellstrom /**
836cfe4d53eSThomas Hellstrom  * enum drm_vmw_shader_type - Shader types
837cfe4d53eSThomas Hellstrom  */
838cfe4d53eSThomas Hellstrom enum drm_vmw_shader_type {
839cfe4d53eSThomas Hellstrom 	drm_vmw_shader_type_vs = 0,
840cfe4d53eSThomas Hellstrom 	drm_vmw_shader_type_ps,
841cfe4d53eSThomas Hellstrom };
842cfe4d53eSThomas Hellstrom 
843cfe4d53eSThomas Hellstrom 
844cfe4d53eSThomas Hellstrom /**
845cfe4d53eSThomas Hellstrom  * struct drm_vmw_shader_create_arg
846cfe4d53eSThomas Hellstrom  *
847cfe4d53eSThomas Hellstrom  * @shader_type: Shader type of the shader to create.
848cfe4d53eSThomas Hellstrom  * @size: Size of the byte-code in bytes.
849cfe4d53eSThomas Hellstrom  * where the shader byte-code starts
850cfe4d53eSThomas Hellstrom  * @buffer_handle: Buffer handle identifying the buffer containing the
851cfe4d53eSThomas Hellstrom  * shader byte-code
852cfe4d53eSThomas Hellstrom  * @shader_handle: On successful completion contains a handle that
853cfe4d53eSThomas Hellstrom  * can be used to subsequently identify the shader.
854cfe4d53eSThomas Hellstrom  * @offset: Offset in bytes into the buffer given by @buffer_handle,
855cfe4d53eSThomas Hellstrom  *
856cfe4d53eSThomas Hellstrom  * Input / Output argument to the DRM_VMW_CREATE_SHADER Ioctl.
857cfe4d53eSThomas Hellstrom  */
858cfe4d53eSThomas Hellstrom struct drm_vmw_shader_create_arg {
859cfe4d53eSThomas Hellstrom 	enum drm_vmw_shader_type shader_type;
86021de2fdaSMikko Rapeli 	__u32 size;
86121de2fdaSMikko Rapeli 	__u32 buffer_handle;
86221de2fdaSMikko Rapeli 	__u32 shader_handle;
86321de2fdaSMikko Rapeli 	__u64 offset;
864cfe4d53eSThomas Hellstrom };
865cfe4d53eSThomas Hellstrom 
866cfe4d53eSThomas Hellstrom /*************************************************************************/
867cfe4d53eSThomas Hellstrom /**
868cfe4d53eSThomas Hellstrom  * DRM_VMW_UNREF_SHADER - Unreferences a shader
869cfe4d53eSThomas Hellstrom  *
870cfe4d53eSThomas Hellstrom  * Destroys a user-space reference to a shader, optionally destroying
871cfe4d53eSThomas Hellstrom  * it.
872cfe4d53eSThomas Hellstrom  */
873cfe4d53eSThomas Hellstrom 
874cfe4d53eSThomas Hellstrom /**
875cfe4d53eSThomas Hellstrom  * struct drm_vmw_shader_arg
876cfe4d53eSThomas Hellstrom  *
877cfe4d53eSThomas Hellstrom  * @handle: Handle identifying the shader to destroy.
878cfe4d53eSThomas Hellstrom  *
879cfe4d53eSThomas Hellstrom  * Input argument to the DRM_VMW_UNREF_SHADER ioctl.
880cfe4d53eSThomas Hellstrom  */
881cfe4d53eSThomas Hellstrom struct drm_vmw_shader_arg {
88221de2fdaSMikko Rapeli 	__u32 handle;
88321de2fdaSMikko Rapeli 	__u32 pad64;
884cfe4d53eSThomas Hellstrom };
885cfe4d53eSThomas Hellstrom 
886cfe4d53eSThomas Hellstrom /*************************************************************************/
887cfe4d53eSThomas Hellstrom /**
888cfe4d53eSThomas Hellstrom  * DRM_VMW_GB_SURFACE_CREATE - Create a host guest-backed surface.
889cfe4d53eSThomas Hellstrom  *
890cfe4d53eSThomas Hellstrom  * Allocates a surface handle and queues a create surface command
891cfe4d53eSThomas Hellstrom  * for the host on the first use of the surface. The surface ID can
892cfe4d53eSThomas Hellstrom  * be used as the surface ID in commands referencing the surface.
893cfe4d53eSThomas Hellstrom  */
894cfe4d53eSThomas Hellstrom 
895cfe4d53eSThomas Hellstrom /**
896cfe4d53eSThomas Hellstrom  * enum drm_vmw_surface_flags
897cfe4d53eSThomas Hellstrom  *
898cfe4d53eSThomas Hellstrom  * @drm_vmw_surface_flag_shareable:     Whether the surface is shareable
899cfe4d53eSThomas Hellstrom  * @drm_vmw_surface_flag_scanout:       Whether the surface is a scanout
900cfe4d53eSThomas Hellstrom  *                                      surface.
901cfe4d53eSThomas Hellstrom  * @drm_vmw_surface_flag_create_buffer: Create a backup buffer if none is
902cfe4d53eSThomas Hellstrom  *                                      given.
9039ca7d19fSThomas Hellstrom  * @drm_vmw_surface_flag_coherent:      Back surface with coherent memory.
904cfe4d53eSThomas Hellstrom  */
905cfe4d53eSThomas Hellstrom enum drm_vmw_surface_flags {
906cfe4d53eSThomas Hellstrom 	drm_vmw_surface_flag_shareable = (1 << 0),
907cfe4d53eSThomas Hellstrom 	drm_vmw_surface_flag_scanout = (1 << 1),
9089ca7d19fSThomas Hellstrom 	drm_vmw_surface_flag_create_buffer = (1 << 2),
9099ca7d19fSThomas Hellstrom 	drm_vmw_surface_flag_coherent = (1 << 3),
910cfe4d53eSThomas Hellstrom };
911cfe4d53eSThomas Hellstrom 
912cfe4d53eSThomas Hellstrom /**
913cfe4d53eSThomas Hellstrom  * struct drm_vmw_gb_surface_create_req
914cfe4d53eSThomas Hellstrom  *
915cfe4d53eSThomas Hellstrom  * @svga3d_flags:     SVGA3d surface flags for the device.
916cfe4d53eSThomas Hellstrom  * @format:           SVGA3d format.
917cfe4d53eSThomas Hellstrom  * @mip_level:        Number of mip levels for all faces.
918cfe4d53eSThomas Hellstrom  * @drm_surface_flags Flags as described above.
91915c6f656SZack Rusin  * @multisample_count Future use. Set to 0.
920cfe4d53eSThomas Hellstrom  * @autogen_filter    Future use. Set to 0.
921cfe4d53eSThomas Hellstrom  * @buffer_handle     Buffer handle of backup buffer. SVGA3D_INVALID_ID
922cfe4d53eSThomas Hellstrom  *                    if none.
923cfe4d53eSThomas Hellstrom  * @base_size         Size of the base mip level for all faces.
924d80efd5cSThomas Hellstrom  * @array_size        Must be zero for non-DX hardware, and if non-zero
925d80efd5cSThomas Hellstrom  *                    svga3d_flags must have proper bind flags setup.
926cfe4d53eSThomas Hellstrom  *
927cfe4d53eSThomas Hellstrom  * Input argument to the  DRM_VMW_GB_SURFACE_CREATE Ioctl.
928cfe4d53eSThomas Hellstrom  * Part of output argument for the DRM_VMW_GB_SURFACE_REF Ioctl.
929cfe4d53eSThomas Hellstrom  */
930cfe4d53eSThomas Hellstrom struct drm_vmw_gb_surface_create_req {
93121de2fdaSMikko Rapeli 	__u32 svga3d_flags;
93221de2fdaSMikko Rapeli 	__u32 format;
93321de2fdaSMikko Rapeli 	__u32 mip_levels;
934cfe4d53eSThomas Hellstrom 	enum drm_vmw_surface_flags drm_surface_flags;
93521de2fdaSMikko Rapeli 	__u32 multisample_count;
93621de2fdaSMikko Rapeli 	__u32 autogen_filter;
93721de2fdaSMikko Rapeli 	__u32 buffer_handle;
93821de2fdaSMikko Rapeli 	__u32 array_size;
939cfe4d53eSThomas Hellstrom 	struct drm_vmw_size base_size;
940cfe4d53eSThomas Hellstrom };
941cfe4d53eSThomas Hellstrom 
942cfe4d53eSThomas Hellstrom /**
943cfe4d53eSThomas Hellstrom  * struct drm_vmw_gb_surface_create_rep
944cfe4d53eSThomas Hellstrom  *
945cfe4d53eSThomas Hellstrom  * @handle:            Surface handle.
946cfe4d53eSThomas Hellstrom  * @backup_size:       Size of backup buffers for this surface.
947cfe4d53eSThomas Hellstrom  * @buffer_handle:     Handle of backup buffer. SVGA3D_INVALID_ID if none.
948cfe4d53eSThomas Hellstrom  * @buffer_size:       Actual size of the buffer identified by
949cfe4d53eSThomas Hellstrom  *                     @buffer_handle
950cfe4d53eSThomas Hellstrom  * @buffer_map_handle: Offset into device address space for the buffer
951cfe4d53eSThomas Hellstrom  *                     identified by @buffer_handle.
952cfe4d53eSThomas Hellstrom  *
953cfe4d53eSThomas Hellstrom  * Part of output argument for the DRM_VMW_GB_SURFACE_REF ioctl.
954cfe4d53eSThomas Hellstrom  * Output argument for the DRM_VMW_GB_SURFACE_CREATE ioctl.
955cfe4d53eSThomas Hellstrom  */
956cfe4d53eSThomas Hellstrom struct drm_vmw_gb_surface_create_rep {
95721de2fdaSMikko Rapeli 	__u32 handle;
95821de2fdaSMikko Rapeli 	__u32 backup_size;
95921de2fdaSMikko Rapeli 	__u32 buffer_handle;
96021de2fdaSMikko Rapeli 	__u32 buffer_size;
96121de2fdaSMikko Rapeli 	__u64 buffer_map_handle;
962cfe4d53eSThomas Hellstrom };
963cfe4d53eSThomas Hellstrom 
964cfe4d53eSThomas Hellstrom /**
965cfe4d53eSThomas Hellstrom  * union drm_vmw_gb_surface_create_arg
966cfe4d53eSThomas Hellstrom  *
967cfe4d53eSThomas Hellstrom  * @req: Input argument as described above.
968cfe4d53eSThomas Hellstrom  * @rep: Output argument as described above.
969cfe4d53eSThomas Hellstrom  *
970cfe4d53eSThomas Hellstrom  * Argument to the DRM_VMW_GB_SURFACE_CREATE ioctl.
971cfe4d53eSThomas Hellstrom  */
972cfe4d53eSThomas Hellstrom union drm_vmw_gb_surface_create_arg {
973cfe4d53eSThomas Hellstrom 	struct drm_vmw_gb_surface_create_rep rep;
974cfe4d53eSThomas Hellstrom 	struct drm_vmw_gb_surface_create_req req;
975cfe4d53eSThomas Hellstrom };
976cfe4d53eSThomas Hellstrom 
977cfe4d53eSThomas Hellstrom /*************************************************************************/
978cfe4d53eSThomas Hellstrom /**
979cfe4d53eSThomas Hellstrom  * DRM_VMW_GB_SURFACE_REF - Reference a host surface.
980cfe4d53eSThomas Hellstrom  *
981cfe4d53eSThomas Hellstrom  * Puts a reference on a host surface with a given handle, as previously
982cfe4d53eSThomas Hellstrom  * returned by the DRM_VMW_GB_SURFACE_CREATE ioctl.
983cfe4d53eSThomas Hellstrom  * A reference will make sure the surface isn't destroyed while we hold
984cfe4d53eSThomas Hellstrom  * it and will allow the calling client to use the surface handle in
985cfe4d53eSThomas Hellstrom  * the command stream.
986cfe4d53eSThomas Hellstrom  *
987cfe4d53eSThomas Hellstrom  * On successful return, the Ioctl returns the surface information given
988cfe4d53eSThomas Hellstrom  * to and returned from the DRM_VMW_GB_SURFACE_CREATE ioctl.
989cfe4d53eSThomas Hellstrom  */
990cfe4d53eSThomas Hellstrom 
991cfe4d53eSThomas Hellstrom /**
992cfe4d53eSThomas Hellstrom  * struct drm_vmw_gb_surface_reference_arg
993cfe4d53eSThomas Hellstrom  *
994cfe4d53eSThomas Hellstrom  * @creq: The data used as input when the surface was created, as described
995cfe4d53eSThomas Hellstrom  *        above at "struct drm_vmw_gb_surface_create_req"
996cfe4d53eSThomas Hellstrom  * @crep: Additional data output when the surface was created, as described
997cfe4d53eSThomas Hellstrom  *        above at "struct drm_vmw_gb_surface_create_rep"
998cfe4d53eSThomas Hellstrom  *
999cfe4d53eSThomas Hellstrom  * Output Argument to the DRM_VMW_GB_SURFACE_REF ioctl.
1000cfe4d53eSThomas Hellstrom  */
1001cfe4d53eSThomas Hellstrom struct drm_vmw_gb_surface_ref_rep {
1002cfe4d53eSThomas Hellstrom 	struct drm_vmw_gb_surface_create_req creq;
1003cfe4d53eSThomas Hellstrom 	struct drm_vmw_gb_surface_create_rep crep;
1004cfe4d53eSThomas Hellstrom };
1005cfe4d53eSThomas Hellstrom 
1006cfe4d53eSThomas Hellstrom /**
1007cfe4d53eSThomas Hellstrom  * union drm_vmw_gb_surface_reference_arg
1008cfe4d53eSThomas Hellstrom  *
1009cfe4d53eSThomas Hellstrom  * @req: Input data as described above at "struct drm_vmw_surface_arg"
1010cfe4d53eSThomas Hellstrom  * @rep: Output data as described above at "struct drm_vmw_gb_surface_ref_rep"
1011cfe4d53eSThomas Hellstrom  *
1012cfe4d53eSThomas Hellstrom  * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl.
1013cfe4d53eSThomas Hellstrom  */
1014cfe4d53eSThomas Hellstrom union drm_vmw_gb_surface_reference_arg {
1015cfe4d53eSThomas Hellstrom 	struct drm_vmw_gb_surface_ref_rep rep;
1016cfe4d53eSThomas Hellstrom 	struct drm_vmw_surface_arg req;
1017cfe4d53eSThomas Hellstrom };
1018cfe4d53eSThomas Hellstrom 
1019cfe4d53eSThomas Hellstrom 
10201d7a5cbfSThomas Hellstrom /*************************************************************************/
10211d7a5cbfSThomas Hellstrom /**
10221d7a5cbfSThomas Hellstrom  * DRM_VMW_SYNCCPU - Sync a DMA buffer / MOB for CPU access.
10231d7a5cbfSThomas Hellstrom  *
10241d7a5cbfSThomas Hellstrom  * Idles any previously submitted GPU operations on the buffer and
10251d7a5cbfSThomas Hellstrom  * by default blocks command submissions that reference the buffer.
10261d7a5cbfSThomas Hellstrom  * If the file descriptor used to grab a blocking CPU sync is closed, the
10271d7a5cbfSThomas Hellstrom  * cpu sync is released.
10281d7a5cbfSThomas Hellstrom  * The flags argument indicates how the grab / release operation should be
10291d7a5cbfSThomas Hellstrom  * performed:
10301d7a5cbfSThomas Hellstrom  */
10311d7a5cbfSThomas Hellstrom 
10321d7a5cbfSThomas Hellstrom /**
10331d7a5cbfSThomas Hellstrom  * enum drm_vmw_synccpu_flags - Synccpu flags:
10341d7a5cbfSThomas Hellstrom  *
10351d7a5cbfSThomas Hellstrom  * @drm_vmw_synccpu_read: Sync for read. If sync is done for read only, it's a
10361d7a5cbfSThomas Hellstrom  * hint to the kernel to allow command submissions that references the buffer
10371d7a5cbfSThomas Hellstrom  * for read-only.
10381d7a5cbfSThomas Hellstrom  * @drm_vmw_synccpu_write: Sync for write. Block all command submissions
10391d7a5cbfSThomas Hellstrom  * referencing this buffer.
10401d7a5cbfSThomas Hellstrom  * @drm_vmw_synccpu_dontblock: Dont wait for GPU idle, but rather return
10411d7a5cbfSThomas Hellstrom  * -EBUSY should the buffer be busy.
10421d7a5cbfSThomas Hellstrom  * @drm_vmw_synccpu_allow_cs: Allow command submission that touches the buffer
10431d7a5cbfSThomas Hellstrom  * while the buffer is synced for CPU. This is similar to the GEM bo idle
10441d7a5cbfSThomas Hellstrom  * behavior.
10451d7a5cbfSThomas Hellstrom  */
10461d7a5cbfSThomas Hellstrom enum drm_vmw_synccpu_flags {
10471d7a5cbfSThomas Hellstrom 	drm_vmw_synccpu_read = (1 << 0),
10481d7a5cbfSThomas Hellstrom 	drm_vmw_synccpu_write = (1 << 1),
10491d7a5cbfSThomas Hellstrom 	drm_vmw_synccpu_dontblock = (1 << 2),
10501d7a5cbfSThomas Hellstrom 	drm_vmw_synccpu_allow_cs = (1 << 3)
10511d7a5cbfSThomas Hellstrom };
10521d7a5cbfSThomas Hellstrom 
10531d7a5cbfSThomas Hellstrom /**
10541d7a5cbfSThomas Hellstrom  * enum drm_vmw_synccpu_op - Synccpu operations:
10551d7a5cbfSThomas Hellstrom  *
10561d7a5cbfSThomas Hellstrom  * @drm_vmw_synccpu_grab:    Grab the buffer for CPU operations
10571d7a5cbfSThomas Hellstrom  * @drm_vmw_synccpu_release: Release a previous grab.
10581d7a5cbfSThomas Hellstrom  */
10591d7a5cbfSThomas Hellstrom enum drm_vmw_synccpu_op {
10601d7a5cbfSThomas Hellstrom 	drm_vmw_synccpu_grab,
10611d7a5cbfSThomas Hellstrom 	drm_vmw_synccpu_release
10621d7a5cbfSThomas Hellstrom };
10631d7a5cbfSThomas Hellstrom 
10641d7a5cbfSThomas Hellstrom /**
10651d7a5cbfSThomas Hellstrom  * struct drm_vmw_synccpu_arg
10661d7a5cbfSThomas Hellstrom  *
10671d7a5cbfSThomas Hellstrom  * @op:			     The synccpu operation as described above.
10681d7a5cbfSThomas Hellstrom  * @handle:		     Handle identifying the buffer object.
10691d7a5cbfSThomas Hellstrom  * @flags:		     Flags as described above.
10701d7a5cbfSThomas Hellstrom  */
10711d7a5cbfSThomas Hellstrom struct drm_vmw_synccpu_arg {
10721d7a5cbfSThomas Hellstrom 	enum drm_vmw_synccpu_op op;
10731d7a5cbfSThomas Hellstrom 	enum drm_vmw_synccpu_flags flags;
107421de2fdaSMikko Rapeli 	__u32 handle;
107521de2fdaSMikko Rapeli 	__u32 pad64;
10761d7a5cbfSThomas Hellstrom };
1077cfe4d53eSThomas Hellstrom 
1078d80efd5cSThomas Hellstrom /*************************************************************************/
1079d80efd5cSThomas Hellstrom /**
1080d80efd5cSThomas Hellstrom  * DRM_VMW_CREATE_EXTENDED_CONTEXT - Create a host context.
1081d80efd5cSThomas Hellstrom  *
1082d80efd5cSThomas Hellstrom  * Allocates a device unique context id, and queues a create context command
1083d80efd5cSThomas Hellstrom  * for the host. Does not wait for host completion.
1084d80efd5cSThomas Hellstrom  */
1085d80efd5cSThomas Hellstrom enum drm_vmw_extended_context {
1086d80efd5cSThomas Hellstrom 	drm_vmw_context_legacy,
1087d80efd5cSThomas Hellstrom 	drm_vmw_context_dx
1088d80efd5cSThomas Hellstrom };
1089d80efd5cSThomas Hellstrom 
1090d80efd5cSThomas Hellstrom /**
1091d80efd5cSThomas Hellstrom  * union drm_vmw_extended_context_arg
1092d80efd5cSThomas Hellstrom  *
1093d80efd5cSThomas Hellstrom  * @req: Context type.
1094d80efd5cSThomas Hellstrom  * @rep: Context identifier.
1095d80efd5cSThomas Hellstrom  *
1096d80efd5cSThomas Hellstrom  * Argument to the DRM_VMW_CREATE_EXTENDED_CONTEXT Ioctl.
1097d80efd5cSThomas Hellstrom  */
1098d80efd5cSThomas Hellstrom union drm_vmw_extended_context_arg {
1099d80efd5cSThomas Hellstrom 	enum drm_vmw_extended_context req;
1100d80efd5cSThomas Hellstrom 	struct drm_vmw_context_arg rep;
1101d80efd5cSThomas Hellstrom };
1102d3450e00SEmil Velikov 
11032f9545ceSThomas Hellstrom /*************************************************************************/
11042f9545ceSThomas Hellstrom /*
11052f9545ceSThomas Hellstrom  * DRM_VMW_HANDLE_CLOSE - Close a user-space handle and release its
11062f9545ceSThomas Hellstrom  * underlying resource.
11072f9545ceSThomas Hellstrom  *
1108f1d34bfdSThomas Hellstrom  * Note that this ioctl is overlaid on the deprecated DRM_VMW_UNREF_DMABUF
1109f1d34bfdSThomas Hellstrom  * Ioctl.
11102f9545ceSThomas Hellstrom  */
11112f9545ceSThomas Hellstrom 
11122f9545ceSThomas Hellstrom /**
11132f9545ceSThomas Hellstrom  * struct drm_vmw_handle_close_arg
11142f9545ceSThomas Hellstrom  *
11152f9545ceSThomas Hellstrom  * @handle: Handle to close.
11162f9545ceSThomas Hellstrom  *
11172f9545ceSThomas Hellstrom  * Argument to the DRM_VMW_HANDLE_CLOSE Ioctl.
11182f9545ceSThomas Hellstrom  */
11192f9545ceSThomas Hellstrom struct drm_vmw_handle_close_arg {
11202f9545ceSThomas Hellstrom 	__u32 handle;
11212f9545ceSThomas Hellstrom 	__u32 pad64;
11222f9545ceSThomas Hellstrom };
1123f1d34bfdSThomas Hellstrom #define drm_vmw_unref_dmabuf_arg drm_vmw_handle_close_arg
11242f9545ceSThomas Hellstrom 
112514b1c33eSDeepak Rawat /*************************************************************************/
112614b1c33eSDeepak Rawat /**
112714b1c33eSDeepak Rawat  * DRM_VMW_GB_SURFACE_CREATE_EXT - Create a host guest-backed surface.
112814b1c33eSDeepak Rawat  *
112914b1c33eSDeepak Rawat  * Allocates a surface handle and queues a create surface command
113014b1c33eSDeepak Rawat  * for the host on the first use of the surface. The surface ID can
113114b1c33eSDeepak Rawat  * be used as the surface ID in commands referencing the surface.
113214b1c33eSDeepak Rawat  *
113314b1c33eSDeepak Rawat  * This new command extends DRM_VMW_GB_SURFACE_CREATE by adding version
113414b1c33eSDeepak Rawat  * parameter and 64 bit svga flag.
113514b1c33eSDeepak Rawat  */
113614b1c33eSDeepak Rawat 
113714b1c33eSDeepak Rawat /**
113814b1c33eSDeepak Rawat  * enum drm_vmw_surface_version
113914b1c33eSDeepak Rawat  *
114014b1c33eSDeepak Rawat  * @drm_vmw_surface_gb_v1: Corresponds to current gb surface format with
114114b1c33eSDeepak Rawat  * svga3d surface flags split into 2, upper half and lower half.
114214b1c33eSDeepak Rawat  */
114314b1c33eSDeepak Rawat enum drm_vmw_surface_version {
11442a50f06dSDeepak Rawat 	drm_vmw_gb_surface_v1,
114514b1c33eSDeepak Rawat };
114614b1c33eSDeepak Rawat 
114714b1c33eSDeepak Rawat /**
114814b1c33eSDeepak Rawat  * struct drm_vmw_gb_surface_create_ext_req
114914b1c33eSDeepak Rawat  *
115014b1c33eSDeepak Rawat  * @base: Surface create parameters.
115114b1c33eSDeepak Rawat  * @version: Version of surface create ioctl.
115214b1c33eSDeepak Rawat  * @svga3d_flags_upper_32_bits: Upper 32 bits of svga3d flags.
115314b1c33eSDeepak Rawat  * @multisample_pattern: Multisampling pattern when msaa is supported.
115414b1c33eSDeepak Rawat  * @quality_level: Precision settings for each sample.
11552a50f06dSDeepak Rawat  * @buffer_byte_stride: Buffer byte stride.
115614b1c33eSDeepak Rawat  * @must_be_zero: Reserved for future usage.
115714b1c33eSDeepak Rawat  *
115814b1c33eSDeepak Rawat  * Input argument to the  DRM_VMW_GB_SURFACE_CREATE_EXT Ioctl.
115914b1c33eSDeepak Rawat  * Part of output argument for the DRM_VMW_GB_SURFACE_REF_EXT Ioctl.
116014b1c33eSDeepak Rawat  */
116114b1c33eSDeepak Rawat struct drm_vmw_gb_surface_create_ext_req {
116214b1c33eSDeepak Rawat 	struct drm_vmw_gb_surface_create_req base;
116314b1c33eSDeepak Rawat 	enum drm_vmw_surface_version version;
11642a50f06dSDeepak Rawat 	__u32 svga3d_flags_upper_32_bits;
11652a50f06dSDeepak Rawat 	__u32 multisample_pattern;
11662a50f06dSDeepak Rawat 	__u32 quality_level;
11672a50f06dSDeepak Rawat 	__u32 buffer_byte_stride;
11682a50f06dSDeepak Rawat 	__u32 must_be_zero;
116914b1c33eSDeepak Rawat };
117014b1c33eSDeepak Rawat 
117114b1c33eSDeepak Rawat /**
117214b1c33eSDeepak Rawat  * union drm_vmw_gb_surface_create_ext_arg
117314b1c33eSDeepak Rawat  *
117414b1c33eSDeepak Rawat  * @req: Input argument as described above.
117514b1c33eSDeepak Rawat  * @rep: Output argument as described above.
117614b1c33eSDeepak Rawat  *
117714b1c33eSDeepak Rawat  * Argument to the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl.
117814b1c33eSDeepak Rawat  */
117914b1c33eSDeepak Rawat union drm_vmw_gb_surface_create_ext_arg {
118014b1c33eSDeepak Rawat 	struct drm_vmw_gb_surface_create_rep rep;
118114b1c33eSDeepak Rawat 	struct drm_vmw_gb_surface_create_ext_req req;
118214b1c33eSDeepak Rawat };
118314b1c33eSDeepak Rawat 
118414b1c33eSDeepak Rawat /*************************************************************************/
118514b1c33eSDeepak Rawat /**
118614b1c33eSDeepak Rawat  * DRM_VMW_GB_SURFACE_REF_EXT - Reference a host surface.
118714b1c33eSDeepak Rawat  *
118814b1c33eSDeepak Rawat  * Puts a reference on a host surface with a given handle, as previously
118914b1c33eSDeepak Rawat  * returned by the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl.
119014b1c33eSDeepak Rawat  * A reference will make sure the surface isn't destroyed while we hold
119114b1c33eSDeepak Rawat  * it and will allow the calling client to use the surface handle in
119214b1c33eSDeepak Rawat  * the command stream.
119314b1c33eSDeepak Rawat  *
119414b1c33eSDeepak Rawat  * On successful return, the Ioctl returns the surface information given
119514b1c33eSDeepak Rawat  * to and returned from the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl.
119614b1c33eSDeepak Rawat  */
119714b1c33eSDeepak Rawat 
119814b1c33eSDeepak Rawat /**
119914b1c33eSDeepak Rawat  * struct drm_vmw_gb_surface_ref_ext_rep
120014b1c33eSDeepak Rawat  *
120114b1c33eSDeepak Rawat  * @creq: The data used as input when the surface was created, as described
120214b1c33eSDeepak Rawat  *        above at "struct drm_vmw_gb_surface_create_ext_req"
120314b1c33eSDeepak Rawat  * @crep: Additional data output when the surface was created, as described
120414b1c33eSDeepak Rawat  *        above at "struct drm_vmw_gb_surface_create_rep"
120514b1c33eSDeepak Rawat  *
120614b1c33eSDeepak Rawat  * Output Argument to the DRM_VMW_GB_SURFACE_REF_EXT ioctl.
120714b1c33eSDeepak Rawat  */
120814b1c33eSDeepak Rawat struct drm_vmw_gb_surface_ref_ext_rep {
120914b1c33eSDeepak Rawat 	struct drm_vmw_gb_surface_create_ext_req creq;
121014b1c33eSDeepak Rawat 	struct drm_vmw_gb_surface_create_rep crep;
121114b1c33eSDeepak Rawat };
121214b1c33eSDeepak Rawat 
121314b1c33eSDeepak Rawat /**
121414b1c33eSDeepak Rawat  * union drm_vmw_gb_surface_reference_ext_arg
121514b1c33eSDeepak Rawat  *
121614b1c33eSDeepak Rawat  * @req: Input data as described above at "struct drm_vmw_surface_arg"
121714b1c33eSDeepak Rawat  * @rep: Output data as described above at
121814b1c33eSDeepak Rawat  *       "struct drm_vmw_gb_surface_ref_ext_rep"
121914b1c33eSDeepak Rawat  *
122014b1c33eSDeepak Rawat  * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl.
122114b1c33eSDeepak Rawat  */
122214b1c33eSDeepak Rawat union drm_vmw_gb_surface_reference_ext_arg {
122314b1c33eSDeepak Rawat 	struct drm_vmw_gb_surface_ref_ext_rep rep;
122414b1c33eSDeepak Rawat 	struct drm_vmw_surface_arg req;
122514b1c33eSDeepak Rawat };
122614b1c33eSDeepak Rawat 
1227cb92a323SRoland Scheidegger /**
1228cb92a323SRoland Scheidegger  * struct drm_vmw_msg_arg
1229cb92a323SRoland Scheidegger  *
1230cb92a323SRoland Scheidegger  * @send: Pointer to user-space msg string (null terminated).
1231cb92a323SRoland Scheidegger  * @receive: Pointer to user-space receive buffer.
1232cb92a323SRoland Scheidegger  * @send_only: Boolean whether this is only sending or receiving too.
1233cb92a323SRoland Scheidegger  *
1234cb92a323SRoland Scheidegger  * Argument to the DRM_VMW_MSG ioctl.
1235cb92a323SRoland Scheidegger  */
1236cb92a323SRoland Scheidegger struct drm_vmw_msg_arg {
1237cb92a323SRoland Scheidegger 	__u64 send;
1238cb92a323SRoland Scheidegger 	__u64 receive;
1239cb92a323SRoland Scheidegger 	__s32 send_only;
1240cb92a323SRoland Scheidegger 	__u32 receive_len;
1241cb92a323SRoland Scheidegger };
1242cb92a323SRoland Scheidegger 
12437a7a933eSMartin Krastev /**
12447a7a933eSMartin Krastev  * struct drm_vmw_mksstat_add_arg
12457a7a933eSMartin Krastev  *
12467a7a933eSMartin Krastev  * @stat: Pointer to user-space stat-counters array, page-aligned.
12477a7a933eSMartin Krastev  * @info: Pointer to user-space counter-infos array, page-aligned.
12487a7a933eSMartin Krastev  * @strs: Pointer to user-space stat strings, page-aligned.
12497a7a933eSMartin Krastev  * @stat_len: Length in bytes of stat-counters array.
12507a7a933eSMartin Krastev  * @info_len: Length in bytes of counter-infos array.
12517a7a933eSMartin Krastev  * @strs_len: Length in bytes of the stat strings, terminators included.
12527a7a933eSMartin Krastev  * @description: Pointer to instance descriptor string; will be truncated
12537a7a933eSMartin Krastev  *               to MKS_GUEST_STAT_INSTANCE_DESC_LENGTH chars.
12547a7a933eSMartin Krastev  * @id: Output identifier of the produced record; -1 if error.
12557a7a933eSMartin Krastev  *
12567a7a933eSMartin Krastev  * Argument to the DRM_VMW_MKSSTAT_ADD ioctl.
12577a7a933eSMartin Krastev  */
12587a7a933eSMartin Krastev struct drm_vmw_mksstat_add_arg {
12597a7a933eSMartin Krastev 	__u64 stat;
12607a7a933eSMartin Krastev 	__u64 info;
12617a7a933eSMartin Krastev 	__u64 strs;
12627a7a933eSMartin Krastev 	__u64 stat_len;
12637a7a933eSMartin Krastev 	__u64 info_len;
12647a7a933eSMartin Krastev 	__u64 strs_len;
12657a7a933eSMartin Krastev 	__u64 description;
12667a7a933eSMartin Krastev 	__u64 id;
12677a7a933eSMartin Krastev };
12687a7a933eSMartin Krastev 
12697a7a933eSMartin Krastev /**
12707a7a933eSMartin Krastev  * struct drm_vmw_mksstat_remove_arg
12717a7a933eSMartin Krastev  *
12727a7a933eSMartin Krastev  * @id: Identifier of the record being disposed, originally obtained through
12737a7a933eSMartin Krastev  *      DRM_VMW_MKSSTAT_ADD ioctl.
12747a7a933eSMartin Krastev  *
12757a7a933eSMartin Krastev  * Argument to the DRM_VMW_MKSSTAT_REMOVE ioctl.
12767a7a933eSMartin Krastev  */
12777a7a933eSMartin Krastev struct drm_vmw_mksstat_remove_arg {
12787a7a933eSMartin Krastev 	__u64 id;
12797a7a933eSMartin Krastev };
12807a7a933eSMartin Krastev 
1281d3450e00SEmil Velikov #if defined(__cplusplus)
1282d3450e00SEmil Velikov }
1283d3450e00SEmil Velikov #endif
1284d3450e00SEmil Velikov 
1285718dceddSDavid Howells #endif
1286