xref: /openbmc/linux/include/uapi/drm/vmwgfx_drm.h (revision 9b07b287)
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
74718dceddSDavid Howells 
75718dceddSDavid Howells /*************************************************************************/
76718dceddSDavid Howells /**
77718dceddSDavid Howells  * DRM_VMW_GET_PARAM - get device information.
78718dceddSDavid Howells  *
79718dceddSDavid Howells  * DRM_VMW_PARAM_FIFO_OFFSET:
80718dceddSDavid Howells  * Offset to use to map the first page of the FIFO read-only.
81718dceddSDavid Howells  * The fifo is mapped using the mmap() system call on the drm device.
82718dceddSDavid Howells  *
83718dceddSDavid Howells  * DRM_VMW_PARAM_OVERLAY_IOCTL:
84718dceddSDavid Howells  * Does the driver support the overlay ioctl.
859b07b287SDeepak Rawat  *
869b07b287SDeepak Rawat  * DRM_VMW_PARAM_SM4_1
879b07b287SDeepak Rawat  * SM4_1 support is enabled.
88718dceddSDavid Howells  */
89718dceddSDavid Howells 
90718dceddSDavid Howells #define DRM_VMW_PARAM_NUM_STREAMS      0
91718dceddSDavid Howells #define DRM_VMW_PARAM_NUM_FREE_STREAMS 1
92718dceddSDavid Howells #define DRM_VMW_PARAM_3D               2
93718dceddSDavid Howells #define DRM_VMW_PARAM_HW_CAPS          3
94718dceddSDavid Howells #define DRM_VMW_PARAM_FIFO_CAPS        4
95718dceddSDavid Howells #define DRM_VMW_PARAM_MAX_FB_SIZE      5
96718dceddSDavid Howells #define DRM_VMW_PARAM_FIFO_HW_VERSION  6
97cfe4d53eSThomas Hellstrom #define DRM_VMW_PARAM_MAX_SURF_MEMORY  7
98cfe4d53eSThomas Hellstrom #define DRM_VMW_PARAM_3D_CAPS_SIZE     8
99311474dbSThomas Hellstrom #define DRM_VMW_PARAM_MAX_MOB_MEMORY   9
100857aea1cSCharmaine Lee #define DRM_VMW_PARAM_MAX_MOB_SIZE     10
10135c05125SSinclair Yeh #define DRM_VMW_PARAM_SCREEN_TARGET    11
102d80efd5cSThomas Hellstrom #define DRM_VMW_PARAM_DX               12
1033b4c2511SNeha Bhende #define DRM_VMW_PARAM_HW_CAPS2         13
1049b07b287SDeepak Rawat #define DRM_VMW_PARAM_SM4_1            14
105718dceddSDavid Howells 
106718dceddSDavid Howells /**
107adebcb20SThomas Hellstrom  * enum drm_vmw_handle_type - handle type for ref ioctls
108adebcb20SThomas Hellstrom  *
109adebcb20SThomas Hellstrom  */
110adebcb20SThomas Hellstrom enum drm_vmw_handle_type {
111adebcb20SThomas Hellstrom 	DRM_VMW_HANDLE_LEGACY = 0,
112adebcb20SThomas Hellstrom 	DRM_VMW_HANDLE_PRIME = 1
113adebcb20SThomas Hellstrom };
114adebcb20SThomas Hellstrom 
115adebcb20SThomas Hellstrom /**
116718dceddSDavid Howells  * struct drm_vmw_getparam_arg
117718dceddSDavid Howells  *
118718dceddSDavid Howells  * @value: Returned value. //Out
119718dceddSDavid Howells  * @param: Parameter to query. //In.
120718dceddSDavid Howells  *
121718dceddSDavid Howells  * Argument to the DRM_VMW_GET_PARAM Ioctl.
122718dceddSDavid Howells  */
123718dceddSDavid Howells 
124718dceddSDavid Howells struct drm_vmw_getparam_arg {
12521de2fdaSMikko Rapeli 	__u64 value;
12621de2fdaSMikko Rapeli 	__u32 param;
12721de2fdaSMikko Rapeli 	__u32 pad64;
128718dceddSDavid Howells };
129718dceddSDavid Howells 
130718dceddSDavid Howells /*************************************************************************/
131718dceddSDavid Howells /**
132718dceddSDavid Howells  * DRM_VMW_CREATE_CONTEXT - Create a host context.
133718dceddSDavid Howells  *
134718dceddSDavid Howells  * Allocates a device unique context id, and queues a create context command
135718dceddSDavid Howells  * for the host. Does not wait for host completion.
136718dceddSDavid Howells  */
137718dceddSDavid Howells 
138718dceddSDavid Howells /**
139718dceddSDavid Howells  * struct drm_vmw_context_arg
140718dceddSDavid Howells  *
141718dceddSDavid Howells  * @cid: Device unique context ID.
142718dceddSDavid Howells  *
143718dceddSDavid Howells  * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
144718dceddSDavid Howells  * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
145718dceddSDavid Howells  */
146718dceddSDavid Howells 
147718dceddSDavid Howells struct drm_vmw_context_arg {
14821de2fdaSMikko Rapeli 	__s32 cid;
14921de2fdaSMikko Rapeli 	__u32 pad64;
150718dceddSDavid Howells };
151718dceddSDavid Howells 
152718dceddSDavid Howells /*************************************************************************/
153718dceddSDavid Howells /**
154718dceddSDavid Howells  * DRM_VMW_UNREF_CONTEXT - Create a host context.
155718dceddSDavid Howells  *
156718dceddSDavid Howells  * Frees a global context id, and queues a destroy host command for the host.
157718dceddSDavid Howells  * Does not wait for host completion. The context ID can be used directly
158718dceddSDavid Howells  * in the command stream and shows up as the same context ID on the host.
159718dceddSDavid Howells  */
160718dceddSDavid Howells 
161718dceddSDavid Howells /*************************************************************************/
162718dceddSDavid Howells /**
163718dceddSDavid Howells  * DRM_VMW_CREATE_SURFACE - Create a host suface.
164718dceddSDavid Howells  *
165718dceddSDavid Howells  * Allocates a device unique surface id, and queues a create surface command
166718dceddSDavid Howells  * for the host. Does not wait for host completion. The surface ID can be
167718dceddSDavid Howells  * used directly in the command stream and shows up as the same surface
168718dceddSDavid Howells  * ID on the host.
169718dceddSDavid Howells  */
170718dceddSDavid Howells 
171718dceddSDavid Howells /**
172718dceddSDavid Howells  * struct drm_wmv_surface_create_req
173718dceddSDavid Howells  *
174718dceddSDavid Howells  * @flags: Surface flags as understood by the host.
175718dceddSDavid Howells  * @format: Surface format as understood by the host.
176718dceddSDavid Howells  * @mip_levels: Number of mip levels for each face.
177718dceddSDavid Howells  * An unused face should have 0 encoded.
178718dceddSDavid Howells  * @size_addr: Address of a user-space array of sruct drm_vmw_size
17921de2fdaSMikko Rapeli  * cast to an __u64 for 32-64 bit compatibility.
180718dceddSDavid Howells  * The size of the array should equal the total number of mipmap levels.
181718dceddSDavid Howells  * @shareable: Boolean whether other clients (as identified by file descriptors)
182718dceddSDavid Howells  * may reference this surface.
183718dceddSDavid Howells  * @scanout: Boolean whether the surface is intended to be used as a
184718dceddSDavid Howells  * scanout.
185718dceddSDavid Howells  *
186718dceddSDavid Howells  * Input data to the DRM_VMW_CREATE_SURFACE Ioctl.
187718dceddSDavid Howells  * Output data from the DRM_VMW_REF_SURFACE Ioctl.
188718dceddSDavid Howells  */
189718dceddSDavid Howells 
190718dceddSDavid Howells struct drm_vmw_surface_create_req {
19121de2fdaSMikko Rapeli 	__u32 flags;
19221de2fdaSMikko Rapeli 	__u32 format;
19321de2fdaSMikko Rapeli 	__u32 mip_levels[DRM_VMW_MAX_SURFACE_FACES];
19421de2fdaSMikko Rapeli 	__u64 size_addr;
19521de2fdaSMikko Rapeli 	__s32 shareable;
19621de2fdaSMikko Rapeli 	__s32 scanout;
197718dceddSDavid Howells };
198718dceddSDavid Howells 
199718dceddSDavid Howells /**
200718dceddSDavid Howells  * struct drm_wmv_surface_arg
201718dceddSDavid Howells  *
202718dceddSDavid Howells  * @sid: Surface id of created surface or surface to destroy or reference.
203adebcb20SThomas Hellstrom  * @handle_type: Handle type for DRM_VMW_REF_SURFACE Ioctl.
204718dceddSDavid Howells  *
205718dceddSDavid Howells  * Output data from the DRM_VMW_CREATE_SURFACE Ioctl.
206718dceddSDavid Howells  * Input argument to the DRM_VMW_UNREF_SURFACE Ioctl.
207718dceddSDavid Howells  * Input argument to the DRM_VMW_REF_SURFACE Ioctl.
208718dceddSDavid Howells  */
209718dceddSDavid Howells 
210718dceddSDavid Howells struct drm_vmw_surface_arg {
21121de2fdaSMikko Rapeli 	__s32 sid;
212adebcb20SThomas Hellstrom 	enum drm_vmw_handle_type handle_type;
213718dceddSDavid Howells };
214718dceddSDavid Howells 
215718dceddSDavid Howells /**
216718dceddSDavid Howells  * struct drm_vmw_size ioctl.
217718dceddSDavid Howells  *
218718dceddSDavid Howells  * @width - mip level width
219718dceddSDavid Howells  * @height - mip level height
220718dceddSDavid Howells  * @depth - mip level depth
221718dceddSDavid Howells  *
222718dceddSDavid Howells  * Description of a mip level.
223718dceddSDavid Howells  * Input data to the DRM_WMW_CREATE_SURFACE Ioctl.
224718dceddSDavid Howells  */
225718dceddSDavid Howells 
226718dceddSDavid Howells struct drm_vmw_size {
22721de2fdaSMikko Rapeli 	__u32 width;
22821de2fdaSMikko Rapeli 	__u32 height;
22921de2fdaSMikko Rapeli 	__u32 depth;
23021de2fdaSMikko Rapeli 	__u32 pad64;
231718dceddSDavid Howells };
232718dceddSDavid Howells 
233718dceddSDavid Howells /**
234718dceddSDavid Howells  * union drm_vmw_surface_create_arg
235718dceddSDavid Howells  *
236718dceddSDavid Howells  * @rep: Output data as described above.
237718dceddSDavid Howells  * @req: Input data as described above.
238718dceddSDavid Howells  *
239718dceddSDavid Howells  * Argument to the DRM_VMW_CREATE_SURFACE Ioctl.
240718dceddSDavid Howells  */
241718dceddSDavid Howells 
242718dceddSDavid Howells union drm_vmw_surface_create_arg {
243718dceddSDavid Howells 	struct drm_vmw_surface_arg rep;
244718dceddSDavid Howells 	struct drm_vmw_surface_create_req req;
245718dceddSDavid Howells };
246718dceddSDavid Howells 
247718dceddSDavid Howells /*************************************************************************/
248718dceddSDavid Howells /**
249718dceddSDavid Howells  * DRM_VMW_REF_SURFACE - Reference a host surface.
250718dceddSDavid Howells  *
251718dceddSDavid Howells  * Puts a reference on a host surface with a give sid, as previously
252718dceddSDavid Howells  * returned by the DRM_VMW_CREATE_SURFACE ioctl.
253718dceddSDavid Howells  * A reference will make sure the surface isn't destroyed while we hold
254718dceddSDavid Howells  * it and will allow the calling client to use the surface ID in the command
255718dceddSDavid Howells  * stream.
256718dceddSDavid Howells  *
257718dceddSDavid Howells  * On successful return, the Ioctl returns the surface information given
258718dceddSDavid Howells  * in the DRM_VMW_CREATE_SURFACE ioctl.
259718dceddSDavid Howells  */
260718dceddSDavid Howells 
261718dceddSDavid Howells /**
262718dceddSDavid Howells  * union drm_vmw_surface_reference_arg
263718dceddSDavid Howells  *
264718dceddSDavid Howells  * @rep: Output data as described above.
265718dceddSDavid Howells  * @req: Input data as described above.
266718dceddSDavid Howells  *
267718dceddSDavid Howells  * Argument to the DRM_VMW_REF_SURFACE Ioctl.
268718dceddSDavid Howells  */
269718dceddSDavid Howells 
270718dceddSDavid Howells union drm_vmw_surface_reference_arg {
271718dceddSDavid Howells 	struct drm_vmw_surface_create_req rep;
272718dceddSDavid Howells 	struct drm_vmw_surface_arg req;
273718dceddSDavid Howells };
274718dceddSDavid Howells 
275718dceddSDavid Howells /*************************************************************************/
276718dceddSDavid Howells /**
277718dceddSDavid Howells  * DRM_VMW_UNREF_SURFACE - Unreference a host surface.
278718dceddSDavid Howells  *
279718dceddSDavid Howells  * Clear a reference previously put on a host surface.
280718dceddSDavid Howells  * When all references are gone, including the one implicitly placed
281718dceddSDavid Howells  * on creation,
282718dceddSDavid Howells  * a destroy surface command will be queued for the host.
283718dceddSDavid Howells  * Does not wait for completion.
284718dceddSDavid Howells  */
285718dceddSDavid Howells 
286718dceddSDavid Howells /*************************************************************************/
287718dceddSDavid Howells /**
288718dceddSDavid Howells  * DRM_VMW_EXECBUF
289718dceddSDavid Howells  *
290718dceddSDavid Howells  * Submit a command buffer for execution on the host, and return a
291718dceddSDavid Howells  * fence seqno that when signaled, indicates that the command buffer has
292718dceddSDavid Howells  * executed.
293718dceddSDavid Howells  */
294718dceddSDavid Howells 
295718dceddSDavid Howells /**
296718dceddSDavid Howells  * struct drm_vmw_execbuf_arg
297718dceddSDavid Howells  *
29821de2fdaSMikko Rapeli  * @commands: User-space address of a command buffer cast to an __u64.
299718dceddSDavid Howells  * @command-size: Size in bytes of the command buffer.
300718dceddSDavid Howells  * @throttle-us: Sleep until software is less than @throttle_us
301718dceddSDavid Howells  * microseconds ahead of hardware. The driver may round this value
302718dceddSDavid Howells  * to the nearest kernel tick.
303718dceddSDavid Howells  * @fence_rep: User-space address of a struct drm_vmw_fence_rep cast to an
30421de2fdaSMikko Rapeli  * __u64.
305718dceddSDavid Howells  * @version: Allows expanding the execbuf ioctl parameters without breaking
306718dceddSDavid Howells  * backwards compatibility, since user-space will always tell the kernel
307718dceddSDavid Howells  * which version it uses.
3082cfa0bb2SSinclair Yeh  * @flags: Execbuf flags.
3092cfa0bb2SSinclair Yeh  * @imported_fence_fd:  FD for a fence imported from another device
310718dceddSDavid Howells  *
311718dceddSDavid Howells  * Argument to the DRM_VMW_EXECBUF Ioctl.
312718dceddSDavid Howells  */
313718dceddSDavid Howells 
314d80efd5cSThomas Hellstrom #define DRM_VMW_EXECBUF_VERSION 2
315718dceddSDavid Howells 
3162cfa0bb2SSinclair Yeh #define DRM_VMW_EXECBUF_FLAG_IMPORT_FENCE_FD (1 << 0)
3172cfa0bb2SSinclair Yeh #define DRM_VMW_EXECBUF_FLAG_EXPORT_FENCE_FD (1 << 1)
3182cfa0bb2SSinclair Yeh 
319718dceddSDavid Howells struct drm_vmw_execbuf_arg {
32021de2fdaSMikko Rapeli 	__u64 commands;
32121de2fdaSMikko Rapeli 	__u32 command_size;
32221de2fdaSMikko Rapeli 	__u32 throttle_us;
32321de2fdaSMikko Rapeli 	__u64 fence_rep;
32421de2fdaSMikko Rapeli 	__u32 version;
32521de2fdaSMikko Rapeli 	__u32 flags;
32621de2fdaSMikko Rapeli 	__u32 context_handle;
3272cfa0bb2SSinclair Yeh 	__s32 imported_fence_fd;
328718dceddSDavid Howells };
329718dceddSDavid Howells 
330718dceddSDavid Howells /**
331718dceddSDavid Howells  * struct drm_vmw_fence_rep
332718dceddSDavid Howells  *
333718dceddSDavid Howells  * @handle: Fence object handle for fence associated with a command submission.
334718dceddSDavid Howells  * @mask: Fence flags relevant for this fence object.
335718dceddSDavid Howells  * @seqno: Fence sequence number in fifo. A fence object with a lower
336718dceddSDavid Howells  * seqno will signal the EXEC flag before a fence object with a higher
337718dceddSDavid Howells  * seqno. This can be used by user-space to avoid kernel calls to determine
338718dceddSDavid Howells  * whether a fence has signaled the EXEC flag. Note that @seqno will
339718dceddSDavid Howells  * wrap at 32-bit.
340718dceddSDavid Howells  * @passed_seqno: The highest seqno number processed by the hardware
341718dceddSDavid Howells  * so far. This can be used to mark user-space fence objects as signaled, and
342718dceddSDavid Howells  * to determine whether a fence seqno might be stale.
3432cfa0bb2SSinclair Yeh  * @fd: FD associated with the fence, -1 if not exported
344718dceddSDavid Howells  * @error: This member should've been set to -EFAULT on submission.
345718dceddSDavid Howells  * The following actions should be take on completion:
346718dceddSDavid Howells  * error == -EFAULT: Fence communication failed. The host is synchronized.
347718dceddSDavid Howells  * Use the last fence id read from the FIFO fence register.
348718dceddSDavid Howells  * error != 0 && error != -EFAULT:
349718dceddSDavid Howells  * Fence submission failed. The host is synchronized. Use the fence_seq member.
350718dceddSDavid Howells  * error == 0: All is OK, The host may not be synchronized.
351718dceddSDavid Howells  * Use the fence_seq member.
352718dceddSDavid Howells  *
353718dceddSDavid Howells  * Input / Output data to the DRM_VMW_EXECBUF Ioctl.
354718dceddSDavid Howells  */
355718dceddSDavid Howells 
356718dceddSDavid Howells struct drm_vmw_fence_rep {
35721de2fdaSMikko Rapeli 	__u32 handle;
35821de2fdaSMikko Rapeli 	__u32 mask;
35921de2fdaSMikko Rapeli 	__u32 seqno;
36021de2fdaSMikko Rapeli 	__u32 passed_seqno;
3612cfa0bb2SSinclair Yeh 	__s32 fd;
36221de2fdaSMikko Rapeli 	__s32 error;
363718dceddSDavid Howells };
364718dceddSDavid Howells 
365718dceddSDavid Howells /*************************************************************************/
366718dceddSDavid Howells /**
367f1d34bfdSThomas Hellstrom  * DRM_VMW_ALLOC_BO
368718dceddSDavid Howells  *
369f1d34bfdSThomas Hellstrom  * Allocate a buffer object that is visible also to the host.
370718dceddSDavid Howells  * NOTE: The buffer is
371718dceddSDavid Howells  * identified by a handle and an offset, which are private to the guest, but
372718dceddSDavid Howells  * useable in the command stream. The guest kernel may translate these
373718dceddSDavid Howells  * and patch up the command stream accordingly. In the future, the offset may
374718dceddSDavid Howells  * be zero at all times, or it may disappear from the interface before it is
375718dceddSDavid Howells  * fixed.
376718dceddSDavid Howells  *
377f1d34bfdSThomas Hellstrom  * The buffer object may stay user-space mapped in the guest at all times,
378718dceddSDavid Howells  * and is thus suitable for sub-allocation.
379718dceddSDavid Howells  *
380f1d34bfdSThomas Hellstrom  * Buffer objects are mapped using the mmap() syscall on the drm device.
381718dceddSDavid Howells  */
382718dceddSDavid Howells 
383718dceddSDavid Howells /**
384f1d34bfdSThomas Hellstrom  * struct drm_vmw_alloc_bo_req
385718dceddSDavid Howells  *
386718dceddSDavid Howells  * @size: Required minimum size of the buffer.
387718dceddSDavid Howells  *
388f1d34bfdSThomas Hellstrom  * Input data to the DRM_VMW_ALLOC_BO Ioctl.
389718dceddSDavid Howells  */
390718dceddSDavid Howells 
391f1d34bfdSThomas Hellstrom struct drm_vmw_alloc_bo_req {
39221de2fdaSMikko Rapeli 	__u32 size;
39321de2fdaSMikko Rapeli 	__u32 pad64;
394718dceddSDavid Howells };
395f1d34bfdSThomas Hellstrom #define drm_vmw_alloc_dmabuf_req drm_vmw_alloc_bo_req
396718dceddSDavid Howells 
397718dceddSDavid Howells /**
398f1d34bfdSThomas Hellstrom  * struct drm_vmw_bo_rep
399718dceddSDavid Howells  *
400718dceddSDavid Howells  * @map_handle: Offset to use in the mmap() call used to map the buffer.
401718dceddSDavid Howells  * @handle: Handle unique to this buffer. Used for unreferencing.
402718dceddSDavid Howells  * @cur_gmr_id: GMR id to use in the command stream when this buffer is
403718dceddSDavid Howells  * referenced. See not above.
404718dceddSDavid Howells  * @cur_gmr_offset: Offset to use in the command stream when this buffer is
405718dceddSDavid Howells  * referenced. See note above.
406718dceddSDavid Howells  *
407f1d34bfdSThomas Hellstrom  * Output data from the DRM_VMW_ALLOC_BO Ioctl.
408718dceddSDavid Howells  */
409718dceddSDavid Howells 
410f1d34bfdSThomas Hellstrom struct drm_vmw_bo_rep {
41121de2fdaSMikko Rapeli 	__u64 map_handle;
41221de2fdaSMikko Rapeli 	__u32 handle;
41321de2fdaSMikko Rapeli 	__u32 cur_gmr_id;
41421de2fdaSMikko Rapeli 	__u32 cur_gmr_offset;
41521de2fdaSMikko Rapeli 	__u32 pad64;
416718dceddSDavid Howells };
417f1d34bfdSThomas Hellstrom #define drm_vmw_dmabuf_rep drm_vmw_bo_rep
418718dceddSDavid Howells 
419718dceddSDavid Howells /**
420f1d34bfdSThomas Hellstrom  * union drm_vmw_alloc_bo_arg
421718dceddSDavid Howells  *
422718dceddSDavid Howells  * @req: Input data as described above.
423718dceddSDavid Howells  * @rep: Output data as described above.
424718dceddSDavid Howells  *
425f1d34bfdSThomas Hellstrom  * Argument to the DRM_VMW_ALLOC_BO Ioctl.
426718dceddSDavid Howells  */
427718dceddSDavid Howells 
428f1d34bfdSThomas Hellstrom union drm_vmw_alloc_bo_arg {
429f1d34bfdSThomas Hellstrom 	struct drm_vmw_alloc_bo_req req;
430f1d34bfdSThomas Hellstrom 	struct drm_vmw_bo_rep rep;
431718dceddSDavid Howells };
432f1d34bfdSThomas Hellstrom #define drm_vmw_alloc_dmabuf_arg drm_vmw_alloc_bo_arg
433718dceddSDavid Howells 
434718dceddSDavid Howells /*************************************************************************/
435718dceddSDavid Howells /**
436718dceddSDavid Howells  * DRM_VMW_CONTROL_STREAM - Control overlays, aka streams.
437718dceddSDavid Howells  *
438718dceddSDavid Howells  * This IOCTL controls the overlay units of the svga device.
439718dceddSDavid Howells  * The SVGA overlay units does not work like regular hardware units in
440718dceddSDavid Howells  * that they do not automaticaly read back the contents of the given dma
441718dceddSDavid Howells  * buffer. But instead only read back for each call to this ioctl, and
442718dceddSDavid Howells  * at any point between this call being made and a following call that
443718dceddSDavid Howells  * either changes the buffer or disables the stream.
444718dceddSDavid Howells  */
445718dceddSDavid Howells 
446718dceddSDavid Howells /**
447718dceddSDavid Howells  * struct drm_vmw_rect
448718dceddSDavid Howells  *
449718dceddSDavid Howells  * Defines a rectangle. Used in the overlay ioctl to define
450718dceddSDavid Howells  * source and destination rectangle.
451718dceddSDavid Howells  */
452718dceddSDavid Howells 
453718dceddSDavid Howells struct drm_vmw_rect {
45421de2fdaSMikko Rapeli 	__s32 x;
45521de2fdaSMikko Rapeli 	__s32 y;
45621de2fdaSMikko Rapeli 	__u32 w;
45721de2fdaSMikko Rapeli 	__u32 h;
458718dceddSDavid Howells };
459718dceddSDavid Howells 
460718dceddSDavid Howells /**
461718dceddSDavid Howells  * struct drm_vmw_control_stream_arg
462718dceddSDavid Howells  *
463718dceddSDavid Howells  * @stream_id: Stearm to control
464718dceddSDavid Howells  * @enabled: If false all following arguments are ignored.
465718dceddSDavid Howells  * @handle: Handle to buffer for getting data from.
466718dceddSDavid Howells  * @format: Format of the overlay as understood by the host.
467718dceddSDavid Howells  * @width: Width of the overlay.
468718dceddSDavid Howells  * @height: Height of the overlay.
469718dceddSDavid Howells  * @size: Size of the overlay in bytes.
470718dceddSDavid Howells  * @pitch: Array of pitches, the two last are only used for YUV12 formats.
471718dceddSDavid Howells  * @offset: Offset from start of dma buffer to overlay.
472718dceddSDavid Howells  * @src: Source rect, must be within the defined area above.
473718dceddSDavid Howells  * @dst: Destination rect, x and y may be negative.
474718dceddSDavid Howells  *
475718dceddSDavid Howells  * Argument to the DRM_VMW_CONTROL_STREAM Ioctl.
476718dceddSDavid Howells  */
477718dceddSDavid Howells 
478718dceddSDavid Howells struct drm_vmw_control_stream_arg {
47921de2fdaSMikko Rapeli 	__u32 stream_id;
48021de2fdaSMikko Rapeli 	__u32 enabled;
481718dceddSDavid Howells 
48221de2fdaSMikko Rapeli 	__u32 flags;
48321de2fdaSMikko Rapeli 	__u32 color_key;
484718dceddSDavid Howells 
48521de2fdaSMikko Rapeli 	__u32 handle;
48621de2fdaSMikko Rapeli 	__u32 offset;
48721de2fdaSMikko Rapeli 	__s32 format;
48821de2fdaSMikko Rapeli 	__u32 size;
48921de2fdaSMikko Rapeli 	__u32 width;
49021de2fdaSMikko Rapeli 	__u32 height;
49121de2fdaSMikko Rapeli 	__u32 pitch[3];
492718dceddSDavid Howells 
49321de2fdaSMikko Rapeli 	__u32 pad64;
494718dceddSDavid Howells 	struct drm_vmw_rect src;
495718dceddSDavid Howells 	struct drm_vmw_rect dst;
496718dceddSDavid Howells };
497718dceddSDavid Howells 
498718dceddSDavid Howells /*************************************************************************/
499718dceddSDavid Howells /**
500718dceddSDavid Howells  * DRM_VMW_CURSOR_BYPASS - Give extra information about cursor bypass.
501718dceddSDavid Howells  *
502718dceddSDavid Howells  */
503718dceddSDavid Howells 
504718dceddSDavid Howells #define DRM_VMW_CURSOR_BYPASS_ALL    (1 << 0)
505718dceddSDavid Howells #define DRM_VMW_CURSOR_BYPASS_FLAGS       (1)
506718dceddSDavid Howells 
507718dceddSDavid Howells /**
508718dceddSDavid Howells  * struct drm_vmw_cursor_bypass_arg
509718dceddSDavid Howells  *
510718dceddSDavid Howells  * @flags: Flags.
511718dceddSDavid Howells  * @crtc_id: Crtc id, only used if DMR_CURSOR_BYPASS_ALL isn't passed.
512718dceddSDavid Howells  * @xpos: X position of cursor.
513718dceddSDavid Howells  * @ypos: Y position of cursor.
514718dceddSDavid Howells  * @xhot: X hotspot.
515718dceddSDavid Howells  * @yhot: Y hotspot.
516718dceddSDavid Howells  *
517718dceddSDavid Howells  * Argument to the DRM_VMW_CURSOR_BYPASS Ioctl.
518718dceddSDavid Howells  */
519718dceddSDavid Howells 
520718dceddSDavid Howells struct drm_vmw_cursor_bypass_arg {
52121de2fdaSMikko Rapeli 	__u32 flags;
52221de2fdaSMikko Rapeli 	__u32 crtc_id;
52321de2fdaSMikko Rapeli 	__s32 xpos;
52421de2fdaSMikko Rapeli 	__s32 ypos;
52521de2fdaSMikko Rapeli 	__s32 xhot;
52621de2fdaSMikko Rapeli 	__s32 yhot;
527718dceddSDavid Howells };
528718dceddSDavid Howells 
529718dceddSDavid Howells /*************************************************************************/
530718dceddSDavid Howells /**
531718dceddSDavid Howells  * DRM_VMW_CLAIM_STREAM - Claim a single stream.
532718dceddSDavid Howells  */
533718dceddSDavid Howells 
534718dceddSDavid Howells /**
535718dceddSDavid Howells  * struct drm_vmw_context_arg
536718dceddSDavid Howells  *
537718dceddSDavid Howells  * @stream_id: Device unique context ID.
538718dceddSDavid Howells  *
539718dceddSDavid Howells  * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
540718dceddSDavid Howells  * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
541718dceddSDavid Howells  */
542718dceddSDavid Howells 
543718dceddSDavid Howells struct drm_vmw_stream_arg {
54421de2fdaSMikko Rapeli 	__u32 stream_id;
54521de2fdaSMikko Rapeli 	__u32 pad64;
546718dceddSDavid Howells };
547718dceddSDavid Howells 
548718dceddSDavid Howells /*************************************************************************/
549718dceddSDavid Howells /**
550718dceddSDavid Howells  * DRM_VMW_UNREF_STREAM - Unclaim a stream.
551718dceddSDavid Howells  *
552718dceddSDavid Howells  * Return a single stream that was claimed by this process. Also makes
553718dceddSDavid Howells  * sure that the stream has been stopped.
554718dceddSDavid Howells  */
555718dceddSDavid Howells 
556718dceddSDavid Howells /*************************************************************************/
557718dceddSDavid Howells /**
558718dceddSDavid Howells  * DRM_VMW_GET_3D_CAP
559718dceddSDavid Howells  *
560718dceddSDavid Howells  * Read 3D capabilities from the FIFO
561718dceddSDavid Howells  *
562718dceddSDavid Howells  */
563718dceddSDavid Howells 
564718dceddSDavid Howells /**
565718dceddSDavid Howells  * struct drm_vmw_get_3d_cap_arg
566718dceddSDavid Howells  *
56721de2fdaSMikko Rapeli  * @buffer: Pointer to a buffer for capability data, cast to an __u64
568718dceddSDavid Howells  * @size: Max size to copy
569718dceddSDavid Howells  *
570718dceddSDavid Howells  * Input argument to the DRM_VMW_GET_3D_CAP_IOCTL
571718dceddSDavid Howells  * ioctls.
572718dceddSDavid Howells  */
573718dceddSDavid Howells 
574718dceddSDavid Howells struct drm_vmw_get_3d_cap_arg {
57521de2fdaSMikko Rapeli 	__u64 buffer;
57621de2fdaSMikko Rapeli 	__u32 max_size;
57721de2fdaSMikko Rapeli 	__u32 pad64;
578718dceddSDavid Howells };
579718dceddSDavid Howells 
580718dceddSDavid Howells /*************************************************************************/
581718dceddSDavid Howells /**
582718dceddSDavid Howells  * DRM_VMW_FENCE_WAIT
583718dceddSDavid Howells  *
584718dceddSDavid Howells  * Waits for a fence object to signal. The wait is interruptible, so that
585718dceddSDavid Howells  * signals may be delivered during the interrupt. The wait may timeout,
586718dceddSDavid Howells  * in which case the calls returns -EBUSY. If the wait is restarted,
587718dceddSDavid Howells  * that is restarting without resetting @cookie_valid to zero,
588718dceddSDavid Howells  * the timeout is computed from the first call.
589718dceddSDavid Howells  *
590718dceddSDavid Howells  * The flags argument to the DRM_VMW_FENCE_WAIT ioctl indicates what to wait
591718dceddSDavid Howells  * on:
592718dceddSDavid Howells  * DRM_VMW_FENCE_FLAG_EXEC: All commands ahead of the fence in the command
593718dceddSDavid Howells  * stream
594718dceddSDavid Howells  * have executed.
595718dceddSDavid Howells  * DRM_VMW_FENCE_FLAG_QUERY: All query results resulting from query finish
596718dceddSDavid Howells  * commands
597718dceddSDavid Howells  * in the buffer given to the EXECBUF ioctl returning the fence object handle
598718dceddSDavid Howells  * are available to user-space.
599718dceddSDavid Howells  *
600718dceddSDavid Howells  * DRM_VMW_WAIT_OPTION_UNREF: If this wait option is given, and the
601718dceddSDavid Howells  * fenc wait ioctl returns 0, the fence object has been unreferenced after
602718dceddSDavid Howells  * the wait.
603718dceddSDavid Howells  */
604718dceddSDavid Howells 
605718dceddSDavid Howells #define DRM_VMW_FENCE_FLAG_EXEC   (1 << 0)
606718dceddSDavid Howells #define DRM_VMW_FENCE_FLAG_QUERY  (1 << 1)
607718dceddSDavid Howells 
608718dceddSDavid Howells #define DRM_VMW_WAIT_OPTION_UNREF (1 << 0)
609718dceddSDavid Howells 
610718dceddSDavid Howells /**
611718dceddSDavid Howells  * struct drm_vmw_fence_wait_arg
612718dceddSDavid Howells  *
613718dceddSDavid Howells  * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
614718dceddSDavid Howells  * @cookie_valid: Must be reset to 0 on first call. Left alone on restart.
615718dceddSDavid Howells  * @kernel_cookie: Set to 0 on first call. Left alone on restart.
616718dceddSDavid Howells  * @timeout_us: Wait timeout in microseconds. 0 for indefinite timeout.
617718dceddSDavid Howells  * @lazy: Set to 1 if timing is not critical. Allow more than a kernel tick
618718dceddSDavid Howells  * before returning.
619718dceddSDavid Howells  * @flags: Fence flags to wait on.
620718dceddSDavid Howells  * @wait_options: Options that control the behaviour of the wait ioctl.
621718dceddSDavid Howells  *
622718dceddSDavid Howells  * Input argument to the DRM_VMW_FENCE_WAIT ioctl.
623718dceddSDavid Howells  */
624718dceddSDavid Howells 
625718dceddSDavid Howells struct drm_vmw_fence_wait_arg {
62621de2fdaSMikko Rapeli 	__u32 handle;
62721de2fdaSMikko Rapeli 	__s32  cookie_valid;
62821de2fdaSMikko Rapeli 	__u64 kernel_cookie;
62921de2fdaSMikko Rapeli 	__u64 timeout_us;
63021de2fdaSMikko Rapeli 	__s32 lazy;
63121de2fdaSMikko Rapeli 	__s32 flags;
63221de2fdaSMikko Rapeli 	__s32 wait_options;
63321de2fdaSMikko Rapeli 	__s32 pad64;
634718dceddSDavid Howells };
635718dceddSDavid Howells 
636718dceddSDavid Howells /*************************************************************************/
637718dceddSDavid Howells /**
638718dceddSDavid Howells  * DRM_VMW_FENCE_SIGNALED
639718dceddSDavid Howells  *
640718dceddSDavid Howells  * Checks if a fence object is signaled..
641718dceddSDavid Howells  */
642718dceddSDavid Howells 
643718dceddSDavid Howells /**
644718dceddSDavid Howells  * struct drm_vmw_fence_signaled_arg
645718dceddSDavid Howells  *
646718dceddSDavid Howells  * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
647718dceddSDavid Howells  * @flags: Fence object flags input to DRM_VMW_FENCE_SIGNALED ioctl
648718dceddSDavid Howells  * @signaled: Out: Flags signaled.
649718dceddSDavid Howells  * @sequence: Out: Highest sequence passed so far. Can be used to signal the
650718dceddSDavid Howells  * EXEC flag of user-space fence objects.
651718dceddSDavid Howells  *
652718dceddSDavid Howells  * Input/Output argument to the DRM_VMW_FENCE_SIGNALED and DRM_VMW_FENCE_UNREF
653718dceddSDavid Howells  * ioctls.
654718dceddSDavid Howells  */
655718dceddSDavid Howells 
656718dceddSDavid Howells struct drm_vmw_fence_signaled_arg {
65721de2fdaSMikko Rapeli 	 __u32 handle;
65821de2fdaSMikko Rapeli 	 __u32 flags;
65921de2fdaSMikko Rapeli 	 __s32 signaled;
66021de2fdaSMikko Rapeli 	 __u32 passed_seqno;
66121de2fdaSMikko Rapeli 	 __u32 signaled_flags;
66221de2fdaSMikko Rapeli 	 __u32 pad64;
663718dceddSDavid Howells };
664718dceddSDavid Howells 
665718dceddSDavid Howells /*************************************************************************/
666718dceddSDavid Howells /**
667718dceddSDavid Howells  * DRM_VMW_FENCE_UNREF
668718dceddSDavid Howells  *
669718dceddSDavid Howells  * Unreferences a fence object, and causes it to be destroyed if there are no
670718dceddSDavid Howells  * other references to it.
671718dceddSDavid Howells  *
672718dceddSDavid Howells  */
673718dceddSDavid Howells 
674718dceddSDavid Howells /**
675718dceddSDavid Howells  * struct drm_vmw_fence_arg
676718dceddSDavid Howells  *
677718dceddSDavid Howells  * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
678718dceddSDavid Howells  *
679718dceddSDavid Howells  * Input/Output argument to the DRM_VMW_FENCE_UNREF ioctl..
680718dceddSDavid Howells  */
681718dceddSDavid Howells 
682718dceddSDavid Howells struct drm_vmw_fence_arg {
68321de2fdaSMikko Rapeli 	 __u32 handle;
68421de2fdaSMikko Rapeli 	 __u32 pad64;
685718dceddSDavid Howells };
686718dceddSDavid Howells 
687718dceddSDavid Howells 
688718dceddSDavid Howells /*************************************************************************/
689718dceddSDavid Howells /**
690718dceddSDavid Howells  * DRM_VMW_FENCE_EVENT
691718dceddSDavid Howells  *
692718dceddSDavid Howells  * Queues an event on a fence to be delivered on the drm character device
693718dceddSDavid Howells  * when the fence has signaled the DRM_VMW_FENCE_FLAG_EXEC flag.
694718dceddSDavid Howells  * Optionally the approximate time when the fence signaled is
695718dceddSDavid Howells  * given by the event.
696718dceddSDavid Howells  */
697718dceddSDavid Howells 
698718dceddSDavid Howells /*
699718dceddSDavid Howells  * The event type
700718dceddSDavid Howells  */
701718dceddSDavid Howells #define DRM_VMW_EVENT_FENCE_SIGNALED 0x80000000
702718dceddSDavid Howells 
703718dceddSDavid Howells struct drm_vmw_event_fence {
704718dceddSDavid Howells 	struct drm_event base;
70521de2fdaSMikko Rapeli 	__u64 user_data;
70621de2fdaSMikko Rapeli 	__u32 tv_sec;
70721de2fdaSMikko Rapeli 	__u32 tv_usec;
708718dceddSDavid Howells };
709718dceddSDavid Howells 
710718dceddSDavid Howells /*
711718dceddSDavid Howells  * Flags that may be given to the command.
712718dceddSDavid Howells  */
713718dceddSDavid Howells /* Request fence signaled time on the event. */
714718dceddSDavid Howells #define DRM_VMW_FE_FLAG_REQ_TIME (1 << 0)
715718dceddSDavid Howells 
716718dceddSDavid Howells /**
717718dceddSDavid Howells  * struct drm_vmw_fence_event_arg
718718dceddSDavid Howells  *
71921de2fdaSMikko Rapeli  * @fence_rep: Pointer to fence_rep structure cast to __u64 or 0 if
720718dceddSDavid Howells  * the fence is not supposed to be referenced by user-space.
721718dceddSDavid Howells  * @user_info: Info to be delivered with the event.
722718dceddSDavid Howells  * @handle: Attach the event to this fence only.
723718dceddSDavid Howells  * @flags: A set of flags as defined above.
724718dceddSDavid Howells  */
725718dceddSDavid Howells struct drm_vmw_fence_event_arg {
72621de2fdaSMikko Rapeli 	__u64 fence_rep;
72721de2fdaSMikko Rapeli 	__u64 user_data;
72821de2fdaSMikko Rapeli 	__u32 handle;
72921de2fdaSMikko Rapeli 	__u32 flags;
730718dceddSDavid Howells };
731718dceddSDavid Howells 
732718dceddSDavid Howells 
733718dceddSDavid Howells /*************************************************************************/
734718dceddSDavid Howells /**
735718dceddSDavid Howells  * DRM_VMW_PRESENT
736718dceddSDavid Howells  *
737718dceddSDavid Howells  * Executes an SVGA present on a given fb for a given surface. The surface
738718dceddSDavid Howells  * is placed on the framebuffer. Cliprects are given relative to the given
739718dceddSDavid Howells  * point (the point disignated by dest_{x|y}).
740718dceddSDavid Howells  *
741718dceddSDavid Howells  */
742718dceddSDavid Howells 
743718dceddSDavid Howells /**
744718dceddSDavid Howells  * struct drm_vmw_present_arg
745718dceddSDavid Howells  * @fb_id: framebuffer id to present / read back from.
746718dceddSDavid Howells  * @sid: Surface id to present from.
747718dceddSDavid Howells  * @dest_x: X placement coordinate for surface.
748718dceddSDavid Howells  * @dest_y: Y placement coordinate for surface.
74921de2fdaSMikko Rapeli  * @clips_ptr: Pointer to an array of clip rects cast to an __u64.
750718dceddSDavid Howells  * @num_clips: Number of cliprects given relative to the framebuffer origin,
751718dceddSDavid Howells  * in the same coordinate space as the frame buffer.
752718dceddSDavid Howells  * @pad64: Unused 64-bit padding.
753718dceddSDavid Howells  *
754718dceddSDavid Howells  * Input argument to the DRM_VMW_PRESENT ioctl.
755718dceddSDavid Howells  */
756718dceddSDavid Howells 
757718dceddSDavid Howells struct drm_vmw_present_arg {
75821de2fdaSMikko Rapeli 	__u32 fb_id;
75921de2fdaSMikko Rapeli 	__u32 sid;
76021de2fdaSMikko Rapeli 	__s32 dest_x;
76121de2fdaSMikko Rapeli 	__s32 dest_y;
76221de2fdaSMikko Rapeli 	__u64 clips_ptr;
76321de2fdaSMikko Rapeli 	__u32 num_clips;
76421de2fdaSMikko Rapeli 	__u32 pad64;
765718dceddSDavid Howells };
766718dceddSDavid Howells 
767718dceddSDavid Howells 
768718dceddSDavid Howells /*************************************************************************/
769718dceddSDavid Howells /**
770718dceddSDavid Howells  * DRM_VMW_PRESENT_READBACK
771718dceddSDavid Howells  *
772718dceddSDavid Howells  * Executes an SVGA present readback from a given fb to the dma buffer
773718dceddSDavid Howells  * currently bound as the fb. If there is no dma buffer bound to the fb,
774718dceddSDavid Howells  * an error will be returned.
775718dceddSDavid Howells  *
776718dceddSDavid Howells  */
777718dceddSDavid Howells 
778718dceddSDavid Howells /**
779718dceddSDavid Howells  * struct drm_vmw_present_arg
780718dceddSDavid Howells  * @fb_id: fb_id to present / read back from.
781718dceddSDavid Howells  * @num_clips: Number of cliprects.
78221de2fdaSMikko Rapeli  * @clips_ptr: Pointer to an array of clip rects cast to an __u64.
78321de2fdaSMikko Rapeli  * @fence_rep: Pointer to a struct drm_vmw_fence_rep, cast to an __u64.
784718dceddSDavid Howells  * If this member is NULL, then the ioctl should not return a fence.
785718dceddSDavid Howells  */
786718dceddSDavid Howells 
787718dceddSDavid Howells struct drm_vmw_present_readback_arg {
78821de2fdaSMikko Rapeli 	 __u32 fb_id;
78921de2fdaSMikko Rapeli 	 __u32 num_clips;
79021de2fdaSMikko Rapeli 	 __u64 clips_ptr;
79121de2fdaSMikko Rapeli 	 __u64 fence_rep;
792718dceddSDavid Howells };
793718dceddSDavid Howells 
794718dceddSDavid Howells /*************************************************************************/
795718dceddSDavid Howells /**
796718dceddSDavid Howells  * DRM_VMW_UPDATE_LAYOUT - Update layout
797718dceddSDavid Howells  *
798718dceddSDavid Howells  * Updates the preferred modes and connection status for connectors. The
799718dceddSDavid Howells  * command consists of one drm_vmw_update_layout_arg pointing to an array
800718dceddSDavid Howells  * of num_outputs drm_vmw_rect's.
801718dceddSDavid Howells  */
802718dceddSDavid Howells 
803718dceddSDavid Howells /**
804718dceddSDavid Howells  * struct drm_vmw_update_layout_arg
805718dceddSDavid Howells  *
806718dceddSDavid Howells  * @num_outputs: number of active connectors
80721de2fdaSMikko Rapeli  * @rects: pointer to array of drm_vmw_rect cast to an __u64
808718dceddSDavid Howells  *
809718dceddSDavid Howells  * Input argument to the DRM_VMW_UPDATE_LAYOUT Ioctl.
810718dceddSDavid Howells  */
811718dceddSDavid Howells struct drm_vmw_update_layout_arg {
81221de2fdaSMikko Rapeli 	__u32 num_outputs;
81321de2fdaSMikko Rapeli 	__u32 pad64;
81421de2fdaSMikko Rapeli 	__u64 rects;
815718dceddSDavid Howells };
816718dceddSDavid Howells 
817cfe4d53eSThomas Hellstrom 
818cfe4d53eSThomas Hellstrom /*************************************************************************/
819cfe4d53eSThomas Hellstrom /**
820cfe4d53eSThomas Hellstrom  * DRM_VMW_CREATE_SHADER - Create shader
821cfe4d53eSThomas Hellstrom  *
822cfe4d53eSThomas Hellstrom  * Creates a shader and optionally binds it to a dma buffer containing
823cfe4d53eSThomas Hellstrom  * the shader byte-code.
824cfe4d53eSThomas Hellstrom  */
825cfe4d53eSThomas Hellstrom 
826cfe4d53eSThomas Hellstrom /**
827cfe4d53eSThomas Hellstrom  * enum drm_vmw_shader_type - Shader types
828cfe4d53eSThomas Hellstrom  */
829cfe4d53eSThomas Hellstrom enum drm_vmw_shader_type {
830cfe4d53eSThomas Hellstrom 	drm_vmw_shader_type_vs = 0,
831cfe4d53eSThomas Hellstrom 	drm_vmw_shader_type_ps,
832cfe4d53eSThomas Hellstrom };
833cfe4d53eSThomas Hellstrom 
834cfe4d53eSThomas Hellstrom 
835cfe4d53eSThomas Hellstrom /**
836cfe4d53eSThomas Hellstrom  * struct drm_vmw_shader_create_arg
837cfe4d53eSThomas Hellstrom  *
838cfe4d53eSThomas Hellstrom  * @shader_type: Shader type of the shader to create.
839cfe4d53eSThomas Hellstrom  * @size: Size of the byte-code in bytes.
840cfe4d53eSThomas Hellstrom  * where the shader byte-code starts
841cfe4d53eSThomas Hellstrom  * @buffer_handle: Buffer handle identifying the buffer containing the
842cfe4d53eSThomas Hellstrom  * shader byte-code
843cfe4d53eSThomas Hellstrom  * @shader_handle: On successful completion contains a handle that
844cfe4d53eSThomas Hellstrom  * can be used to subsequently identify the shader.
845cfe4d53eSThomas Hellstrom  * @offset: Offset in bytes into the buffer given by @buffer_handle,
846cfe4d53eSThomas Hellstrom  *
847cfe4d53eSThomas Hellstrom  * Input / Output argument to the DRM_VMW_CREATE_SHADER Ioctl.
848cfe4d53eSThomas Hellstrom  */
849cfe4d53eSThomas Hellstrom struct drm_vmw_shader_create_arg {
850cfe4d53eSThomas Hellstrom 	enum drm_vmw_shader_type shader_type;
85121de2fdaSMikko Rapeli 	__u32 size;
85221de2fdaSMikko Rapeli 	__u32 buffer_handle;
85321de2fdaSMikko Rapeli 	__u32 shader_handle;
85421de2fdaSMikko Rapeli 	__u64 offset;
855cfe4d53eSThomas Hellstrom };
856cfe4d53eSThomas Hellstrom 
857cfe4d53eSThomas Hellstrom /*************************************************************************/
858cfe4d53eSThomas Hellstrom /**
859cfe4d53eSThomas Hellstrom  * DRM_VMW_UNREF_SHADER - Unreferences a shader
860cfe4d53eSThomas Hellstrom  *
861cfe4d53eSThomas Hellstrom  * Destroys a user-space reference to a shader, optionally destroying
862cfe4d53eSThomas Hellstrom  * it.
863cfe4d53eSThomas Hellstrom  */
864cfe4d53eSThomas Hellstrom 
865cfe4d53eSThomas Hellstrom /**
866cfe4d53eSThomas Hellstrom  * struct drm_vmw_shader_arg
867cfe4d53eSThomas Hellstrom  *
868cfe4d53eSThomas Hellstrom  * @handle: Handle identifying the shader to destroy.
869cfe4d53eSThomas Hellstrom  *
870cfe4d53eSThomas Hellstrom  * Input argument to the DRM_VMW_UNREF_SHADER ioctl.
871cfe4d53eSThomas Hellstrom  */
872cfe4d53eSThomas Hellstrom struct drm_vmw_shader_arg {
87321de2fdaSMikko Rapeli 	__u32 handle;
87421de2fdaSMikko Rapeli 	__u32 pad64;
875cfe4d53eSThomas Hellstrom };
876cfe4d53eSThomas Hellstrom 
877cfe4d53eSThomas Hellstrom /*************************************************************************/
878cfe4d53eSThomas Hellstrom /**
879cfe4d53eSThomas Hellstrom  * DRM_VMW_GB_SURFACE_CREATE - Create a host guest-backed surface.
880cfe4d53eSThomas Hellstrom  *
881cfe4d53eSThomas Hellstrom  * Allocates a surface handle and queues a create surface command
882cfe4d53eSThomas Hellstrom  * for the host on the first use of the surface. The surface ID can
883cfe4d53eSThomas Hellstrom  * be used as the surface ID in commands referencing the surface.
884cfe4d53eSThomas Hellstrom  */
885cfe4d53eSThomas Hellstrom 
886cfe4d53eSThomas Hellstrom /**
887cfe4d53eSThomas Hellstrom  * enum drm_vmw_surface_flags
888cfe4d53eSThomas Hellstrom  *
889cfe4d53eSThomas Hellstrom  * @drm_vmw_surface_flag_shareable:     Whether the surface is shareable
890cfe4d53eSThomas Hellstrom  * @drm_vmw_surface_flag_scanout:       Whether the surface is a scanout
891cfe4d53eSThomas Hellstrom  *                                      surface.
892cfe4d53eSThomas Hellstrom  * @drm_vmw_surface_flag_create_buffer: Create a backup buffer if none is
893cfe4d53eSThomas Hellstrom  *                                      given.
894cfe4d53eSThomas Hellstrom  */
895cfe4d53eSThomas Hellstrom enum drm_vmw_surface_flags {
896cfe4d53eSThomas Hellstrom 	drm_vmw_surface_flag_shareable = (1 << 0),
897cfe4d53eSThomas Hellstrom 	drm_vmw_surface_flag_scanout = (1 << 1),
898cfe4d53eSThomas Hellstrom 	drm_vmw_surface_flag_create_buffer = (1 << 2)
899cfe4d53eSThomas Hellstrom };
900cfe4d53eSThomas Hellstrom 
901cfe4d53eSThomas Hellstrom /**
902cfe4d53eSThomas Hellstrom  * struct drm_vmw_gb_surface_create_req
903cfe4d53eSThomas Hellstrom  *
904cfe4d53eSThomas Hellstrom  * @svga3d_flags:     SVGA3d surface flags for the device.
905cfe4d53eSThomas Hellstrom  * @format:           SVGA3d format.
906cfe4d53eSThomas Hellstrom  * @mip_level:        Number of mip levels for all faces.
907cfe4d53eSThomas Hellstrom  * @drm_surface_flags Flags as described above.
90815c6f656SZack Rusin  * @multisample_count Future use. Set to 0.
909cfe4d53eSThomas Hellstrom  * @autogen_filter    Future use. Set to 0.
910cfe4d53eSThomas Hellstrom  * @buffer_handle     Buffer handle of backup buffer. SVGA3D_INVALID_ID
911cfe4d53eSThomas Hellstrom  *                    if none.
912cfe4d53eSThomas Hellstrom  * @base_size         Size of the base mip level for all faces.
913d80efd5cSThomas Hellstrom  * @array_size        Must be zero for non-DX hardware, and if non-zero
914d80efd5cSThomas Hellstrom  *                    svga3d_flags must have proper bind flags setup.
915cfe4d53eSThomas Hellstrom  *
916cfe4d53eSThomas Hellstrom  * Input argument to the  DRM_VMW_GB_SURFACE_CREATE Ioctl.
917cfe4d53eSThomas Hellstrom  * Part of output argument for the DRM_VMW_GB_SURFACE_REF Ioctl.
918cfe4d53eSThomas Hellstrom  */
919cfe4d53eSThomas Hellstrom struct drm_vmw_gb_surface_create_req {
92021de2fdaSMikko Rapeli 	__u32 svga3d_flags;
92121de2fdaSMikko Rapeli 	__u32 format;
92221de2fdaSMikko Rapeli 	__u32 mip_levels;
923cfe4d53eSThomas Hellstrom 	enum drm_vmw_surface_flags drm_surface_flags;
92421de2fdaSMikko Rapeli 	__u32 multisample_count;
92521de2fdaSMikko Rapeli 	__u32 autogen_filter;
92621de2fdaSMikko Rapeli 	__u32 buffer_handle;
92721de2fdaSMikko Rapeli 	__u32 array_size;
928cfe4d53eSThomas Hellstrom 	struct drm_vmw_size base_size;
929cfe4d53eSThomas Hellstrom };
930cfe4d53eSThomas Hellstrom 
931cfe4d53eSThomas Hellstrom /**
932cfe4d53eSThomas Hellstrom  * struct drm_vmw_gb_surface_create_rep
933cfe4d53eSThomas Hellstrom  *
934cfe4d53eSThomas Hellstrom  * @handle:            Surface handle.
935cfe4d53eSThomas Hellstrom  * @backup_size:       Size of backup buffers for this surface.
936cfe4d53eSThomas Hellstrom  * @buffer_handle:     Handle of backup buffer. SVGA3D_INVALID_ID if none.
937cfe4d53eSThomas Hellstrom  * @buffer_size:       Actual size of the buffer identified by
938cfe4d53eSThomas Hellstrom  *                     @buffer_handle
939cfe4d53eSThomas Hellstrom  * @buffer_map_handle: Offset into device address space for the buffer
940cfe4d53eSThomas Hellstrom  *                     identified by @buffer_handle.
941cfe4d53eSThomas Hellstrom  *
942cfe4d53eSThomas Hellstrom  * Part of output argument for the DRM_VMW_GB_SURFACE_REF ioctl.
943cfe4d53eSThomas Hellstrom  * Output argument for the DRM_VMW_GB_SURFACE_CREATE ioctl.
944cfe4d53eSThomas Hellstrom  */
945cfe4d53eSThomas Hellstrom struct drm_vmw_gb_surface_create_rep {
94621de2fdaSMikko Rapeli 	__u32 handle;
94721de2fdaSMikko Rapeli 	__u32 backup_size;
94821de2fdaSMikko Rapeli 	__u32 buffer_handle;
94921de2fdaSMikko Rapeli 	__u32 buffer_size;
95021de2fdaSMikko Rapeli 	__u64 buffer_map_handle;
951cfe4d53eSThomas Hellstrom };
952cfe4d53eSThomas Hellstrom 
953cfe4d53eSThomas Hellstrom /**
954cfe4d53eSThomas Hellstrom  * union drm_vmw_gb_surface_create_arg
955cfe4d53eSThomas Hellstrom  *
956cfe4d53eSThomas Hellstrom  * @req: Input argument as described above.
957cfe4d53eSThomas Hellstrom  * @rep: Output argument as described above.
958cfe4d53eSThomas Hellstrom  *
959cfe4d53eSThomas Hellstrom  * Argument to the DRM_VMW_GB_SURFACE_CREATE ioctl.
960cfe4d53eSThomas Hellstrom  */
961cfe4d53eSThomas Hellstrom union drm_vmw_gb_surface_create_arg {
962cfe4d53eSThomas Hellstrom 	struct drm_vmw_gb_surface_create_rep rep;
963cfe4d53eSThomas Hellstrom 	struct drm_vmw_gb_surface_create_req req;
964cfe4d53eSThomas Hellstrom };
965cfe4d53eSThomas Hellstrom 
966cfe4d53eSThomas Hellstrom /*************************************************************************/
967cfe4d53eSThomas Hellstrom /**
968cfe4d53eSThomas Hellstrom  * DRM_VMW_GB_SURFACE_REF - Reference a host surface.
969cfe4d53eSThomas Hellstrom  *
970cfe4d53eSThomas Hellstrom  * Puts a reference on a host surface with a given handle, as previously
971cfe4d53eSThomas Hellstrom  * returned by the DRM_VMW_GB_SURFACE_CREATE ioctl.
972cfe4d53eSThomas Hellstrom  * A reference will make sure the surface isn't destroyed while we hold
973cfe4d53eSThomas Hellstrom  * it and will allow the calling client to use the surface handle in
974cfe4d53eSThomas Hellstrom  * the command stream.
975cfe4d53eSThomas Hellstrom  *
976cfe4d53eSThomas Hellstrom  * On successful return, the Ioctl returns the surface information given
977cfe4d53eSThomas Hellstrom  * to and returned from the DRM_VMW_GB_SURFACE_CREATE ioctl.
978cfe4d53eSThomas Hellstrom  */
979cfe4d53eSThomas Hellstrom 
980cfe4d53eSThomas Hellstrom /**
981cfe4d53eSThomas Hellstrom  * struct drm_vmw_gb_surface_reference_arg
982cfe4d53eSThomas Hellstrom  *
983cfe4d53eSThomas Hellstrom  * @creq: The data used as input when the surface was created, as described
984cfe4d53eSThomas Hellstrom  *        above at "struct drm_vmw_gb_surface_create_req"
985cfe4d53eSThomas Hellstrom  * @crep: Additional data output when the surface was created, as described
986cfe4d53eSThomas Hellstrom  *        above at "struct drm_vmw_gb_surface_create_rep"
987cfe4d53eSThomas Hellstrom  *
988cfe4d53eSThomas Hellstrom  * Output Argument to the DRM_VMW_GB_SURFACE_REF ioctl.
989cfe4d53eSThomas Hellstrom  */
990cfe4d53eSThomas Hellstrom struct drm_vmw_gb_surface_ref_rep {
991cfe4d53eSThomas Hellstrom 	struct drm_vmw_gb_surface_create_req creq;
992cfe4d53eSThomas Hellstrom 	struct drm_vmw_gb_surface_create_rep crep;
993cfe4d53eSThomas Hellstrom };
994cfe4d53eSThomas Hellstrom 
995cfe4d53eSThomas Hellstrom /**
996cfe4d53eSThomas Hellstrom  * union drm_vmw_gb_surface_reference_arg
997cfe4d53eSThomas Hellstrom  *
998cfe4d53eSThomas Hellstrom  * @req: Input data as described above at "struct drm_vmw_surface_arg"
999cfe4d53eSThomas Hellstrom  * @rep: Output data as described above at "struct drm_vmw_gb_surface_ref_rep"
1000cfe4d53eSThomas Hellstrom  *
1001cfe4d53eSThomas Hellstrom  * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl.
1002cfe4d53eSThomas Hellstrom  */
1003cfe4d53eSThomas Hellstrom union drm_vmw_gb_surface_reference_arg {
1004cfe4d53eSThomas Hellstrom 	struct drm_vmw_gb_surface_ref_rep rep;
1005cfe4d53eSThomas Hellstrom 	struct drm_vmw_surface_arg req;
1006cfe4d53eSThomas Hellstrom };
1007cfe4d53eSThomas Hellstrom 
1008cfe4d53eSThomas Hellstrom 
10091d7a5cbfSThomas Hellstrom /*************************************************************************/
10101d7a5cbfSThomas Hellstrom /**
10111d7a5cbfSThomas Hellstrom  * DRM_VMW_SYNCCPU - Sync a DMA buffer / MOB for CPU access.
10121d7a5cbfSThomas Hellstrom  *
10131d7a5cbfSThomas Hellstrom  * Idles any previously submitted GPU operations on the buffer and
10141d7a5cbfSThomas Hellstrom  * by default blocks command submissions that reference the buffer.
10151d7a5cbfSThomas Hellstrom  * If the file descriptor used to grab a blocking CPU sync is closed, the
10161d7a5cbfSThomas Hellstrom  * cpu sync is released.
10171d7a5cbfSThomas Hellstrom  * The flags argument indicates how the grab / release operation should be
10181d7a5cbfSThomas Hellstrom  * performed:
10191d7a5cbfSThomas Hellstrom  */
10201d7a5cbfSThomas Hellstrom 
10211d7a5cbfSThomas Hellstrom /**
10221d7a5cbfSThomas Hellstrom  * enum drm_vmw_synccpu_flags - Synccpu flags:
10231d7a5cbfSThomas Hellstrom  *
10241d7a5cbfSThomas Hellstrom  * @drm_vmw_synccpu_read: Sync for read. If sync is done for read only, it's a
10251d7a5cbfSThomas Hellstrom  * hint to the kernel to allow command submissions that references the buffer
10261d7a5cbfSThomas Hellstrom  * for read-only.
10271d7a5cbfSThomas Hellstrom  * @drm_vmw_synccpu_write: Sync for write. Block all command submissions
10281d7a5cbfSThomas Hellstrom  * referencing this buffer.
10291d7a5cbfSThomas Hellstrom  * @drm_vmw_synccpu_dontblock: Dont wait for GPU idle, but rather return
10301d7a5cbfSThomas Hellstrom  * -EBUSY should the buffer be busy.
10311d7a5cbfSThomas Hellstrom  * @drm_vmw_synccpu_allow_cs: Allow command submission that touches the buffer
10321d7a5cbfSThomas Hellstrom  * while the buffer is synced for CPU. This is similar to the GEM bo idle
10331d7a5cbfSThomas Hellstrom  * behavior.
10341d7a5cbfSThomas Hellstrom  */
10351d7a5cbfSThomas Hellstrom enum drm_vmw_synccpu_flags {
10361d7a5cbfSThomas Hellstrom 	drm_vmw_synccpu_read = (1 << 0),
10371d7a5cbfSThomas Hellstrom 	drm_vmw_synccpu_write = (1 << 1),
10381d7a5cbfSThomas Hellstrom 	drm_vmw_synccpu_dontblock = (1 << 2),
10391d7a5cbfSThomas Hellstrom 	drm_vmw_synccpu_allow_cs = (1 << 3)
10401d7a5cbfSThomas Hellstrom };
10411d7a5cbfSThomas Hellstrom 
10421d7a5cbfSThomas Hellstrom /**
10431d7a5cbfSThomas Hellstrom  * enum drm_vmw_synccpu_op - Synccpu operations:
10441d7a5cbfSThomas Hellstrom  *
10451d7a5cbfSThomas Hellstrom  * @drm_vmw_synccpu_grab:    Grab the buffer for CPU operations
10461d7a5cbfSThomas Hellstrom  * @drm_vmw_synccpu_release: Release a previous grab.
10471d7a5cbfSThomas Hellstrom  */
10481d7a5cbfSThomas Hellstrom enum drm_vmw_synccpu_op {
10491d7a5cbfSThomas Hellstrom 	drm_vmw_synccpu_grab,
10501d7a5cbfSThomas Hellstrom 	drm_vmw_synccpu_release
10511d7a5cbfSThomas Hellstrom };
10521d7a5cbfSThomas Hellstrom 
10531d7a5cbfSThomas Hellstrom /**
10541d7a5cbfSThomas Hellstrom  * struct drm_vmw_synccpu_arg
10551d7a5cbfSThomas Hellstrom  *
10561d7a5cbfSThomas Hellstrom  * @op:			     The synccpu operation as described above.
10571d7a5cbfSThomas Hellstrom  * @handle:		     Handle identifying the buffer object.
10581d7a5cbfSThomas Hellstrom  * @flags:		     Flags as described above.
10591d7a5cbfSThomas Hellstrom  */
10601d7a5cbfSThomas Hellstrom struct drm_vmw_synccpu_arg {
10611d7a5cbfSThomas Hellstrom 	enum drm_vmw_synccpu_op op;
10621d7a5cbfSThomas Hellstrom 	enum drm_vmw_synccpu_flags flags;
106321de2fdaSMikko Rapeli 	__u32 handle;
106421de2fdaSMikko Rapeli 	__u32 pad64;
10651d7a5cbfSThomas Hellstrom };
1066cfe4d53eSThomas Hellstrom 
1067d80efd5cSThomas Hellstrom /*************************************************************************/
1068d80efd5cSThomas Hellstrom /**
1069d80efd5cSThomas Hellstrom  * DRM_VMW_CREATE_EXTENDED_CONTEXT - Create a host context.
1070d80efd5cSThomas Hellstrom  *
1071d80efd5cSThomas Hellstrom  * Allocates a device unique context id, and queues a create context command
1072d80efd5cSThomas Hellstrom  * for the host. Does not wait for host completion.
1073d80efd5cSThomas Hellstrom  */
1074d80efd5cSThomas Hellstrom enum drm_vmw_extended_context {
1075d80efd5cSThomas Hellstrom 	drm_vmw_context_legacy,
1076d80efd5cSThomas Hellstrom 	drm_vmw_context_dx
1077d80efd5cSThomas Hellstrom };
1078d80efd5cSThomas Hellstrom 
1079d80efd5cSThomas Hellstrom /**
1080d80efd5cSThomas Hellstrom  * union drm_vmw_extended_context_arg
1081d80efd5cSThomas Hellstrom  *
1082d80efd5cSThomas Hellstrom  * @req: Context type.
1083d80efd5cSThomas Hellstrom  * @rep: Context identifier.
1084d80efd5cSThomas Hellstrom  *
1085d80efd5cSThomas Hellstrom  * Argument to the DRM_VMW_CREATE_EXTENDED_CONTEXT Ioctl.
1086d80efd5cSThomas Hellstrom  */
1087d80efd5cSThomas Hellstrom union drm_vmw_extended_context_arg {
1088d80efd5cSThomas Hellstrom 	enum drm_vmw_extended_context req;
1089d80efd5cSThomas Hellstrom 	struct drm_vmw_context_arg rep;
1090d80efd5cSThomas Hellstrom };
1091d3450e00SEmil Velikov 
10922f9545ceSThomas Hellstrom /*************************************************************************/
10932f9545ceSThomas Hellstrom /*
10942f9545ceSThomas Hellstrom  * DRM_VMW_HANDLE_CLOSE - Close a user-space handle and release its
10952f9545ceSThomas Hellstrom  * underlying resource.
10962f9545ceSThomas Hellstrom  *
1097f1d34bfdSThomas Hellstrom  * Note that this ioctl is overlaid on the deprecated DRM_VMW_UNREF_DMABUF
1098f1d34bfdSThomas Hellstrom  * Ioctl.
10992f9545ceSThomas Hellstrom  */
11002f9545ceSThomas Hellstrom 
11012f9545ceSThomas Hellstrom /**
11022f9545ceSThomas Hellstrom  * struct drm_vmw_handle_close_arg
11032f9545ceSThomas Hellstrom  *
11042f9545ceSThomas Hellstrom  * @handle: Handle to close.
11052f9545ceSThomas Hellstrom  *
11062f9545ceSThomas Hellstrom  * Argument to the DRM_VMW_HANDLE_CLOSE Ioctl.
11072f9545ceSThomas Hellstrom  */
11082f9545ceSThomas Hellstrom struct drm_vmw_handle_close_arg {
11092f9545ceSThomas Hellstrom 	__u32 handle;
11102f9545ceSThomas Hellstrom 	__u32 pad64;
11112f9545ceSThomas Hellstrom };
1112f1d34bfdSThomas Hellstrom #define drm_vmw_unref_dmabuf_arg drm_vmw_handle_close_arg
11132f9545ceSThomas Hellstrom 
111414b1c33eSDeepak Rawat /*************************************************************************/
111514b1c33eSDeepak Rawat /**
111614b1c33eSDeepak Rawat  * DRM_VMW_GB_SURFACE_CREATE_EXT - Create a host guest-backed surface.
111714b1c33eSDeepak Rawat  *
111814b1c33eSDeepak Rawat  * Allocates a surface handle and queues a create surface command
111914b1c33eSDeepak Rawat  * for the host on the first use of the surface. The surface ID can
112014b1c33eSDeepak Rawat  * be used as the surface ID in commands referencing the surface.
112114b1c33eSDeepak Rawat  *
112214b1c33eSDeepak Rawat  * This new command extends DRM_VMW_GB_SURFACE_CREATE by adding version
112314b1c33eSDeepak Rawat  * parameter and 64 bit svga flag.
112414b1c33eSDeepak Rawat  */
112514b1c33eSDeepak Rawat 
112614b1c33eSDeepak Rawat /**
112714b1c33eSDeepak Rawat  * enum drm_vmw_surface_version
112814b1c33eSDeepak Rawat  *
112914b1c33eSDeepak Rawat  * @drm_vmw_surface_gb_v1: Corresponds to current gb surface format with
113014b1c33eSDeepak Rawat  * svga3d surface flags split into 2, upper half and lower half.
113114b1c33eSDeepak Rawat  */
113214b1c33eSDeepak Rawat enum drm_vmw_surface_version {
113314b1c33eSDeepak Rawat 	drm_vmw_gb_surface_v1
113414b1c33eSDeepak Rawat };
113514b1c33eSDeepak Rawat 
113614b1c33eSDeepak Rawat /**
113714b1c33eSDeepak Rawat  * struct drm_vmw_gb_surface_create_ext_req
113814b1c33eSDeepak Rawat  *
113914b1c33eSDeepak Rawat  * @base: Surface create parameters.
114014b1c33eSDeepak Rawat  * @version: Version of surface create ioctl.
114114b1c33eSDeepak Rawat  * @svga3d_flags_upper_32_bits: Upper 32 bits of svga3d flags.
114214b1c33eSDeepak Rawat  * @multisample_pattern: Multisampling pattern when msaa is supported.
114314b1c33eSDeepak Rawat  * @quality_level: Precision settings for each sample.
114414b1c33eSDeepak Rawat  * @must_be_zero: Reserved for future usage.
114514b1c33eSDeepak Rawat  *
114614b1c33eSDeepak Rawat  * Input argument to the  DRM_VMW_GB_SURFACE_CREATE_EXT Ioctl.
114714b1c33eSDeepak Rawat  * Part of output argument for the DRM_VMW_GB_SURFACE_REF_EXT Ioctl.
114814b1c33eSDeepak Rawat  */
114914b1c33eSDeepak Rawat struct drm_vmw_gb_surface_create_ext_req {
115014b1c33eSDeepak Rawat 	struct drm_vmw_gb_surface_create_req base;
115114b1c33eSDeepak Rawat 	enum drm_vmw_surface_version version;
115214b1c33eSDeepak Rawat 	uint32_t svga3d_flags_upper_32_bits;
115314b1c33eSDeepak Rawat 	SVGA3dMSPattern multisample_pattern;
115414b1c33eSDeepak Rawat 	SVGA3dMSQualityLevel quality_level;
115514b1c33eSDeepak Rawat 	uint64_t must_be_zero;
115614b1c33eSDeepak Rawat };
115714b1c33eSDeepak Rawat 
115814b1c33eSDeepak Rawat /**
115914b1c33eSDeepak Rawat  * union drm_vmw_gb_surface_create_ext_arg
116014b1c33eSDeepak Rawat  *
116114b1c33eSDeepak Rawat  * @req: Input argument as described above.
116214b1c33eSDeepak Rawat  * @rep: Output argument as described above.
116314b1c33eSDeepak Rawat  *
116414b1c33eSDeepak Rawat  * Argument to the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl.
116514b1c33eSDeepak Rawat  */
116614b1c33eSDeepak Rawat union drm_vmw_gb_surface_create_ext_arg {
116714b1c33eSDeepak Rawat 	struct drm_vmw_gb_surface_create_rep rep;
116814b1c33eSDeepak Rawat 	struct drm_vmw_gb_surface_create_ext_req req;
116914b1c33eSDeepak Rawat };
117014b1c33eSDeepak Rawat 
117114b1c33eSDeepak Rawat /*************************************************************************/
117214b1c33eSDeepak Rawat /**
117314b1c33eSDeepak Rawat  * DRM_VMW_GB_SURFACE_REF_EXT - Reference a host surface.
117414b1c33eSDeepak Rawat  *
117514b1c33eSDeepak Rawat  * Puts a reference on a host surface with a given handle, as previously
117614b1c33eSDeepak Rawat  * returned by the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl.
117714b1c33eSDeepak Rawat  * A reference will make sure the surface isn't destroyed while we hold
117814b1c33eSDeepak Rawat  * it and will allow the calling client to use the surface handle in
117914b1c33eSDeepak Rawat  * the command stream.
118014b1c33eSDeepak Rawat  *
118114b1c33eSDeepak Rawat  * On successful return, the Ioctl returns the surface information given
118214b1c33eSDeepak Rawat  * to and returned from the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl.
118314b1c33eSDeepak Rawat  */
118414b1c33eSDeepak Rawat 
118514b1c33eSDeepak Rawat /**
118614b1c33eSDeepak Rawat  * struct drm_vmw_gb_surface_ref_ext_rep
118714b1c33eSDeepak Rawat  *
118814b1c33eSDeepak Rawat  * @creq: The data used as input when the surface was created, as described
118914b1c33eSDeepak Rawat  *        above at "struct drm_vmw_gb_surface_create_ext_req"
119014b1c33eSDeepak Rawat  * @crep: Additional data output when the surface was created, as described
119114b1c33eSDeepak Rawat  *        above at "struct drm_vmw_gb_surface_create_rep"
119214b1c33eSDeepak Rawat  *
119314b1c33eSDeepak Rawat  * Output Argument to the DRM_VMW_GB_SURFACE_REF_EXT ioctl.
119414b1c33eSDeepak Rawat  */
119514b1c33eSDeepak Rawat struct drm_vmw_gb_surface_ref_ext_rep {
119614b1c33eSDeepak Rawat 	struct drm_vmw_gb_surface_create_ext_req creq;
119714b1c33eSDeepak Rawat 	struct drm_vmw_gb_surface_create_rep crep;
119814b1c33eSDeepak Rawat };
119914b1c33eSDeepak Rawat 
120014b1c33eSDeepak Rawat /**
120114b1c33eSDeepak Rawat  * union drm_vmw_gb_surface_reference_ext_arg
120214b1c33eSDeepak Rawat  *
120314b1c33eSDeepak Rawat  * @req: Input data as described above at "struct drm_vmw_surface_arg"
120414b1c33eSDeepak Rawat  * @rep: Output data as described above at
120514b1c33eSDeepak Rawat  *       "struct drm_vmw_gb_surface_ref_ext_rep"
120614b1c33eSDeepak Rawat  *
120714b1c33eSDeepak Rawat  * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl.
120814b1c33eSDeepak Rawat  */
120914b1c33eSDeepak Rawat union drm_vmw_gb_surface_reference_ext_arg {
121014b1c33eSDeepak Rawat 	struct drm_vmw_gb_surface_ref_ext_rep rep;
121114b1c33eSDeepak Rawat 	struct drm_vmw_surface_arg req;
121214b1c33eSDeepak Rawat };
121314b1c33eSDeepak Rawat 
1214d3450e00SEmil Velikov #if defined(__cplusplus)
1215d3450e00SEmil Velikov }
1216d3450e00SEmil Velikov #endif
1217d3450e00SEmil Velikov 
1218718dceddSDavid Howells #endif
1219