xref: /openbmc/linux/include/uapi/drm/vmwgfx_drm.h (revision 23b0e695)
1718dceddSDavid Howells /**************************************************************************
2718dceddSDavid Howells  *
3*23b0e695SZack Rusin  * Copyright © 2009-2022 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.
95*23b0e695SZack Rusin  *
96*23b0e695SZack Rusin  * DRM_VMW_PARAM_GL43
97*23b0e695SZack Rusin  * SM5.1+GL4.3 support is enabled.
98*23b0e695SZack Rusin  *
99*23b0e695SZack Rusin  * DRM_VMW_PARAM_DEVICE_ID
100*23b0e695SZack Rusin  * PCI ID of the underlying SVGA device.
101718dceddSDavid Howells  */
102718dceddSDavid Howells 
103718dceddSDavid Howells #define DRM_VMW_PARAM_NUM_STREAMS      0
104718dceddSDavid Howells #define DRM_VMW_PARAM_NUM_FREE_STREAMS 1
105718dceddSDavid Howells #define DRM_VMW_PARAM_3D               2
106718dceddSDavid Howells #define DRM_VMW_PARAM_HW_CAPS          3
107718dceddSDavid Howells #define DRM_VMW_PARAM_FIFO_CAPS        4
108718dceddSDavid Howells #define DRM_VMW_PARAM_MAX_FB_SIZE      5
109718dceddSDavid Howells #define DRM_VMW_PARAM_FIFO_HW_VERSION  6
110cfe4d53eSThomas Hellstrom #define DRM_VMW_PARAM_MAX_SURF_MEMORY  7
111cfe4d53eSThomas Hellstrom #define DRM_VMW_PARAM_3D_CAPS_SIZE     8
112311474dbSThomas Hellstrom #define DRM_VMW_PARAM_MAX_MOB_MEMORY   9
113857aea1cSCharmaine Lee #define DRM_VMW_PARAM_MAX_MOB_SIZE     10
11435c05125SSinclair Yeh #define DRM_VMW_PARAM_SCREEN_TARGET    11
115d80efd5cSThomas Hellstrom #define DRM_VMW_PARAM_DX               12
1163b4c2511SNeha Bhende #define DRM_VMW_PARAM_HW_CAPS2         13
1179b07b287SDeepak Rawat #define DRM_VMW_PARAM_SM4_1            14
118f0fce233SDeepak Rawat #define DRM_VMW_PARAM_SM5              15
119abaad3d9SZack Rusin #define DRM_VMW_PARAM_GL43             16
120*23b0e695SZack Rusin #define DRM_VMW_PARAM_DEVICE_ID        17
121718dceddSDavid Howells 
122718dceddSDavid Howells /**
123adebcb20SThomas Hellstrom  * enum drm_vmw_handle_type - handle type for ref ioctls
124adebcb20SThomas Hellstrom  *
125adebcb20SThomas Hellstrom  */
126adebcb20SThomas Hellstrom enum drm_vmw_handle_type {
127adebcb20SThomas Hellstrom 	DRM_VMW_HANDLE_LEGACY = 0,
128adebcb20SThomas Hellstrom 	DRM_VMW_HANDLE_PRIME = 1
129adebcb20SThomas Hellstrom };
130adebcb20SThomas Hellstrom 
131adebcb20SThomas Hellstrom /**
132718dceddSDavid Howells  * struct drm_vmw_getparam_arg
133718dceddSDavid Howells  *
134718dceddSDavid Howells  * @value: Returned value. //Out
135718dceddSDavid Howells  * @param: Parameter to query. //In.
136718dceddSDavid Howells  *
137718dceddSDavid Howells  * Argument to the DRM_VMW_GET_PARAM Ioctl.
138718dceddSDavid Howells  */
139718dceddSDavid Howells 
140718dceddSDavid Howells struct drm_vmw_getparam_arg {
14121de2fdaSMikko Rapeli 	__u64 value;
14221de2fdaSMikko Rapeli 	__u32 param;
14321de2fdaSMikko Rapeli 	__u32 pad64;
144718dceddSDavid Howells };
145718dceddSDavid Howells 
146718dceddSDavid Howells /*************************************************************************/
147718dceddSDavid Howells /**
148718dceddSDavid Howells  * DRM_VMW_CREATE_CONTEXT - Create a host context.
149718dceddSDavid Howells  *
150718dceddSDavid Howells  * Allocates a device unique context id, and queues a create context command
151718dceddSDavid Howells  * for the host. Does not wait for host completion.
152718dceddSDavid Howells  */
153718dceddSDavid Howells 
154718dceddSDavid Howells /**
155718dceddSDavid Howells  * struct drm_vmw_context_arg
156718dceddSDavid Howells  *
157718dceddSDavid Howells  * @cid: Device unique context ID.
158718dceddSDavid Howells  *
159718dceddSDavid Howells  * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
160718dceddSDavid Howells  * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
161718dceddSDavid Howells  */
162718dceddSDavid Howells 
163718dceddSDavid Howells struct drm_vmw_context_arg {
16421de2fdaSMikko Rapeli 	__s32 cid;
16521de2fdaSMikko Rapeli 	__u32 pad64;
166718dceddSDavid Howells };
167718dceddSDavid Howells 
168718dceddSDavid Howells /*************************************************************************/
169718dceddSDavid Howells /**
170718dceddSDavid Howells  * DRM_VMW_UNREF_CONTEXT - Create a host context.
171718dceddSDavid Howells  *
172718dceddSDavid Howells  * Frees a global context id, and queues a destroy host command for the host.
173718dceddSDavid Howells  * Does not wait for host completion. The context ID can be used directly
174718dceddSDavid Howells  * in the command stream and shows up as the same context ID on the host.
175718dceddSDavid Howells  */
176718dceddSDavid Howells 
177718dceddSDavid Howells /*************************************************************************/
178718dceddSDavid Howells /**
179718dceddSDavid Howells  * DRM_VMW_CREATE_SURFACE - Create a host suface.
180718dceddSDavid Howells  *
181718dceddSDavid Howells  * Allocates a device unique surface id, and queues a create surface command
182718dceddSDavid Howells  * for the host. Does not wait for host completion. The surface ID can be
183718dceddSDavid Howells  * used directly in the command stream and shows up as the same surface
184718dceddSDavid Howells  * ID on the host.
185718dceddSDavid Howells  */
186718dceddSDavid Howells 
187718dceddSDavid Howells /**
188718dceddSDavid Howells  * struct drm_wmv_surface_create_req
189718dceddSDavid Howells  *
190718dceddSDavid Howells  * @flags: Surface flags as understood by the host.
191718dceddSDavid Howells  * @format: Surface format as understood by the host.
192718dceddSDavid Howells  * @mip_levels: Number of mip levels for each face.
193718dceddSDavid Howells  * An unused face should have 0 encoded.
194718dceddSDavid Howells  * @size_addr: Address of a user-space array of sruct drm_vmw_size
19521de2fdaSMikko Rapeli  * cast to an __u64 for 32-64 bit compatibility.
196718dceddSDavid Howells  * The size of the array should equal the total number of mipmap levels.
197718dceddSDavid Howells  * @shareable: Boolean whether other clients (as identified by file descriptors)
198718dceddSDavid Howells  * may reference this surface.
199718dceddSDavid Howells  * @scanout: Boolean whether the surface is intended to be used as a
200718dceddSDavid Howells  * scanout.
201718dceddSDavid Howells  *
202718dceddSDavid Howells  * Input data to the DRM_VMW_CREATE_SURFACE Ioctl.
203718dceddSDavid Howells  * Output data from the DRM_VMW_REF_SURFACE Ioctl.
204718dceddSDavid Howells  */
205718dceddSDavid Howells 
206718dceddSDavid Howells struct drm_vmw_surface_create_req {
20721de2fdaSMikko Rapeli 	__u32 flags;
20821de2fdaSMikko Rapeli 	__u32 format;
20921de2fdaSMikko Rapeli 	__u32 mip_levels[DRM_VMW_MAX_SURFACE_FACES];
21021de2fdaSMikko Rapeli 	__u64 size_addr;
21121de2fdaSMikko Rapeli 	__s32 shareable;
21221de2fdaSMikko Rapeli 	__s32 scanout;
213718dceddSDavid Howells };
214718dceddSDavid Howells 
215718dceddSDavid Howells /**
216718dceddSDavid Howells  * struct drm_wmv_surface_arg
217718dceddSDavid Howells  *
218718dceddSDavid Howells  * @sid: Surface id of created surface or surface to destroy or reference.
219adebcb20SThomas Hellstrom  * @handle_type: Handle type for DRM_VMW_REF_SURFACE Ioctl.
220718dceddSDavid Howells  *
221718dceddSDavid Howells  * Output data from the DRM_VMW_CREATE_SURFACE Ioctl.
222718dceddSDavid Howells  * Input argument to the DRM_VMW_UNREF_SURFACE Ioctl.
223718dceddSDavid Howells  * Input argument to the DRM_VMW_REF_SURFACE Ioctl.
224718dceddSDavid Howells  */
225718dceddSDavid Howells 
226718dceddSDavid Howells struct drm_vmw_surface_arg {
22721de2fdaSMikko Rapeli 	__s32 sid;
228adebcb20SThomas Hellstrom 	enum drm_vmw_handle_type handle_type;
229718dceddSDavid Howells };
230718dceddSDavid Howells 
231718dceddSDavid Howells /**
232718dceddSDavid Howells  * struct drm_vmw_size ioctl.
233718dceddSDavid Howells  *
234718dceddSDavid Howells  * @width - mip level width
235718dceddSDavid Howells  * @height - mip level height
236718dceddSDavid Howells  * @depth - mip level depth
237718dceddSDavid Howells  *
238718dceddSDavid Howells  * Description of a mip level.
239718dceddSDavid Howells  * Input data to the DRM_WMW_CREATE_SURFACE Ioctl.
240718dceddSDavid Howells  */
241718dceddSDavid Howells 
242718dceddSDavid Howells struct drm_vmw_size {
24321de2fdaSMikko Rapeli 	__u32 width;
24421de2fdaSMikko Rapeli 	__u32 height;
24521de2fdaSMikko Rapeli 	__u32 depth;
24621de2fdaSMikko Rapeli 	__u32 pad64;
247718dceddSDavid Howells };
248718dceddSDavid Howells 
249718dceddSDavid Howells /**
250718dceddSDavid Howells  * union drm_vmw_surface_create_arg
251718dceddSDavid Howells  *
252718dceddSDavid Howells  * @rep: Output data as described above.
253718dceddSDavid Howells  * @req: Input data as described above.
254718dceddSDavid Howells  *
255718dceddSDavid Howells  * Argument to the DRM_VMW_CREATE_SURFACE Ioctl.
256718dceddSDavid Howells  */
257718dceddSDavid Howells 
258718dceddSDavid Howells union drm_vmw_surface_create_arg {
259718dceddSDavid Howells 	struct drm_vmw_surface_arg rep;
260718dceddSDavid Howells 	struct drm_vmw_surface_create_req req;
261718dceddSDavid Howells };
262718dceddSDavid Howells 
263718dceddSDavid Howells /*************************************************************************/
264718dceddSDavid Howells /**
265718dceddSDavid Howells  * DRM_VMW_REF_SURFACE - Reference a host surface.
266718dceddSDavid Howells  *
267718dceddSDavid Howells  * Puts a reference on a host surface with a give sid, as previously
268718dceddSDavid Howells  * returned by the DRM_VMW_CREATE_SURFACE ioctl.
269718dceddSDavid Howells  * A reference will make sure the surface isn't destroyed while we hold
270718dceddSDavid Howells  * it and will allow the calling client to use the surface ID in the command
271718dceddSDavid Howells  * stream.
272718dceddSDavid Howells  *
273718dceddSDavid Howells  * On successful return, the Ioctl returns the surface information given
274718dceddSDavid Howells  * in the DRM_VMW_CREATE_SURFACE ioctl.
275718dceddSDavid Howells  */
276718dceddSDavid Howells 
277718dceddSDavid Howells /**
278718dceddSDavid Howells  * union drm_vmw_surface_reference_arg
279718dceddSDavid Howells  *
280718dceddSDavid Howells  * @rep: Output data as described above.
281718dceddSDavid Howells  * @req: Input data as described above.
282718dceddSDavid Howells  *
283718dceddSDavid Howells  * Argument to the DRM_VMW_REF_SURFACE Ioctl.
284718dceddSDavid Howells  */
285718dceddSDavid Howells 
286718dceddSDavid Howells union drm_vmw_surface_reference_arg {
287718dceddSDavid Howells 	struct drm_vmw_surface_create_req rep;
288718dceddSDavid Howells 	struct drm_vmw_surface_arg req;
289718dceddSDavid Howells };
290718dceddSDavid Howells 
291718dceddSDavid Howells /*************************************************************************/
292718dceddSDavid Howells /**
293718dceddSDavid Howells  * DRM_VMW_UNREF_SURFACE - Unreference a host surface.
294718dceddSDavid Howells  *
295718dceddSDavid Howells  * Clear a reference previously put on a host surface.
296718dceddSDavid Howells  * When all references are gone, including the one implicitly placed
297718dceddSDavid Howells  * on creation,
298718dceddSDavid Howells  * a destroy surface command will be queued for the host.
299718dceddSDavid Howells  * Does not wait for completion.
300718dceddSDavid Howells  */
301718dceddSDavid Howells 
302718dceddSDavid Howells /*************************************************************************/
303718dceddSDavid Howells /**
304718dceddSDavid Howells  * DRM_VMW_EXECBUF
305718dceddSDavid Howells  *
306718dceddSDavid Howells  * Submit a command buffer for execution on the host, and return a
307718dceddSDavid Howells  * fence seqno that when signaled, indicates that the command buffer has
308718dceddSDavid Howells  * executed.
309718dceddSDavid Howells  */
310718dceddSDavid Howells 
311718dceddSDavid Howells /**
312718dceddSDavid Howells  * struct drm_vmw_execbuf_arg
313718dceddSDavid Howells  *
31421de2fdaSMikko Rapeli  * @commands: User-space address of a command buffer cast to an __u64.
315718dceddSDavid Howells  * @command-size: Size in bytes of the command buffer.
316718dceddSDavid Howells  * @throttle-us: Sleep until software is less than @throttle_us
317718dceddSDavid Howells  * microseconds ahead of hardware. The driver may round this value
318718dceddSDavid Howells  * to the nearest kernel tick.
319718dceddSDavid Howells  * @fence_rep: User-space address of a struct drm_vmw_fence_rep cast to an
32021de2fdaSMikko Rapeli  * __u64.
321718dceddSDavid Howells  * @version: Allows expanding the execbuf ioctl parameters without breaking
322718dceddSDavid Howells  * backwards compatibility, since user-space will always tell the kernel
323718dceddSDavid Howells  * which version it uses.
3242cfa0bb2SSinclair Yeh  * @flags: Execbuf flags.
3252cfa0bb2SSinclair Yeh  * @imported_fence_fd:  FD for a fence imported from another device
326718dceddSDavid Howells  *
327718dceddSDavid Howells  * Argument to the DRM_VMW_EXECBUF Ioctl.
328718dceddSDavid Howells  */
329718dceddSDavid Howells 
330d80efd5cSThomas Hellstrom #define DRM_VMW_EXECBUF_VERSION 2
331718dceddSDavid Howells 
3322cfa0bb2SSinclair Yeh #define DRM_VMW_EXECBUF_FLAG_IMPORT_FENCE_FD (1 << 0)
3332cfa0bb2SSinclair Yeh #define DRM_VMW_EXECBUF_FLAG_EXPORT_FENCE_FD (1 << 1)
3342cfa0bb2SSinclair Yeh 
335718dceddSDavid Howells struct drm_vmw_execbuf_arg {
33621de2fdaSMikko Rapeli 	__u64 commands;
33721de2fdaSMikko Rapeli 	__u32 command_size;
33821de2fdaSMikko Rapeli 	__u32 throttle_us;
33921de2fdaSMikko Rapeli 	__u64 fence_rep;
34021de2fdaSMikko Rapeli 	__u32 version;
34121de2fdaSMikko Rapeli 	__u32 flags;
34221de2fdaSMikko Rapeli 	__u32 context_handle;
3432cfa0bb2SSinclair Yeh 	__s32 imported_fence_fd;
344718dceddSDavid Howells };
345718dceddSDavid Howells 
346718dceddSDavid Howells /**
347718dceddSDavid Howells  * struct drm_vmw_fence_rep
348718dceddSDavid Howells  *
349718dceddSDavid Howells  * @handle: Fence object handle for fence associated with a command submission.
350718dceddSDavid Howells  * @mask: Fence flags relevant for this fence object.
351718dceddSDavid Howells  * @seqno: Fence sequence number in fifo. A fence object with a lower
352718dceddSDavid Howells  * seqno will signal the EXEC flag before a fence object with a higher
353718dceddSDavid Howells  * seqno. This can be used by user-space to avoid kernel calls to determine
354718dceddSDavid Howells  * whether a fence has signaled the EXEC flag. Note that @seqno will
355718dceddSDavid Howells  * wrap at 32-bit.
356718dceddSDavid Howells  * @passed_seqno: The highest seqno number processed by the hardware
357718dceddSDavid Howells  * so far. This can be used to mark user-space fence objects as signaled, and
358718dceddSDavid Howells  * to determine whether a fence seqno might be stale.
3592cfa0bb2SSinclair Yeh  * @fd: FD associated with the fence, -1 if not exported
360718dceddSDavid Howells  * @error: This member should've been set to -EFAULT on submission.
361718dceddSDavid Howells  * The following actions should be take on completion:
362718dceddSDavid Howells  * error == -EFAULT: Fence communication failed. The host is synchronized.
363718dceddSDavid Howells  * Use the last fence id read from the FIFO fence register.
364718dceddSDavid Howells  * error != 0 && error != -EFAULT:
365718dceddSDavid Howells  * Fence submission failed. The host is synchronized. Use the fence_seq member.
366718dceddSDavid Howells  * error == 0: All is OK, The host may not be synchronized.
367718dceddSDavid Howells  * Use the fence_seq member.
368718dceddSDavid Howells  *
369718dceddSDavid Howells  * Input / Output data to the DRM_VMW_EXECBUF Ioctl.
370718dceddSDavid Howells  */
371718dceddSDavid Howells 
372718dceddSDavid Howells struct drm_vmw_fence_rep {
37321de2fdaSMikko Rapeli 	__u32 handle;
37421de2fdaSMikko Rapeli 	__u32 mask;
37521de2fdaSMikko Rapeli 	__u32 seqno;
37621de2fdaSMikko Rapeli 	__u32 passed_seqno;
3772cfa0bb2SSinclair Yeh 	__s32 fd;
37821de2fdaSMikko Rapeli 	__s32 error;
379718dceddSDavid Howells };
380718dceddSDavid Howells 
381718dceddSDavid Howells /*************************************************************************/
382718dceddSDavid Howells /**
383f1d34bfdSThomas Hellstrom  * DRM_VMW_ALLOC_BO
384718dceddSDavid Howells  *
385f1d34bfdSThomas Hellstrom  * Allocate a buffer object that is visible also to the host.
386718dceddSDavid Howells  * NOTE: The buffer is
387718dceddSDavid Howells  * identified by a handle and an offset, which are private to the guest, but
388718dceddSDavid Howells  * useable in the command stream. The guest kernel may translate these
389718dceddSDavid Howells  * and patch up the command stream accordingly. In the future, the offset may
390718dceddSDavid Howells  * be zero at all times, or it may disappear from the interface before it is
391718dceddSDavid Howells  * fixed.
392718dceddSDavid Howells  *
393f1d34bfdSThomas Hellstrom  * The buffer object may stay user-space mapped in the guest at all times,
394718dceddSDavid Howells  * and is thus suitable for sub-allocation.
395718dceddSDavid Howells  *
396f1d34bfdSThomas Hellstrom  * Buffer objects are mapped using the mmap() syscall on the drm device.
397718dceddSDavid Howells  */
398718dceddSDavid Howells 
399718dceddSDavid Howells /**
400f1d34bfdSThomas Hellstrom  * struct drm_vmw_alloc_bo_req
401718dceddSDavid Howells  *
402718dceddSDavid Howells  * @size: Required minimum size of the buffer.
403718dceddSDavid Howells  *
404f1d34bfdSThomas Hellstrom  * Input data to the DRM_VMW_ALLOC_BO Ioctl.
405718dceddSDavid Howells  */
406718dceddSDavid Howells 
407f1d34bfdSThomas Hellstrom struct drm_vmw_alloc_bo_req {
40821de2fdaSMikko Rapeli 	__u32 size;
40921de2fdaSMikko Rapeli 	__u32 pad64;
410718dceddSDavid Howells };
411f1d34bfdSThomas Hellstrom #define drm_vmw_alloc_dmabuf_req drm_vmw_alloc_bo_req
412718dceddSDavid Howells 
413718dceddSDavid Howells /**
414f1d34bfdSThomas Hellstrom  * struct drm_vmw_bo_rep
415718dceddSDavid Howells  *
416718dceddSDavid Howells  * @map_handle: Offset to use in the mmap() call used to map the buffer.
417718dceddSDavid Howells  * @handle: Handle unique to this buffer. Used for unreferencing.
418718dceddSDavid Howells  * @cur_gmr_id: GMR id to use in the command stream when this buffer is
419718dceddSDavid Howells  * referenced. See not above.
420718dceddSDavid Howells  * @cur_gmr_offset: Offset to use in the command stream when this buffer is
421718dceddSDavid Howells  * referenced. See note above.
422718dceddSDavid Howells  *
423f1d34bfdSThomas Hellstrom  * Output data from the DRM_VMW_ALLOC_BO Ioctl.
424718dceddSDavid Howells  */
425718dceddSDavid Howells 
426f1d34bfdSThomas Hellstrom struct drm_vmw_bo_rep {
42721de2fdaSMikko Rapeli 	__u64 map_handle;
42821de2fdaSMikko Rapeli 	__u32 handle;
42921de2fdaSMikko Rapeli 	__u32 cur_gmr_id;
43021de2fdaSMikko Rapeli 	__u32 cur_gmr_offset;
43121de2fdaSMikko Rapeli 	__u32 pad64;
432718dceddSDavid Howells };
433f1d34bfdSThomas Hellstrom #define drm_vmw_dmabuf_rep drm_vmw_bo_rep
434718dceddSDavid Howells 
435718dceddSDavid Howells /**
436f1d34bfdSThomas Hellstrom  * union drm_vmw_alloc_bo_arg
437718dceddSDavid Howells  *
438718dceddSDavid Howells  * @req: Input data as described above.
439718dceddSDavid Howells  * @rep: Output data as described above.
440718dceddSDavid Howells  *
441f1d34bfdSThomas Hellstrom  * Argument to the DRM_VMW_ALLOC_BO Ioctl.
442718dceddSDavid Howells  */
443718dceddSDavid Howells 
444f1d34bfdSThomas Hellstrom union drm_vmw_alloc_bo_arg {
445f1d34bfdSThomas Hellstrom 	struct drm_vmw_alloc_bo_req req;
446f1d34bfdSThomas Hellstrom 	struct drm_vmw_bo_rep rep;
447718dceddSDavid Howells };
448f1d34bfdSThomas Hellstrom #define drm_vmw_alloc_dmabuf_arg drm_vmw_alloc_bo_arg
449718dceddSDavid Howells 
450718dceddSDavid Howells /*************************************************************************/
451718dceddSDavid Howells /**
452718dceddSDavid Howells  * DRM_VMW_CONTROL_STREAM - Control overlays, aka streams.
453718dceddSDavid Howells  *
454718dceddSDavid Howells  * This IOCTL controls the overlay units of the svga device.
455718dceddSDavid Howells  * The SVGA overlay units does not work like regular hardware units in
456718dceddSDavid Howells  * that they do not automaticaly read back the contents of the given dma
457718dceddSDavid Howells  * buffer. But instead only read back for each call to this ioctl, and
458718dceddSDavid Howells  * at any point between this call being made and a following call that
459718dceddSDavid Howells  * either changes the buffer or disables the stream.
460718dceddSDavid Howells  */
461718dceddSDavid Howells 
462718dceddSDavid Howells /**
463718dceddSDavid Howells  * struct drm_vmw_rect
464718dceddSDavid Howells  *
465718dceddSDavid Howells  * Defines a rectangle. Used in the overlay ioctl to define
466718dceddSDavid Howells  * source and destination rectangle.
467718dceddSDavid Howells  */
468718dceddSDavid Howells 
469718dceddSDavid Howells struct drm_vmw_rect {
47021de2fdaSMikko Rapeli 	__s32 x;
47121de2fdaSMikko Rapeli 	__s32 y;
47221de2fdaSMikko Rapeli 	__u32 w;
47321de2fdaSMikko Rapeli 	__u32 h;
474718dceddSDavid Howells };
475718dceddSDavid Howells 
476718dceddSDavid Howells /**
477718dceddSDavid Howells  * struct drm_vmw_control_stream_arg
478718dceddSDavid Howells  *
479718dceddSDavid Howells  * @stream_id: Stearm to control
480718dceddSDavid Howells  * @enabled: If false all following arguments are ignored.
481718dceddSDavid Howells  * @handle: Handle to buffer for getting data from.
482718dceddSDavid Howells  * @format: Format of the overlay as understood by the host.
483718dceddSDavid Howells  * @width: Width of the overlay.
484718dceddSDavid Howells  * @height: Height of the overlay.
485718dceddSDavid Howells  * @size: Size of the overlay in bytes.
486718dceddSDavid Howells  * @pitch: Array of pitches, the two last are only used for YUV12 formats.
487718dceddSDavid Howells  * @offset: Offset from start of dma buffer to overlay.
488718dceddSDavid Howells  * @src: Source rect, must be within the defined area above.
489718dceddSDavid Howells  * @dst: Destination rect, x and y may be negative.
490718dceddSDavid Howells  *
491718dceddSDavid Howells  * Argument to the DRM_VMW_CONTROL_STREAM Ioctl.
492718dceddSDavid Howells  */
493718dceddSDavid Howells 
494718dceddSDavid Howells struct drm_vmw_control_stream_arg {
49521de2fdaSMikko Rapeli 	__u32 stream_id;
49621de2fdaSMikko Rapeli 	__u32 enabled;
497718dceddSDavid Howells 
49821de2fdaSMikko Rapeli 	__u32 flags;
49921de2fdaSMikko Rapeli 	__u32 color_key;
500718dceddSDavid Howells 
50121de2fdaSMikko Rapeli 	__u32 handle;
50221de2fdaSMikko Rapeli 	__u32 offset;
50321de2fdaSMikko Rapeli 	__s32 format;
50421de2fdaSMikko Rapeli 	__u32 size;
50521de2fdaSMikko Rapeli 	__u32 width;
50621de2fdaSMikko Rapeli 	__u32 height;
50721de2fdaSMikko Rapeli 	__u32 pitch[3];
508718dceddSDavid Howells 
50921de2fdaSMikko Rapeli 	__u32 pad64;
510718dceddSDavid Howells 	struct drm_vmw_rect src;
511718dceddSDavid Howells 	struct drm_vmw_rect dst;
512718dceddSDavid Howells };
513718dceddSDavid Howells 
514718dceddSDavid Howells /*************************************************************************/
515718dceddSDavid Howells /**
516718dceddSDavid Howells  * DRM_VMW_CURSOR_BYPASS - Give extra information about cursor bypass.
517718dceddSDavid Howells  *
518718dceddSDavid Howells  */
519718dceddSDavid Howells 
520718dceddSDavid Howells #define DRM_VMW_CURSOR_BYPASS_ALL    (1 << 0)
521718dceddSDavid Howells #define DRM_VMW_CURSOR_BYPASS_FLAGS       (1)
522718dceddSDavid Howells 
523718dceddSDavid Howells /**
524718dceddSDavid Howells  * struct drm_vmw_cursor_bypass_arg
525718dceddSDavid Howells  *
526718dceddSDavid Howells  * @flags: Flags.
527718dceddSDavid Howells  * @crtc_id: Crtc id, only used if DMR_CURSOR_BYPASS_ALL isn't passed.
528718dceddSDavid Howells  * @xpos: X position of cursor.
529718dceddSDavid Howells  * @ypos: Y position of cursor.
530718dceddSDavid Howells  * @xhot: X hotspot.
531718dceddSDavid Howells  * @yhot: Y hotspot.
532718dceddSDavid Howells  *
533718dceddSDavid Howells  * Argument to the DRM_VMW_CURSOR_BYPASS Ioctl.
534718dceddSDavid Howells  */
535718dceddSDavid Howells 
536718dceddSDavid Howells struct drm_vmw_cursor_bypass_arg {
53721de2fdaSMikko Rapeli 	__u32 flags;
53821de2fdaSMikko Rapeli 	__u32 crtc_id;
53921de2fdaSMikko Rapeli 	__s32 xpos;
54021de2fdaSMikko Rapeli 	__s32 ypos;
54121de2fdaSMikko Rapeli 	__s32 xhot;
54221de2fdaSMikko Rapeli 	__s32 yhot;
543718dceddSDavid Howells };
544718dceddSDavid Howells 
545718dceddSDavid Howells /*************************************************************************/
546718dceddSDavid Howells /**
547718dceddSDavid Howells  * DRM_VMW_CLAIM_STREAM - Claim a single stream.
548718dceddSDavid Howells  */
549718dceddSDavid Howells 
550718dceddSDavid Howells /**
551718dceddSDavid Howells  * struct drm_vmw_context_arg
552718dceddSDavid Howells  *
553718dceddSDavid Howells  * @stream_id: Device unique context ID.
554718dceddSDavid Howells  *
555718dceddSDavid Howells  * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
556718dceddSDavid Howells  * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
557718dceddSDavid Howells  */
558718dceddSDavid Howells 
559718dceddSDavid Howells struct drm_vmw_stream_arg {
56021de2fdaSMikko Rapeli 	__u32 stream_id;
56121de2fdaSMikko Rapeli 	__u32 pad64;
562718dceddSDavid Howells };
563718dceddSDavid Howells 
564718dceddSDavid Howells /*************************************************************************/
565718dceddSDavid Howells /**
566718dceddSDavid Howells  * DRM_VMW_UNREF_STREAM - Unclaim a stream.
567718dceddSDavid Howells  *
568718dceddSDavid Howells  * Return a single stream that was claimed by this process. Also makes
569718dceddSDavid Howells  * sure that the stream has been stopped.
570718dceddSDavid Howells  */
571718dceddSDavid Howells 
572718dceddSDavid Howells /*************************************************************************/
573718dceddSDavid Howells /**
574718dceddSDavid Howells  * DRM_VMW_GET_3D_CAP
575718dceddSDavid Howells  *
576718dceddSDavid Howells  * Read 3D capabilities from the FIFO
577718dceddSDavid Howells  *
578718dceddSDavid Howells  */
579718dceddSDavid Howells 
580718dceddSDavid Howells /**
581718dceddSDavid Howells  * struct drm_vmw_get_3d_cap_arg
582718dceddSDavid Howells  *
58321de2fdaSMikko Rapeli  * @buffer: Pointer to a buffer for capability data, cast to an __u64
584718dceddSDavid Howells  * @size: Max size to copy
585718dceddSDavid Howells  *
586718dceddSDavid Howells  * Input argument to the DRM_VMW_GET_3D_CAP_IOCTL
587718dceddSDavid Howells  * ioctls.
588718dceddSDavid Howells  */
589718dceddSDavid Howells 
590718dceddSDavid Howells struct drm_vmw_get_3d_cap_arg {
59121de2fdaSMikko Rapeli 	__u64 buffer;
59221de2fdaSMikko Rapeli 	__u32 max_size;
59321de2fdaSMikko Rapeli 	__u32 pad64;
594718dceddSDavid Howells };
595718dceddSDavid Howells 
596718dceddSDavid Howells /*************************************************************************/
597718dceddSDavid Howells /**
598718dceddSDavid Howells  * DRM_VMW_FENCE_WAIT
599718dceddSDavid Howells  *
600718dceddSDavid Howells  * Waits for a fence object to signal. The wait is interruptible, so that
601718dceddSDavid Howells  * signals may be delivered during the interrupt. The wait may timeout,
602718dceddSDavid Howells  * in which case the calls returns -EBUSY. If the wait is restarted,
603718dceddSDavid Howells  * that is restarting without resetting @cookie_valid to zero,
604718dceddSDavid Howells  * the timeout is computed from the first call.
605718dceddSDavid Howells  *
606718dceddSDavid Howells  * The flags argument to the DRM_VMW_FENCE_WAIT ioctl indicates what to wait
607718dceddSDavid Howells  * on:
608718dceddSDavid Howells  * DRM_VMW_FENCE_FLAG_EXEC: All commands ahead of the fence in the command
609718dceddSDavid Howells  * stream
610718dceddSDavid Howells  * have executed.
611718dceddSDavid Howells  * DRM_VMW_FENCE_FLAG_QUERY: All query results resulting from query finish
612718dceddSDavid Howells  * commands
613718dceddSDavid Howells  * in the buffer given to the EXECBUF ioctl returning the fence object handle
614718dceddSDavid Howells  * are available to user-space.
615718dceddSDavid Howells  *
616718dceddSDavid Howells  * DRM_VMW_WAIT_OPTION_UNREF: If this wait option is given, and the
617718dceddSDavid Howells  * fenc wait ioctl returns 0, the fence object has been unreferenced after
618718dceddSDavid Howells  * the wait.
619718dceddSDavid Howells  */
620718dceddSDavid Howells 
621718dceddSDavid Howells #define DRM_VMW_FENCE_FLAG_EXEC   (1 << 0)
622718dceddSDavid Howells #define DRM_VMW_FENCE_FLAG_QUERY  (1 << 1)
623718dceddSDavid Howells 
624718dceddSDavid Howells #define DRM_VMW_WAIT_OPTION_UNREF (1 << 0)
625718dceddSDavid Howells 
626718dceddSDavid Howells /**
627718dceddSDavid Howells  * struct drm_vmw_fence_wait_arg
628718dceddSDavid Howells  *
629718dceddSDavid Howells  * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
630718dceddSDavid Howells  * @cookie_valid: Must be reset to 0 on first call. Left alone on restart.
631718dceddSDavid Howells  * @kernel_cookie: Set to 0 on first call. Left alone on restart.
632718dceddSDavid Howells  * @timeout_us: Wait timeout in microseconds. 0 for indefinite timeout.
633718dceddSDavid Howells  * @lazy: Set to 1 if timing is not critical. Allow more than a kernel tick
634718dceddSDavid Howells  * before returning.
635718dceddSDavid Howells  * @flags: Fence flags to wait on.
636718dceddSDavid Howells  * @wait_options: Options that control the behaviour of the wait ioctl.
637718dceddSDavid Howells  *
638718dceddSDavid Howells  * Input argument to the DRM_VMW_FENCE_WAIT ioctl.
639718dceddSDavid Howells  */
640718dceddSDavid Howells 
641718dceddSDavid Howells struct drm_vmw_fence_wait_arg {
64221de2fdaSMikko Rapeli 	__u32 handle;
64321de2fdaSMikko Rapeli 	__s32  cookie_valid;
64421de2fdaSMikko Rapeli 	__u64 kernel_cookie;
64521de2fdaSMikko Rapeli 	__u64 timeout_us;
64621de2fdaSMikko Rapeli 	__s32 lazy;
64721de2fdaSMikko Rapeli 	__s32 flags;
64821de2fdaSMikko Rapeli 	__s32 wait_options;
64921de2fdaSMikko Rapeli 	__s32 pad64;
650718dceddSDavid Howells };
651718dceddSDavid Howells 
652718dceddSDavid Howells /*************************************************************************/
653718dceddSDavid Howells /**
654718dceddSDavid Howells  * DRM_VMW_FENCE_SIGNALED
655718dceddSDavid Howells  *
656718dceddSDavid Howells  * Checks if a fence object is signaled..
657718dceddSDavid Howells  */
658718dceddSDavid Howells 
659718dceddSDavid Howells /**
660718dceddSDavid Howells  * struct drm_vmw_fence_signaled_arg
661718dceddSDavid Howells  *
662718dceddSDavid Howells  * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
663718dceddSDavid Howells  * @flags: Fence object flags input to DRM_VMW_FENCE_SIGNALED ioctl
664718dceddSDavid Howells  * @signaled: Out: Flags signaled.
665718dceddSDavid Howells  * @sequence: Out: Highest sequence passed so far. Can be used to signal the
666718dceddSDavid Howells  * EXEC flag of user-space fence objects.
667718dceddSDavid Howells  *
668718dceddSDavid Howells  * Input/Output argument to the DRM_VMW_FENCE_SIGNALED and DRM_VMW_FENCE_UNREF
669718dceddSDavid Howells  * ioctls.
670718dceddSDavid Howells  */
671718dceddSDavid Howells 
672718dceddSDavid Howells struct drm_vmw_fence_signaled_arg {
67321de2fdaSMikko Rapeli 	 __u32 handle;
67421de2fdaSMikko Rapeli 	 __u32 flags;
67521de2fdaSMikko Rapeli 	 __s32 signaled;
67621de2fdaSMikko Rapeli 	 __u32 passed_seqno;
67721de2fdaSMikko Rapeli 	 __u32 signaled_flags;
67821de2fdaSMikko Rapeli 	 __u32 pad64;
679718dceddSDavid Howells };
680718dceddSDavid Howells 
681718dceddSDavid Howells /*************************************************************************/
682718dceddSDavid Howells /**
683718dceddSDavid Howells  * DRM_VMW_FENCE_UNREF
684718dceddSDavid Howells  *
685718dceddSDavid Howells  * Unreferences a fence object, and causes it to be destroyed if there are no
686718dceddSDavid Howells  * other references to it.
687718dceddSDavid Howells  *
688718dceddSDavid Howells  */
689718dceddSDavid Howells 
690718dceddSDavid Howells /**
691718dceddSDavid Howells  * struct drm_vmw_fence_arg
692718dceddSDavid Howells  *
693718dceddSDavid Howells  * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
694718dceddSDavid Howells  *
695718dceddSDavid Howells  * Input/Output argument to the DRM_VMW_FENCE_UNREF ioctl..
696718dceddSDavid Howells  */
697718dceddSDavid Howells 
698718dceddSDavid Howells struct drm_vmw_fence_arg {
69921de2fdaSMikko Rapeli 	 __u32 handle;
70021de2fdaSMikko Rapeli 	 __u32 pad64;
701718dceddSDavid Howells };
702718dceddSDavid Howells 
703718dceddSDavid Howells 
704718dceddSDavid Howells /*************************************************************************/
705718dceddSDavid Howells /**
706718dceddSDavid Howells  * DRM_VMW_FENCE_EVENT
707718dceddSDavid Howells  *
708718dceddSDavid Howells  * Queues an event on a fence to be delivered on the drm character device
709718dceddSDavid Howells  * when the fence has signaled the DRM_VMW_FENCE_FLAG_EXEC flag.
710718dceddSDavid Howells  * Optionally the approximate time when the fence signaled is
711718dceddSDavid Howells  * given by the event.
712718dceddSDavid Howells  */
713718dceddSDavid Howells 
714718dceddSDavid Howells /*
715718dceddSDavid Howells  * The event type
716718dceddSDavid Howells  */
717718dceddSDavid Howells #define DRM_VMW_EVENT_FENCE_SIGNALED 0x80000000
718718dceddSDavid Howells 
719718dceddSDavid Howells struct drm_vmw_event_fence {
720718dceddSDavid Howells 	struct drm_event base;
72121de2fdaSMikko Rapeli 	__u64 user_data;
72221de2fdaSMikko Rapeli 	__u32 tv_sec;
72321de2fdaSMikko Rapeli 	__u32 tv_usec;
724718dceddSDavid Howells };
725718dceddSDavid Howells 
726718dceddSDavid Howells /*
727718dceddSDavid Howells  * Flags that may be given to the command.
728718dceddSDavid Howells  */
729718dceddSDavid Howells /* Request fence signaled time on the event. */
730718dceddSDavid Howells #define DRM_VMW_FE_FLAG_REQ_TIME (1 << 0)
731718dceddSDavid Howells 
732718dceddSDavid Howells /**
733718dceddSDavid Howells  * struct drm_vmw_fence_event_arg
734718dceddSDavid Howells  *
73521de2fdaSMikko Rapeli  * @fence_rep: Pointer to fence_rep structure cast to __u64 or 0 if
736718dceddSDavid Howells  * the fence is not supposed to be referenced by user-space.
737718dceddSDavid Howells  * @user_info: Info to be delivered with the event.
738718dceddSDavid Howells  * @handle: Attach the event to this fence only.
739718dceddSDavid Howells  * @flags: A set of flags as defined above.
740718dceddSDavid Howells  */
741718dceddSDavid Howells struct drm_vmw_fence_event_arg {
74221de2fdaSMikko Rapeli 	__u64 fence_rep;
74321de2fdaSMikko Rapeli 	__u64 user_data;
74421de2fdaSMikko Rapeli 	__u32 handle;
74521de2fdaSMikko Rapeli 	__u32 flags;
746718dceddSDavid Howells };
747718dceddSDavid Howells 
748718dceddSDavid Howells 
749718dceddSDavid Howells /*************************************************************************/
750718dceddSDavid Howells /**
751718dceddSDavid Howells  * DRM_VMW_PRESENT
752718dceddSDavid Howells  *
753718dceddSDavid Howells  * Executes an SVGA present on a given fb for a given surface. The surface
754718dceddSDavid Howells  * is placed on the framebuffer. Cliprects are given relative to the given
755718dceddSDavid Howells  * point (the point disignated by dest_{x|y}).
756718dceddSDavid Howells  *
757718dceddSDavid Howells  */
758718dceddSDavid Howells 
759718dceddSDavid Howells /**
760718dceddSDavid Howells  * struct drm_vmw_present_arg
761718dceddSDavid Howells  * @fb_id: framebuffer id to present / read back from.
762718dceddSDavid Howells  * @sid: Surface id to present from.
763718dceddSDavid Howells  * @dest_x: X placement coordinate for surface.
764718dceddSDavid Howells  * @dest_y: Y placement coordinate for surface.
76521de2fdaSMikko Rapeli  * @clips_ptr: Pointer to an array of clip rects cast to an __u64.
766718dceddSDavid Howells  * @num_clips: Number of cliprects given relative to the framebuffer origin,
767718dceddSDavid Howells  * in the same coordinate space as the frame buffer.
768718dceddSDavid Howells  * @pad64: Unused 64-bit padding.
769718dceddSDavid Howells  *
770718dceddSDavid Howells  * Input argument to the DRM_VMW_PRESENT ioctl.
771718dceddSDavid Howells  */
772718dceddSDavid Howells 
773718dceddSDavid Howells struct drm_vmw_present_arg {
77421de2fdaSMikko Rapeli 	__u32 fb_id;
77521de2fdaSMikko Rapeli 	__u32 sid;
77621de2fdaSMikko Rapeli 	__s32 dest_x;
77721de2fdaSMikko Rapeli 	__s32 dest_y;
77821de2fdaSMikko Rapeli 	__u64 clips_ptr;
77921de2fdaSMikko Rapeli 	__u32 num_clips;
78021de2fdaSMikko Rapeli 	__u32 pad64;
781718dceddSDavid Howells };
782718dceddSDavid Howells 
783718dceddSDavid Howells 
784718dceddSDavid Howells /*************************************************************************/
785718dceddSDavid Howells /**
786718dceddSDavid Howells  * DRM_VMW_PRESENT_READBACK
787718dceddSDavid Howells  *
788718dceddSDavid Howells  * Executes an SVGA present readback from a given fb to the dma buffer
789718dceddSDavid Howells  * currently bound as the fb. If there is no dma buffer bound to the fb,
790718dceddSDavid Howells  * an error will be returned.
791718dceddSDavid Howells  *
792718dceddSDavid Howells  */
793718dceddSDavid Howells 
794718dceddSDavid Howells /**
795718dceddSDavid Howells  * struct drm_vmw_present_arg
796718dceddSDavid Howells  * @fb_id: fb_id to present / read back from.
797718dceddSDavid Howells  * @num_clips: Number of cliprects.
79821de2fdaSMikko Rapeli  * @clips_ptr: Pointer to an array of clip rects cast to an __u64.
79921de2fdaSMikko Rapeli  * @fence_rep: Pointer to a struct drm_vmw_fence_rep, cast to an __u64.
800718dceddSDavid Howells  * If this member is NULL, then the ioctl should not return a fence.
801718dceddSDavid Howells  */
802718dceddSDavid Howells 
803718dceddSDavid Howells struct drm_vmw_present_readback_arg {
80421de2fdaSMikko Rapeli 	 __u32 fb_id;
80521de2fdaSMikko Rapeli 	 __u32 num_clips;
80621de2fdaSMikko Rapeli 	 __u64 clips_ptr;
80721de2fdaSMikko Rapeli 	 __u64 fence_rep;
808718dceddSDavid Howells };
809718dceddSDavid Howells 
810718dceddSDavid Howells /*************************************************************************/
811718dceddSDavid Howells /**
812718dceddSDavid Howells  * DRM_VMW_UPDATE_LAYOUT - Update layout
813718dceddSDavid Howells  *
814718dceddSDavid Howells  * Updates the preferred modes and connection status for connectors. The
815718dceddSDavid Howells  * command consists of one drm_vmw_update_layout_arg pointing to an array
816718dceddSDavid Howells  * of num_outputs drm_vmw_rect's.
817718dceddSDavid Howells  */
818718dceddSDavid Howells 
819718dceddSDavid Howells /**
820718dceddSDavid Howells  * struct drm_vmw_update_layout_arg
821718dceddSDavid Howells  *
822718dceddSDavid Howells  * @num_outputs: number of active connectors
82321de2fdaSMikko Rapeli  * @rects: pointer to array of drm_vmw_rect cast to an __u64
824718dceddSDavid Howells  *
825718dceddSDavid Howells  * Input argument to the DRM_VMW_UPDATE_LAYOUT Ioctl.
826718dceddSDavid Howells  */
827718dceddSDavid Howells struct drm_vmw_update_layout_arg {
82821de2fdaSMikko Rapeli 	__u32 num_outputs;
82921de2fdaSMikko Rapeli 	__u32 pad64;
83021de2fdaSMikko Rapeli 	__u64 rects;
831718dceddSDavid Howells };
832718dceddSDavid Howells 
833cfe4d53eSThomas Hellstrom 
834cfe4d53eSThomas Hellstrom /*************************************************************************/
835cfe4d53eSThomas Hellstrom /**
836cfe4d53eSThomas Hellstrom  * DRM_VMW_CREATE_SHADER - Create shader
837cfe4d53eSThomas Hellstrom  *
838cfe4d53eSThomas Hellstrom  * Creates a shader and optionally binds it to a dma buffer containing
839cfe4d53eSThomas Hellstrom  * the shader byte-code.
840cfe4d53eSThomas Hellstrom  */
841cfe4d53eSThomas Hellstrom 
842cfe4d53eSThomas Hellstrom /**
843cfe4d53eSThomas Hellstrom  * enum drm_vmw_shader_type - Shader types
844cfe4d53eSThomas Hellstrom  */
845cfe4d53eSThomas Hellstrom enum drm_vmw_shader_type {
846cfe4d53eSThomas Hellstrom 	drm_vmw_shader_type_vs = 0,
847cfe4d53eSThomas Hellstrom 	drm_vmw_shader_type_ps,
848cfe4d53eSThomas Hellstrom };
849cfe4d53eSThomas Hellstrom 
850cfe4d53eSThomas Hellstrom 
851cfe4d53eSThomas Hellstrom /**
852cfe4d53eSThomas Hellstrom  * struct drm_vmw_shader_create_arg
853cfe4d53eSThomas Hellstrom  *
854cfe4d53eSThomas Hellstrom  * @shader_type: Shader type of the shader to create.
855cfe4d53eSThomas Hellstrom  * @size: Size of the byte-code in bytes.
856cfe4d53eSThomas Hellstrom  * where the shader byte-code starts
857cfe4d53eSThomas Hellstrom  * @buffer_handle: Buffer handle identifying the buffer containing the
858cfe4d53eSThomas Hellstrom  * shader byte-code
859cfe4d53eSThomas Hellstrom  * @shader_handle: On successful completion contains a handle that
860cfe4d53eSThomas Hellstrom  * can be used to subsequently identify the shader.
861cfe4d53eSThomas Hellstrom  * @offset: Offset in bytes into the buffer given by @buffer_handle,
862cfe4d53eSThomas Hellstrom  *
863cfe4d53eSThomas Hellstrom  * Input / Output argument to the DRM_VMW_CREATE_SHADER Ioctl.
864cfe4d53eSThomas Hellstrom  */
865cfe4d53eSThomas Hellstrom struct drm_vmw_shader_create_arg {
866cfe4d53eSThomas Hellstrom 	enum drm_vmw_shader_type shader_type;
86721de2fdaSMikko Rapeli 	__u32 size;
86821de2fdaSMikko Rapeli 	__u32 buffer_handle;
86921de2fdaSMikko Rapeli 	__u32 shader_handle;
87021de2fdaSMikko Rapeli 	__u64 offset;
871cfe4d53eSThomas Hellstrom };
872cfe4d53eSThomas Hellstrom 
873cfe4d53eSThomas Hellstrom /*************************************************************************/
874cfe4d53eSThomas Hellstrom /**
875cfe4d53eSThomas Hellstrom  * DRM_VMW_UNREF_SHADER - Unreferences a shader
876cfe4d53eSThomas Hellstrom  *
877cfe4d53eSThomas Hellstrom  * Destroys a user-space reference to a shader, optionally destroying
878cfe4d53eSThomas Hellstrom  * it.
879cfe4d53eSThomas Hellstrom  */
880cfe4d53eSThomas Hellstrom 
881cfe4d53eSThomas Hellstrom /**
882cfe4d53eSThomas Hellstrom  * struct drm_vmw_shader_arg
883cfe4d53eSThomas Hellstrom  *
884cfe4d53eSThomas Hellstrom  * @handle: Handle identifying the shader to destroy.
885cfe4d53eSThomas Hellstrom  *
886cfe4d53eSThomas Hellstrom  * Input argument to the DRM_VMW_UNREF_SHADER ioctl.
887cfe4d53eSThomas Hellstrom  */
888cfe4d53eSThomas Hellstrom struct drm_vmw_shader_arg {
88921de2fdaSMikko Rapeli 	__u32 handle;
89021de2fdaSMikko Rapeli 	__u32 pad64;
891cfe4d53eSThomas Hellstrom };
892cfe4d53eSThomas Hellstrom 
893cfe4d53eSThomas Hellstrom /*************************************************************************/
894cfe4d53eSThomas Hellstrom /**
895cfe4d53eSThomas Hellstrom  * DRM_VMW_GB_SURFACE_CREATE - Create a host guest-backed surface.
896cfe4d53eSThomas Hellstrom  *
897cfe4d53eSThomas Hellstrom  * Allocates a surface handle and queues a create surface command
898cfe4d53eSThomas Hellstrom  * for the host on the first use of the surface. The surface ID can
899cfe4d53eSThomas Hellstrom  * be used as the surface ID in commands referencing the surface.
900cfe4d53eSThomas Hellstrom  */
901cfe4d53eSThomas Hellstrom 
902cfe4d53eSThomas Hellstrom /**
903cfe4d53eSThomas Hellstrom  * enum drm_vmw_surface_flags
904cfe4d53eSThomas Hellstrom  *
905cfe4d53eSThomas Hellstrom  * @drm_vmw_surface_flag_shareable:     Whether the surface is shareable
906cfe4d53eSThomas Hellstrom  * @drm_vmw_surface_flag_scanout:       Whether the surface is a scanout
907cfe4d53eSThomas Hellstrom  *                                      surface.
908cfe4d53eSThomas Hellstrom  * @drm_vmw_surface_flag_create_buffer: Create a backup buffer if none is
909cfe4d53eSThomas Hellstrom  *                                      given.
9109ca7d19fSThomas Hellstrom  * @drm_vmw_surface_flag_coherent:      Back surface with coherent memory.
911cfe4d53eSThomas Hellstrom  */
912cfe4d53eSThomas Hellstrom enum drm_vmw_surface_flags {
913cfe4d53eSThomas Hellstrom 	drm_vmw_surface_flag_shareable = (1 << 0),
914cfe4d53eSThomas Hellstrom 	drm_vmw_surface_flag_scanout = (1 << 1),
9159ca7d19fSThomas Hellstrom 	drm_vmw_surface_flag_create_buffer = (1 << 2),
9169ca7d19fSThomas Hellstrom 	drm_vmw_surface_flag_coherent = (1 << 3),
917cfe4d53eSThomas Hellstrom };
918cfe4d53eSThomas Hellstrom 
919cfe4d53eSThomas Hellstrom /**
920cfe4d53eSThomas Hellstrom  * struct drm_vmw_gb_surface_create_req
921cfe4d53eSThomas Hellstrom  *
922cfe4d53eSThomas Hellstrom  * @svga3d_flags:     SVGA3d surface flags for the device.
923cfe4d53eSThomas Hellstrom  * @format:           SVGA3d format.
924cfe4d53eSThomas Hellstrom  * @mip_level:        Number of mip levels for all faces.
925cfe4d53eSThomas Hellstrom  * @drm_surface_flags Flags as described above.
92615c6f656SZack Rusin  * @multisample_count Future use. Set to 0.
927cfe4d53eSThomas Hellstrom  * @autogen_filter    Future use. Set to 0.
928cfe4d53eSThomas Hellstrom  * @buffer_handle     Buffer handle of backup buffer. SVGA3D_INVALID_ID
929cfe4d53eSThomas Hellstrom  *                    if none.
930cfe4d53eSThomas Hellstrom  * @base_size         Size of the base mip level for all faces.
931d80efd5cSThomas Hellstrom  * @array_size        Must be zero for non-DX hardware, and if non-zero
932d80efd5cSThomas Hellstrom  *                    svga3d_flags must have proper bind flags setup.
933cfe4d53eSThomas Hellstrom  *
934cfe4d53eSThomas Hellstrom  * Input argument to the  DRM_VMW_GB_SURFACE_CREATE Ioctl.
935cfe4d53eSThomas Hellstrom  * Part of output argument for the DRM_VMW_GB_SURFACE_REF Ioctl.
936cfe4d53eSThomas Hellstrom  */
937cfe4d53eSThomas Hellstrom struct drm_vmw_gb_surface_create_req {
93821de2fdaSMikko Rapeli 	__u32 svga3d_flags;
93921de2fdaSMikko Rapeli 	__u32 format;
94021de2fdaSMikko Rapeli 	__u32 mip_levels;
941cfe4d53eSThomas Hellstrom 	enum drm_vmw_surface_flags drm_surface_flags;
94221de2fdaSMikko Rapeli 	__u32 multisample_count;
94321de2fdaSMikko Rapeli 	__u32 autogen_filter;
94421de2fdaSMikko Rapeli 	__u32 buffer_handle;
94521de2fdaSMikko Rapeli 	__u32 array_size;
946cfe4d53eSThomas Hellstrom 	struct drm_vmw_size base_size;
947cfe4d53eSThomas Hellstrom };
948cfe4d53eSThomas Hellstrom 
949cfe4d53eSThomas Hellstrom /**
950cfe4d53eSThomas Hellstrom  * struct drm_vmw_gb_surface_create_rep
951cfe4d53eSThomas Hellstrom  *
952cfe4d53eSThomas Hellstrom  * @handle:            Surface handle.
953cfe4d53eSThomas Hellstrom  * @backup_size:       Size of backup buffers for this surface.
954cfe4d53eSThomas Hellstrom  * @buffer_handle:     Handle of backup buffer. SVGA3D_INVALID_ID if none.
955cfe4d53eSThomas Hellstrom  * @buffer_size:       Actual size of the buffer identified by
956cfe4d53eSThomas Hellstrom  *                     @buffer_handle
957cfe4d53eSThomas Hellstrom  * @buffer_map_handle: Offset into device address space for the buffer
958cfe4d53eSThomas Hellstrom  *                     identified by @buffer_handle.
959cfe4d53eSThomas Hellstrom  *
960cfe4d53eSThomas Hellstrom  * Part of output argument for the DRM_VMW_GB_SURFACE_REF ioctl.
961cfe4d53eSThomas Hellstrom  * Output argument for the DRM_VMW_GB_SURFACE_CREATE ioctl.
962cfe4d53eSThomas Hellstrom  */
963cfe4d53eSThomas Hellstrom struct drm_vmw_gb_surface_create_rep {
96421de2fdaSMikko Rapeli 	__u32 handle;
96521de2fdaSMikko Rapeli 	__u32 backup_size;
96621de2fdaSMikko Rapeli 	__u32 buffer_handle;
96721de2fdaSMikko Rapeli 	__u32 buffer_size;
96821de2fdaSMikko Rapeli 	__u64 buffer_map_handle;
969cfe4d53eSThomas Hellstrom };
970cfe4d53eSThomas Hellstrom 
971cfe4d53eSThomas Hellstrom /**
972cfe4d53eSThomas Hellstrom  * union drm_vmw_gb_surface_create_arg
973cfe4d53eSThomas Hellstrom  *
974cfe4d53eSThomas Hellstrom  * @req: Input argument as described above.
975cfe4d53eSThomas Hellstrom  * @rep: Output argument as described above.
976cfe4d53eSThomas Hellstrom  *
977cfe4d53eSThomas Hellstrom  * Argument to the DRM_VMW_GB_SURFACE_CREATE ioctl.
978cfe4d53eSThomas Hellstrom  */
979cfe4d53eSThomas Hellstrom union drm_vmw_gb_surface_create_arg {
980cfe4d53eSThomas Hellstrom 	struct drm_vmw_gb_surface_create_rep rep;
981cfe4d53eSThomas Hellstrom 	struct drm_vmw_gb_surface_create_req req;
982cfe4d53eSThomas Hellstrom };
983cfe4d53eSThomas Hellstrom 
984cfe4d53eSThomas Hellstrom /*************************************************************************/
985cfe4d53eSThomas Hellstrom /**
986cfe4d53eSThomas Hellstrom  * DRM_VMW_GB_SURFACE_REF - Reference a host surface.
987cfe4d53eSThomas Hellstrom  *
988cfe4d53eSThomas Hellstrom  * Puts a reference on a host surface with a given handle, as previously
989cfe4d53eSThomas Hellstrom  * returned by the DRM_VMW_GB_SURFACE_CREATE ioctl.
990cfe4d53eSThomas Hellstrom  * A reference will make sure the surface isn't destroyed while we hold
991cfe4d53eSThomas Hellstrom  * it and will allow the calling client to use the surface handle in
992cfe4d53eSThomas Hellstrom  * the command stream.
993cfe4d53eSThomas Hellstrom  *
994cfe4d53eSThomas Hellstrom  * On successful return, the Ioctl returns the surface information given
995cfe4d53eSThomas Hellstrom  * to and returned from the DRM_VMW_GB_SURFACE_CREATE ioctl.
996cfe4d53eSThomas Hellstrom  */
997cfe4d53eSThomas Hellstrom 
998cfe4d53eSThomas Hellstrom /**
999cfe4d53eSThomas Hellstrom  * struct drm_vmw_gb_surface_reference_arg
1000cfe4d53eSThomas Hellstrom  *
1001cfe4d53eSThomas Hellstrom  * @creq: The data used as input when the surface was created, as described
1002cfe4d53eSThomas Hellstrom  *        above at "struct drm_vmw_gb_surface_create_req"
1003cfe4d53eSThomas Hellstrom  * @crep: Additional data output when the surface was created, as described
1004cfe4d53eSThomas Hellstrom  *        above at "struct drm_vmw_gb_surface_create_rep"
1005cfe4d53eSThomas Hellstrom  *
1006cfe4d53eSThomas Hellstrom  * Output Argument to the DRM_VMW_GB_SURFACE_REF ioctl.
1007cfe4d53eSThomas Hellstrom  */
1008cfe4d53eSThomas Hellstrom struct drm_vmw_gb_surface_ref_rep {
1009cfe4d53eSThomas Hellstrom 	struct drm_vmw_gb_surface_create_req creq;
1010cfe4d53eSThomas Hellstrom 	struct drm_vmw_gb_surface_create_rep crep;
1011cfe4d53eSThomas Hellstrom };
1012cfe4d53eSThomas Hellstrom 
1013cfe4d53eSThomas Hellstrom /**
1014cfe4d53eSThomas Hellstrom  * union drm_vmw_gb_surface_reference_arg
1015cfe4d53eSThomas Hellstrom  *
1016cfe4d53eSThomas Hellstrom  * @req: Input data as described above at "struct drm_vmw_surface_arg"
1017cfe4d53eSThomas Hellstrom  * @rep: Output data as described above at "struct drm_vmw_gb_surface_ref_rep"
1018cfe4d53eSThomas Hellstrom  *
1019cfe4d53eSThomas Hellstrom  * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl.
1020cfe4d53eSThomas Hellstrom  */
1021cfe4d53eSThomas Hellstrom union drm_vmw_gb_surface_reference_arg {
1022cfe4d53eSThomas Hellstrom 	struct drm_vmw_gb_surface_ref_rep rep;
1023cfe4d53eSThomas Hellstrom 	struct drm_vmw_surface_arg req;
1024cfe4d53eSThomas Hellstrom };
1025cfe4d53eSThomas Hellstrom 
1026cfe4d53eSThomas Hellstrom 
10271d7a5cbfSThomas Hellstrom /*************************************************************************/
10281d7a5cbfSThomas Hellstrom /**
10291d7a5cbfSThomas Hellstrom  * DRM_VMW_SYNCCPU - Sync a DMA buffer / MOB for CPU access.
10301d7a5cbfSThomas Hellstrom  *
10311d7a5cbfSThomas Hellstrom  * Idles any previously submitted GPU operations on the buffer and
10321d7a5cbfSThomas Hellstrom  * by default blocks command submissions that reference the buffer.
10331d7a5cbfSThomas Hellstrom  * If the file descriptor used to grab a blocking CPU sync is closed, the
10341d7a5cbfSThomas Hellstrom  * cpu sync is released.
10351d7a5cbfSThomas Hellstrom  * The flags argument indicates how the grab / release operation should be
10361d7a5cbfSThomas Hellstrom  * performed:
10371d7a5cbfSThomas Hellstrom  */
10381d7a5cbfSThomas Hellstrom 
10391d7a5cbfSThomas Hellstrom /**
10401d7a5cbfSThomas Hellstrom  * enum drm_vmw_synccpu_flags - Synccpu flags:
10411d7a5cbfSThomas Hellstrom  *
10421d7a5cbfSThomas Hellstrom  * @drm_vmw_synccpu_read: Sync for read. If sync is done for read only, it's a
10431d7a5cbfSThomas Hellstrom  * hint to the kernel to allow command submissions that references the buffer
10441d7a5cbfSThomas Hellstrom  * for read-only.
10451d7a5cbfSThomas Hellstrom  * @drm_vmw_synccpu_write: Sync for write. Block all command submissions
10461d7a5cbfSThomas Hellstrom  * referencing this buffer.
10471d7a5cbfSThomas Hellstrom  * @drm_vmw_synccpu_dontblock: Dont wait for GPU idle, but rather return
10481d7a5cbfSThomas Hellstrom  * -EBUSY should the buffer be busy.
10491d7a5cbfSThomas Hellstrom  * @drm_vmw_synccpu_allow_cs: Allow command submission that touches the buffer
10501d7a5cbfSThomas Hellstrom  * while the buffer is synced for CPU. This is similar to the GEM bo idle
10511d7a5cbfSThomas Hellstrom  * behavior.
10521d7a5cbfSThomas Hellstrom  */
10531d7a5cbfSThomas Hellstrom enum drm_vmw_synccpu_flags {
10541d7a5cbfSThomas Hellstrom 	drm_vmw_synccpu_read = (1 << 0),
10551d7a5cbfSThomas Hellstrom 	drm_vmw_synccpu_write = (1 << 1),
10561d7a5cbfSThomas Hellstrom 	drm_vmw_synccpu_dontblock = (1 << 2),
10571d7a5cbfSThomas Hellstrom 	drm_vmw_synccpu_allow_cs = (1 << 3)
10581d7a5cbfSThomas Hellstrom };
10591d7a5cbfSThomas Hellstrom 
10601d7a5cbfSThomas Hellstrom /**
10611d7a5cbfSThomas Hellstrom  * enum drm_vmw_synccpu_op - Synccpu operations:
10621d7a5cbfSThomas Hellstrom  *
10631d7a5cbfSThomas Hellstrom  * @drm_vmw_synccpu_grab:    Grab the buffer for CPU operations
10641d7a5cbfSThomas Hellstrom  * @drm_vmw_synccpu_release: Release a previous grab.
10651d7a5cbfSThomas Hellstrom  */
10661d7a5cbfSThomas Hellstrom enum drm_vmw_synccpu_op {
10671d7a5cbfSThomas Hellstrom 	drm_vmw_synccpu_grab,
10681d7a5cbfSThomas Hellstrom 	drm_vmw_synccpu_release
10691d7a5cbfSThomas Hellstrom };
10701d7a5cbfSThomas Hellstrom 
10711d7a5cbfSThomas Hellstrom /**
10721d7a5cbfSThomas Hellstrom  * struct drm_vmw_synccpu_arg
10731d7a5cbfSThomas Hellstrom  *
10741d7a5cbfSThomas Hellstrom  * @op:			     The synccpu operation as described above.
10751d7a5cbfSThomas Hellstrom  * @handle:		     Handle identifying the buffer object.
10761d7a5cbfSThomas Hellstrom  * @flags:		     Flags as described above.
10771d7a5cbfSThomas Hellstrom  */
10781d7a5cbfSThomas Hellstrom struct drm_vmw_synccpu_arg {
10791d7a5cbfSThomas Hellstrom 	enum drm_vmw_synccpu_op op;
10801d7a5cbfSThomas Hellstrom 	enum drm_vmw_synccpu_flags flags;
108121de2fdaSMikko Rapeli 	__u32 handle;
108221de2fdaSMikko Rapeli 	__u32 pad64;
10831d7a5cbfSThomas Hellstrom };
1084cfe4d53eSThomas Hellstrom 
1085d80efd5cSThomas Hellstrom /*************************************************************************/
1086d80efd5cSThomas Hellstrom /**
1087d80efd5cSThomas Hellstrom  * DRM_VMW_CREATE_EXTENDED_CONTEXT - Create a host context.
1088d80efd5cSThomas Hellstrom  *
1089d80efd5cSThomas Hellstrom  * Allocates a device unique context id, and queues a create context command
1090d80efd5cSThomas Hellstrom  * for the host. Does not wait for host completion.
1091d80efd5cSThomas Hellstrom  */
1092d80efd5cSThomas Hellstrom enum drm_vmw_extended_context {
1093d80efd5cSThomas Hellstrom 	drm_vmw_context_legacy,
1094d80efd5cSThomas Hellstrom 	drm_vmw_context_dx
1095d80efd5cSThomas Hellstrom };
1096d80efd5cSThomas Hellstrom 
1097d80efd5cSThomas Hellstrom /**
1098d80efd5cSThomas Hellstrom  * union drm_vmw_extended_context_arg
1099d80efd5cSThomas Hellstrom  *
1100d80efd5cSThomas Hellstrom  * @req: Context type.
1101d80efd5cSThomas Hellstrom  * @rep: Context identifier.
1102d80efd5cSThomas Hellstrom  *
1103d80efd5cSThomas Hellstrom  * Argument to the DRM_VMW_CREATE_EXTENDED_CONTEXT Ioctl.
1104d80efd5cSThomas Hellstrom  */
1105d80efd5cSThomas Hellstrom union drm_vmw_extended_context_arg {
1106d80efd5cSThomas Hellstrom 	enum drm_vmw_extended_context req;
1107d80efd5cSThomas Hellstrom 	struct drm_vmw_context_arg rep;
1108d80efd5cSThomas Hellstrom };
1109d3450e00SEmil Velikov 
11102f9545ceSThomas Hellstrom /*************************************************************************/
11112f9545ceSThomas Hellstrom /*
11122f9545ceSThomas Hellstrom  * DRM_VMW_HANDLE_CLOSE - Close a user-space handle and release its
11132f9545ceSThomas Hellstrom  * underlying resource.
11142f9545ceSThomas Hellstrom  *
1115f1d34bfdSThomas Hellstrom  * Note that this ioctl is overlaid on the deprecated DRM_VMW_UNREF_DMABUF
1116f1d34bfdSThomas Hellstrom  * Ioctl.
11172f9545ceSThomas Hellstrom  */
11182f9545ceSThomas Hellstrom 
11192f9545ceSThomas Hellstrom /**
11202f9545ceSThomas Hellstrom  * struct drm_vmw_handle_close_arg
11212f9545ceSThomas Hellstrom  *
11222f9545ceSThomas Hellstrom  * @handle: Handle to close.
11232f9545ceSThomas Hellstrom  *
11242f9545ceSThomas Hellstrom  * Argument to the DRM_VMW_HANDLE_CLOSE Ioctl.
11252f9545ceSThomas Hellstrom  */
11262f9545ceSThomas Hellstrom struct drm_vmw_handle_close_arg {
11272f9545ceSThomas Hellstrom 	__u32 handle;
11282f9545ceSThomas Hellstrom 	__u32 pad64;
11292f9545ceSThomas Hellstrom };
1130f1d34bfdSThomas Hellstrom #define drm_vmw_unref_dmabuf_arg drm_vmw_handle_close_arg
11312f9545ceSThomas Hellstrom 
113214b1c33eSDeepak Rawat /*************************************************************************/
113314b1c33eSDeepak Rawat /**
113414b1c33eSDeepak Rawat  * DRM_VMW_GB_SURFACE_CREATE_EXT - Create a host guest-backed surface.
113514b1c33eSDeepak Rawat  *
113614b1c33eSDeepak Rawat  * Allocates a surface handle and queues a create surface command
113714b1c33eSDeepak Rawat  * for the host on the first use of the surface. The surface ID can
113814b1c33eSDeepak Rawat  * be used as the surface ID in commands referencing the surface.
113914b1c33eSDeepak Rawat  *
114014b1c33eSDeepak Rawat  * This new command extends DRM_VMW_GB_SURFACE_CREATE by adding version
114114b1c33eSDeepak Rawat  * parameter and 64 bit svga flag.
114214b1c33eSDeepak Rawat  */
114314b1c33eSDeepak Rawat 
114414b1c33eSDeepak Rawat /**
114514b1c33eSDeepak Rawat  * enum drm_vmw_surface_version
114614b1c33eSDeepak Rawat  *
114714b1c33eSDeepak Rawat  * @drm_vmw_surface_gb_v1: Corresponds to current gb surface format with
114814b1c33eSDeepak Rawat  * svga3d surface flags split into 2, upper half and lower half.
114914b1c33eSDeepak Rawat  */
115014b1c33eSDeepak Rawat enum drm_vmw_surface_version {
11512a50f06dSDeepak Rawat 	drm_vmw_gb_surface_v1,
115214b1c33eSDeepak Rawat };
115314b1c33eSDeepak Rawat 
115414b1c33eSDeepak Rawat /**
115514b1c33eSDeepak Rawat  * struct drm_vmw_gb_surface_create_ext_req
115614b1c33eSDeepak Rawat  *
115714b1c33eSDeepak Rawat  * @base: Surface create parameters.
115814b1c33eSDeepak Rawat  * @version: Version of surface create ioctl.
115914b1c33eSDeepak Rawat  * @svga3d_flags_upper_32_bits: Upper 32 bits of svga3d flags.
116014b1c33eSDeepak Rawat  * @multisample_pattern: Multisampling pattern when msaa is supported.
116114b1c33eSDeepak Rawat  * @quality_level: Precision settings for each sample.
11622a50f06dSDeepak Rawat  * @buffer_byte_stride: Buffer byte stride.
116314b1c33eSDeepak Rawat  * @must_be_zero: Reserved for future usage.
116414b1c33eSDeepak Rawat  *
116514b1c33eSDeepak Rawat  * Input argument to the  DRM_VMW_GB_SURFACE_CREATE_EXT Ioctl.
116614b1c33eSDeepak Rawat  * Part of output argument for the DRM_VMW_GB_SURFACE_REF_EXT Ioctl.
116714b1c33eSDeepak Rawat  */
116814b1c33eSDeepak Rawat struct drm_vmw_gb_surface_create_ext_req {
116914b1c33eSDeepak Rawat 	struct drm_vmw_gb_surface_create_req base;
117014b1c33eSDeepak Rawat 	enum drm_vmw_surface_version version;
11712a50f06dSDeepak Rawat 	__u32 svga3d_flags_upper_32_bits;
11722a50f06dSDeepak Rawat 	__u32 multisample_pattern;
11732a50f06dSDeepak Rawat 	__u32 quality_level;
11742a50f06dSDeepak Rawat 	__u32 buffer_byte_stride;
11752a50f06dSDeepak Rawat 	__u32 must_be_zero;
117614b1c33eSDeepak Rawat };
117714b1c33eSDeepak Rawat 
117814b1c33eSDeepak Rawat /**
117914b1c33eSDeepak Rawat  * union drm_vmw_gb_surface_create_ext_arg
118014b1c33eSDeepak Rawat  *
118114b1c33eSDeepak Rawat  * @req: Input argument as described above.
118214b1c33eSDeepak Rawat  * @rep: Output argument as described above.
118314b1c33eSDeepak Rawat  *
118414b1c33eSDeepak Rawat  * Argument to the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl.
118514b1c33eSDeepak Rawat  */
118614b1c33eSDeepak Rawat union drm_vmw_gb_surface_create_ext_arg {
118714b1c33eSDeepak Rawat 	struct drm_vmw_gb_surface_create_rep rep;
118814b1c33eSDeepak Rawat 	struct drm_vmw_gb_surface_create_ext_req req;
118914b1c33eSDeepak Rawat };
119014b1c33eSDeepak Rawat 
119114b1c33eSDeepak Rawat /*************************************************************************/
119214b1c33eSDeepak Rawat /**
119314b1c33eSDeepak Rawat  * DRM_VMW_GB_SURFACE_REF_EXT - Reference a host surface.
119414b1c33eSDeepak Rawat  *
119514b1c33eSDeepak Rawat  * Puts a reference on a host surface with a given handle, as previously
119614b1c33eSDeepak Rawat  * returned by the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl.
119714b1c33eSDeepak Rawat  * A reference will make sure the surface isn't destroyed while we hold
119814b1c33eSDeepak Rawat  * it and will allow the calling client to use the surface handle in
119914b1c33eSDeepak Rawat  * the command stream.
120014b1c33eSDeepak Rawat  *
120114b1c33eSDeepak Rawat  * On successful return, the Ioctl returns the surface information given
120214b1c33eSDeepak Rawat  * to and returned from the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl.
120314b1c33eSDeepak Rawat  */
120414b1c33eSDeepak Rawat 
120514b1c33eSDeepak Rawat /**
120614b1c33eSDeepak Rawat  * struct drm_vmw_gb_surface_ref_ext_rep
120714b1c33eSDeepak Rawat  *
120814b1c33eSDeepak Rawat  * @creq: The data used as input when the surface was created, as described
120914b1c33eSDeepak Rawat  *        above at "struct drm_vmw_gb_surface_create_ext_req"
121014b1c33eSDeepak Rawat  * @crep: Additional data output when the surface was created, as described
121114b1c33eSDeepak Rawat  *        above at "struct drm_vmw_gb_surface_create_rep"
121214b1c33eSDeepak Rawat  *
121314b1c33eSDeepak Rawat  * Output Argument to the DRM_VMW_GB_SURFACE_REF_EXT ioctl.
121414b1c33eSDeepak Rawat  */
121514b1c33eSDeepak Rawat struct drm_vmw_gb_surface_ref_ext_rep {
121614b1c33eSDeepak Rawat 	struct drm_vmw_gb_surface_create_ext_req creq;
121714b1c33eSDeepak Rawat 	struct drm_vmw_gb_surface_create_rep crep;
121814b1c33eSDeepak Rawat };
121914b1c33eSDeepak Rawat 
122014b1c33eSDeepak Rawat /**
122114b1c33eSDeepak Rawat  * union drm_vmw_gb_surface_reference_ext_arg
122214b1c33eSDeepak Rawat  *
122314b1c33eSDeepak Rawat  * @req: Input data as described above at "struct drm_vmw_surface_arg"
122414b1c33eSDeepak Rawat  * @rep: Output data as described above at
122514b1c33eSDeepak Rawat  *       "struct drm_vmw_gb_surface_ref_ext_rep"
122614b1c33eSDeepak Rawat  *
122714b1c33eSDeepak Rawat  * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl.
122814b1c33eSDeepak Rawat  */
122914b1c33eSDeepak Rawat union drm_vmw_gb_surface_reference_ext_arg {
123014b1c33eSDeepak Rawat 	struct drm_vmw_gb_surface_ref_ext_rep rep;
123114b1c33eSDeepak Rawat 	struct drm_vmw_surface_arg req;
123214b1c33eSDeepak Rawat };
123314b1c33eSDeepak Rawat 
1234cb92a323SRoland Scheidegger /**
1235cb92a323SRoland Scheidegger  * struct drm_vmw_msg_arg
1236cb92a323SRoland Scheidegger  *
1237cb92a323SRoland Scheidegger  * @send: Pointer to user-space msg string (null terminated).
1238cb92a323SRoland Scheidegger  * @receive: Pointer to user-space receive buffer.
1239cb92a323SRoland Scheidegger  * @send_only: Boolean whether this is only sending or receiving too.
1240cb92a323SRoland Scheidegger  *
1241cb92a323SRoland Scheidegger  * Argument to the DRM_VMW_MSG ioctl.
1242cb92a323SRoland Scheidegger  */
1243cb92a323SRoland Scheidegger struct drm_vmw_msg_arg {
1244cb92a323SRoland Scheidegger 	__u64 send;
1245cb92a323SRoland Scheidegger 	__u64 receive;
1246cb92a323SRoland Scheidegger 	__s32 send_only;
1247cb92a323SRoland Scheidegger 	__u32 receive_len;
1248cb92a323SRoland Scheidegger };
1249cb92a323SRoland Scheidegger 
12507a7a933eSMartin Krastev /**
12517a7a933eSMartin Krastev  * struct drm_vmw_mksstat_add_arg
12527a7a933eSMartin Krastev  *
12537a7a933eSMartin Krastev  * @stat: Pointer to user-space stat-counters array, page-aligned.
12547a7a933eSMartin Krastev  * @info: Pointer to user-space counter-infos array, page-aligned.
12557a7a933eSMartin Krastev  * @strs: Pointer to user-space stat strings, page-aligned.
12567a7a933eSMartin Krastev  * @stat_len: Length in bytes of stat-counters array.
12577a7a933eSMartin Krastev  * @info_len: Length in bytes of counter-infos array.
12587a7a933eSMartin Krastev  * @strs_len: Length in bytes of the stat strings, terminators included.
12597a7a933eSMartin Krastev  * @description: Pointer to instance descriptor string; will be truncated
12607a7a933eSMartin Krastev  *               to MKS_GUEST_STAT_INSTANCE_DESC_LENGTH chars.
12617a7a933eSMartin Krastev  * @id: Output identifier of the produced record; -1 if error.
12627a7a933eSMartin Krastev  *
12637a7a933eSMartin Krastev  * Argument to the DRM_VMW_MKSSTAT_ADD ioctl.
12647a7a933eSMartin Krastev  */
12657a7a933eSMartin Krastev struct drm_vmw_mksstat_add_arg {
12667a7a933eSMartin Krastev 	__u64 stat;
12677a7a933eSMartin Krastev 	__u64 info;
12687a7a933eSMartin Krastev 	__u64 strs;
12697a7a933eSMartin Krastev 	__u64 stat_len;
12707a7a933eSMartin Krastev 	__u64 info_len;
12717a7a933eSMartin Krastev 	__u64 strs_len;
12727a7a933eSMartin Krastev 	__u64 description;
12737a7a933eSMartin Krastev 	__u64 id;
12747a7a933eSMartin Krastev };
12757a7a933eSMartin Krastev 
12767a7a933eSMartin Krastev /**
12777a7a933eSMartin Krastev  * struct drm_vmw_mksstat_remove_arg
12787a7a933eSMartin Krastev  *
12797a7a933eSMartin Krastev  * @id: Identifier of the record being disposed, originally obtained through
12807a7a933eSMartin Krastev  *      DRM_VMW_MKSSTAT_ADD ioctl.
12817a7a933eSMartin Krastev  *
12827a7a933eSMartin Krastev  * Argument to the DRM_VMW_MKSSTAT_REMOVE ioctl.
12837a7a933eSMartin Krastev  */
12847a7a933eSMartin Krastev struct drm_vmw_mksstat_remove_arg {
12857a7a933eSMartin Krastev 	__u64 id;
12867a7a933eSMartin Krastev };
12877a7a933eSMartin Krastev 
1288d3450e00SEmil Velikov #if defined(__cplusplus)
1289d3450e00SEmil Velikov }
1290d3450e00SEmil Velikov #endif
1291d3450e00SEmil Velikov 
1292718dceddSDavid Howells #endif
1293