xref: /openbmc/linux/include/uapi/drm/vmwgfx_drm.h (revision 857aea1c)
1718dceddSDavid Howells /**************************************************************************
2718dceddSDavid Howells  *
3718dceddSDavid Howells  * Copyright © 2009 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 
311d7a5cbfSThomas Hellstrom #ifndef __KERNEL__
321d7a5cbfSThomas Hellstrom #include <drm.h>
331d7a5cbfSThomas Hellstrom #endif
341d7a5cbfSThomas Hellstrom 
35718dceddSDavid Howells #define DRM_VMW_MAX_SURFACE_FACES 6
36718dceddSDavid Howells #define DRM_VMW_MAX_MIP_LEVELS 24
37718dceddSDavid Howells 
38718dceddSDavid Howells 
39718dceddSDavid Howells #define DRM_VMW_GET_PARAM            0
40718dceddSDavid Howells #define DRM_VMW_ALLOC_DMABUF         1
41718dceddSDavid Howells #define DRM_VMW_UNREF_DMABUF         2
42718dceddSDavid Howells #define DRM_VMW_CURSOR_BYPASS        3
43718dceddSDavid Howells /* guarded by DRM_VMW_PARAM_NUM_STREAMS != 0*/
44718dceddSDavid Howells #define DRM_VMW_CONTROL_STREAM       4
45718dceddSDavid Howells #define DRM_VMW_CLAIM_STREAM         5
46718dceddSDavid Howells #define DRM_VMW_UNREF_STREAM         6
47718dceddSDavid Howells /* guarded by DRM_VMW_PARAM_3D == 1 */
48718dceddSDavid Howells #define DRM_VMW_CREATE_CONTEXT       7
49718dceddSDavid Howells #define DRM_VMW_UNREF_CONTEXT        8
50718dceddSDavid Howells #define DRM_VMW_CREATE_SURFACE       9
51718dceddSDavid Howells #define DRM_VMW_UNREF_SURFACE        10
52718dceddSDavid Howells #define DRM_VMW_REF_SURFACE          11
53718dceddSDavid Howells #define DRM_VMW_EXECBUF              12
54718dceddSDavid Howells #define DRM_VMW_GET_3D_CAP           13
55718dceddSDavid Howells #define DRM_VMW_FENCE_WAIT           14
56718dceddSDavid Howells #define DRM_VMW_FENCE_SIGNALED       15
57718dceddSDavid Howells #define DRM_VMW_FENCE_UNREF          16
58718dceddSDavid Howells #define DRM_VMW_FENCE_EVENT          17
59718dceddSDavid Howells #define DRM_VMW_PRESENT              18
60718dceddSDavid Howells #define DRM_VMW_PRESENT_READBACK     19
61718dceddSDavid Howells #define DRM_VMW_UPDATE_LAYOUT        20
62cfe4d53eSThomas Hellstrom #define DRM_VMW_CREATE_SHADER        21
63cfe4d53eSThomas Hellstrom #define DRM_VMW_UNREF_SHADER         22
64cfe4d53eSThomas Hellstrom #define DRM_VMW_GB_SURFACE_CREATE    23
65cfe4d53eSThomas Hellstrom #define DRM_VMW_GB_SURFACE_REF       24
661d7a5cbfSThomas Hellstrom #define DRM_VMW_SYNCCPU              25
67718dceddSDavid Howells 
68718dceddSDavid Howells /*************************************************************************/
69718dceddSDavid Howells /**
70718dceddSDavid Howells  * DRM_VMW_GET_PARAM - get device information.
71718dceddSDavid Howells  *
72718dceddSDavid Howells  * DRM_VMW_PARAM_FIFO_OFFSET:
73718dceddSDavid Howells  * Offset to use to map the first page of the FIFO read-only.
74718dceddSDavid Howells  * The fifo is mapped using the mmap() system call on the drm device.
75718dceddSDavid Howells  *
76718dceddSDavid Howells  * DRM_VMW_PARAM_OVERLAY_IOCTL:
77718dceddSDavid Howells  * Does the driver support the overlay ioctl.
78718dceddSDavid Howells  */
79718dceddSDavid Howells 
80718dceddSDavid Howells #define DRM_VMW_PARAM_NUM_STREAMS      0
81718dceddSDavid Howells #define DRM_VMW_PARAM_NUM_FREE_STREAMS 1
82718dceddSDavid Howells #define DRM_VMW_PARAM_3D               2
83718dceddSDavid Howells #define DRM_VMW_PARAM_HW_CAPS          3
84718dceddSDavid Howells #define DRM_VMW_PARAM_FIFO_CAPS        4
85718dceddSDavid Howells #define DRM_VMW_PARAM_MAX_FB_SIZE      5
86718dceddSDavid Howells #define DRM_VMW_PARAM_FIFO_HW_VERSION  6
87cfe4d53eSThomas Hellstrom #define DRM_VMW_PARAM_MAX_SURF_MEMORY  7
88cfe4d53eSThomas Hellstrom #define DRM_VMW_PARAM_3D_CAPS_SIZE     8
89311474dbSThomas Hellstrom #define DRM_VMW_PARAM_MAX_MOB_MEMORY   9
90857aea1cSCharmaine Lee #define DRM_VMW_PARAM_MAX_MOB_SIZE     10
91718dceddSDavid Howells 
92718dceddSDavid Howells /**
93718dceddSDavid Howells  * struct drm_vmw_getparam_arg
94718dceddSDavid Howells  *
95718dceddSDavid Howells  * @value: Returned value. //Out
96718dceddSDavid Howells  * @param: Parameter to query. //In.
97718dceddSDavid Howells  *
98718dceddSDavid Howells  * Argument to the DRM_VMW_GET_PARAM Ioctl.
99718dceddSDavid Howells  */
100718dceddSDavid Howells 
101718dceddSDavid Howells struct drm_vmw_getparam_arg {
102718dceddSDavid Howells 	uint64_t value;
103718dceddSDavid Howells 	uint32_t param;
104718dceddSDavid Howells 	uint32_t pad64;
105718dceddSDavid Howells };
106718dceddSDavid Howells 
107718dceddSDavid Howells /*************************************************************************/
108718dceddSDavid Howells /**
109718dceddSDavid Howells  * DRM_VMW_CREATE_CONTEXT - Create a host context.
110718dceddSDavid Howells  *
111718dceddSDavid Howells  * Allocates a device unique context id, and queues a create context command
112718dceddSDavid Howells  * for the host. Does not wait for host completion.
113718dceddSDavid Howells  */
114718dceddSDavid Howells 
115718dceddSDavid Howells /**
116718dceddSDavid Howells  * struct drm_vmw_context_arg
117718dceddSDavid Howells  *
118718dceddSDavid Howells  * @cid: Device unique context ID.
119718dceddSDavid Howells  *
120718dceddSDavid Howells  * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
121718dceddSDavid Howells  * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
122718dceddSDavid Howells  */
123718dceddSDavid Howells 
124718dceddSDavid Howells struct drm_vmw_context_arg {
125718dceddSDavid Howells 	int32_t cid;
126718dceddSDavid Howells 	uint32_t pad64;
127718dceddSDavid Howells };
128718dceddSDavid Howells 
129718dceddSDavid Howells /*************************************************************************/
130718dceddSDavid Howells /**
131718dceddSDavid Howells  * DRM_VMW_UNREF_CONTEXT - Create a host context.
132718dceddSDavid Howells  *
133718dceddSDavid Howells  * Frees a global context id, and queues a destroy host command for the host.
134718dceddSDavid Howells  * Does not wait for host completion. The context ID can be used directly
135718dceddSDavid Howells  * in the command stream and shows up as the same context ID on the host.
136718dceddSDavid Howells  */
137718dceddSDavid Howells 
138718dceddSDavid Howells /*************************************************************************/
139718dceddSDavid Howells /**
140718dceddSDavid Howells  * DRM_VMW_CREATE_SURFACE - Create a host suface.
141718dceddSDavid Howells  *
142718dceddSDavid Howells  * Allocates a device unique surface id, and queues a create surface command
143718dceddSDavid Howells  * for the host. Does not wait for host completion. The surface ID can be
144718dceddSDavid Howells  * used directly in the command stream and shows up as the same surface
145718dceddSDavid Howells  * ID on the host.
146718dceddSDavid Howells  */
147718dceddSDavid Howells 
148718dceddSDavid Howells /**
149718dceddSDavid Howells  * struct drm_wmv_surface_create_req
150718dceddSDavid Howells  *
151718dceddSDavid Howells  * @flags: Surface flags as understood by the host.
152718dceddSDavid Howells  * @format: Surface format as understood by the host.
153718dceddSDavid Howells  * @mip_levels: Number of mip levels for each face.
154718dceddSDavid Howells  * An unused face should have 0 encoded.
155718dceddSDavid Howells  * @size_addr: Address of a user-space array of sruct drm_vmw_size
156718dceddSDavid Howells  * cast to an uint64_t for 32-64 bit compatibility.
157718dceddSDavid Howells  * The size of the array should equal the total number of mipmap levels.
158718dceddSDavid Howells  * @shareable: Boolean whether other clients (as identified by file descriptors)
159718dceddSDavid Howells  * may reference this surface.
160718dceddSDavid Howells  * @scanout: Boolean whether the surface is intended to be used as a
161718dceddSDavid Howells  * scanout.
162718dceddSDavid Howells  *
163718dceddSDavid Howells  * Input data to the DRM_VMW_CREATE_SURFACE Ioctl.
164718dceddSDavid Howells  * Output data from the DRM_VMW_REF_SURFACE Ioctl.
165718dceddSDavid Howells  */
166718dceddSDavid Howells 
167718dceddSDavid Howells struct drm_vmw_surface_create_req {
168718dceddSDavid Howells 	uint32_t flags;
169718dceddSDavid Howells 	uint32_t format;
170718dceddSDavid Howells 	uint32_t mip_levels[DRM_VMW_MAX_SURFACE_FACES];
171718dceddSDavid Howells 	uint64_t size_addr;
172718dceddSDavid Howells 	int32_t shareable;
173718dceddSDavid Howells 	int32_t scanout;
174718dceddSDavid Howells };
175718dceddSDavid Howells 
176718dceddSDavid Howells /**
177718dceddSDavid Howells  * struct drm_wmv_surface_arg
178718dceddSDavid Howells  *
179718dceddSDavid Howells  * @sid: Surface id of created surface or surface to destroy or reference.
180718dceddSDavid Howells  *
181718dceddSDavid Howells  * Output data from the DRM_VMW_CREATE_SURFACE Ioctl.
182718dceddSDavid Howells  * Input argument to the DRM_VMW_UNREF_SURFACE Ioctl.
183718dceddSDavid Howells  * Input argument to the DRM_VMW_REF_SURFACE Ioctl.
184718dceddSDavid Howells  */
185718dceddSDavid Howells 
186718dceddSDavid Howells struct drm_vmw_surface_arg {
187718dceddSDavid Howells 	int32_t sid;
188718dceddSDavid Howells 	uint32_t pad64;
189718dceddSDavid Howells };
190718dceddSDavid Howells 
191718dceddSDavid Howells /**
192718dceddSDavid Howells  * struct drm_vmw_size ioctl.
193718dceddSDavid Howells  *
194718dceddSDavid Howells  * @width - mip level width
195718dceddSDavid Howells  * @height - mip level height
196718dceddSDavid Howells  * @depth - mip level depth
197718dceddSDavid Howells  *
198718dceddSDavid Howells  * Description of a mip level.
199718dceddSDavid Howells  * Input data to the DRM_WMW_CREATE_SURFACE Ioctl.
200718dceddSDavid Howells  */
201718dceddSDavid Howells 
202718dceddSDavid Howells struct drm_vmw_size {
203718dceddSDavid Howells 	uint32_t width;
204718dceddSDavid Howells 	uint32_t height;
205718dceddSDavid Howells 	uint32_t depth;
206718dceddSDavid Howells 	uint32_t pad64;
207718dceddSDavid Howells };
208718dceddSDavid Howells 
209718dceddSDavid Howells /**
210718dceddSDavid Howells  * union drm_vmw_surface_create_arg
211718dceddSDavid Howells  *
212718dceddSDavid Howells  * @rep: Output data as described above.
213718dceddSDavid Howells  * @req: Input data as described above.
214718dceddSDavid Howells  *
215718dceddSDavid Howells  * Argument to the DRM_VMW_CREATE_SURFACE Ioctl.
216718dceddSDavid Howells  */
217718dceddSDavid Howells 
218718dceddSDavid Howells union drm_vmw_surface_create_arg {
219718dceddSDavid Howells 	struct drm_vmw_surface_arg rep;
220718dceddSDavid Howells 	struct drm_vmw_surface_create_req req;
221718dceddSDavid Howells };
222718dceddSDavid Howells 
223718dceddSDavid Howells /*************************************************************************/
224718dceddSDavid Howells /**
225718dceddSDavid Howells  * DRM_VMW_REF_SURFACE - Reference a host surface.
226718dceddSDavid Howells  *
227718dceddSDavid Howells  * Puts a reference on a host surface with a give sid, as previously
228718dceddSDavid Howells  * returned by the DRM_VMW_CREATE_SURFACE ioctl.
229718dceddSDavid Howells  * A reference will make sure the surface isn't destroyed while we hold
230718dceddSDavid Howells  * it and will allow the calling client to use the surface ID in the command
231718dceddSDavid Howells  * stream.
232718dceddSDavid Howells  *
233718dceddSDavid Howells  * On successful return, the Ioctl returns the surface information given
234718dceddSDavid Howells  * in the DRM_VMW_CREATE_SURFACE ioctl.
235718dceddSDavid Howells  */
236718dceddSDavid Howells 
237718dceddSDavid Howells /**
238718dceddSDavid Howells  * union drm_vmw_surface_reference_arg
239718dceddSDavid Howells  *
240718dceddSDavid Howells  * @rep: Output data as described above.
241718dceddSDavid Howells  * @req: Input data as described above.
242718dceddSDavid Howells  *
243718dceddSDavid Howells  * Argument to the DRM_VMW_REF_SURFACE Ioctl.
244718dceddSDavid Howells  */
245718dceddSDavid Howells 
246718dceddSDavid Howells union drm_vmw_surface_reference_arg {
247718dceddSDavid Howells 	struct drm_vmw_surface_create_req rep;
248718dceddSDavid Howells 	struct drm_vmw_surface_arg req;
249718dceddSDavid Howells };
250718dceddSDavid Howells 
251718dceddSDavid Howells /*************************************************************************/
252718dceddSDavid Howells /**
253718dceddSDavid Howells  * DRM_VMW_UNREF_SURFACE - Unreference a host surface.
254718dceddSDavid Howells  *
255718dceddSDavid Howells  * Clear a reference previously put on a host surface.
256718dceddSDavid Howells  * When all references are gone, including the one implicitly placed
257718dceddSDavid Howells  * on creation,
258718dceddSDavid Howells  * a destroy surface command will be queued for the host.
259718dceddSDavid Howells  * Does not wait for completion.
260718dceddSDavid Howells  */
261718dceddSDavid Howells 
262718dceddSDavid Howells /*************************************************************************/
263718dceddSDavid Howells /**
264718dceddSDavid Howells  * DRM_VMW_EXECBUF
265718dceddSDavid Howells  *
266718dceddSDavid Howells  * Submit a command buffer for execution on the host, and return a
267718dceddSDavid Howells  * fence seqno that when signaled, indicates that the command buffer has
268718dceddSDavid Howells  * executed.
269718dceddSDavid Howells  */
270718dceddSDavid Howells 
271718dceddSDavid Howells /**
272718dceddSDavid Howells  * struct drm_vmw_execbuf_arg
273718dceddSDavid Howells  *
274718dceddSDavid Howells  * @commands: User-space address of a command buffer cast to an uint64_t.
275718dceddSDavid Howells  * @command-size: Size in bytes of the command buffer.
276718dceddSDavid Howells  * @throttle-us: Sleep until software is less than @throttle_us
277718dceddSDavid Howells  * microseconds ahead of hardware. The driver may round this value
278718dceddSDavid Howells  * to the nearest kernel tick.
279718dceddSDavid Howells  * @fence_rep: User-space address of a struct drm_vmw_fence_rep cast to an
280718dceddSDavid Howells  * uint64_t.
281718dceddSDavid Howells  * @version: Allows expanding the execbuf ioctl parameters without breaking
282718dceddSDavid Howells  * backwards compatibility, since user-space will always tell the kernel
283718dceddSDavid Howells  * which version it uses.
284718dceddSDavid Howells  * @flags: Execbuf flags. None currently.
285718dceddSDavid Howells  *
286718dceddSDavid Howells  * Argument to the DRM_VMW_EXECBUF Ioctl.
287718dceddSDavid Howells  */
288718dceddSDavid Howells 
289718dceddSDavid Howells #define DRM_VMW_EXECBUF_VERSION 1
290718dceddSDavid Howells 
291718dceddSDavid Howells struct drm_vmw_execbuf_arg {
292718dceddSDavid Howells 	uint64_t commands;
293718dceddSDavid Howells 	uint32_t command_size;
294718dceddSDavid Howells 	uint32_t throttle_us;
295718dceddSDavid Howells 	uint64_t fence_rep;
296718dceddSDavid Howells 	uint32_t version;
297718dceddSDavid Howells 	uint32_t flags;
298718dceddSDavid Howells };
299718dceddSDavid Howells 
300718dceddSDavid Howells /**
301718dceddSDavid Howells  * struct drm_vmw_fence_rep
302718dceddSDavid Howells  *
303718dceddSDavid Howells  * @handle: Fence object handle for fence associated with a command submission.
304718dceddSDavid Howells  * @mask: Fence flags relevant for this fence object.
305718dceddSDavid Howells  * @seqno: Fence sequence number in fifo. A fence object with a lower
306718dceddSDavid Howells  * seqno will signal the EXEC flag before a fence object with a higher
307718dceddSDavid Howells  * seqno. This can be used by user-space to avoid kernel calls to determine
308718dceddSDavid Howells  * whether a fence has signaled the EXEC flag. Note that @seqno will
309718dceddSDavid Howells  * wrap at 32-bit.
310718dceddSDavid Howells  * @passed_seqno: The highest seqno number processed by the hardware
311718dceddSDavid Howells  * so far. This can be used to mark user-space fence objects as signaled, and
312718dceddSDavid Howells  * to determine whether a fence seqno might be stale.
313718dceddSDavid Howells  * @error: This member should've been set to -EFAULT on submission.
314718dceddSDavid Howells  * The following actions should be take on completion:
315718dceddSDavid Howells  * error == -EFAULT: Fence communication failed. The host is synchronized.
316718dceddSDavid Howells  * Use the last fence id read from the FIFO fence register.
317718dceddSDavid Howells  * error != 0 && error != -EFAULT:
318718dceddSDavid Howells  * Fence submission failed. The host is synchronized. Use the fence_seq member.
319718dceddSDavid Howells  * error == 0: All is OK, The host may not be synchronized.
320718dceddSDavid Howells  * Use the fence_seq member.
321718dceddSDavid Howells  *
322718dceddSDavid Howells  * Input / Output data to the DRM_VMW_EXECBUF Ioctl.
323718dceddSDavid Howells  */
324718dceddSDavid Howells 
325718dceddSDavid Howells struct drm_vmw_fence_rep {
326718dceddSDavid Howells 	uint32_t handle;
327718dceddSDavid Howells 	uint32_t mask;
328718dceddSDavid Howells 	uint32_t seqno;
329718dceddSDavid Howells 	uint32_t passed_seqno;
330718dceddSDavid Howells 	uint32_t pad64;
331718dceddSDavid Howells 	int32_t error;
332718dceddSDavid Howells };
333718dceddSDavid Howells 
334718dceddSDavid Howells /*************************************************************************/
335718dceddSDavid Howells /**
336718dceddSDavid Howells  * DRM_VMW_ALLOC_DMABUF
337718dceddSDavid Howells  *
338718dceddSDavid Howells  * Allocate a DMA buffer that is visible also to the host.
339718dceddSDavid Howells  * NOTE: The buffer is
340718dceddSDavid Howells  * identified by a handle and an offset, which are private to the guest, but
341718dceddSDavid Howells  * useable in the command stream. The guest kernel may translate these
342718dceddSDavid Howells  * and patch up the command stream accordingly. In the future, the offset may
343718dceddSDavid Howells  * be zero at all times, or it may disappear from the interface before it is
344718dceddSDavid Howells  * fixed.
345718dceddSDavid Howells  *
346718dceddSDavid Howells  * The DMA buffer may stay user-space mapped in the guest at all times,
347718dceddSDavid Howells  * and is thus suitable for sub-allocation.
348718dceddSDavid Howells  *
349718dceddSDavid Howells  * DMA buffers are mapped using the mmap() syscall on the drm device.
350718dceddSDavid Howells  */
351718dceddSDavid Howells 
352718dceddSDavid Howells /**
353718dceddSDavid Howells  * struct drm_vmw_alloc_dmabuf_req
354718dceddSDavid Howells  *
355718dceddSDavid Howells  * @size: Required minimum size of the buffer.
356718dceddSDavid Howells  *
357718dceddSDavid Howells  * Input data to the DRM_VMW_ALLOC_DMABUF Ioctl.
358718dceddSDavid Howells  */
359718dceddSDavid Howells 
360718dceddSDavid Howells struct drm_vmw_alloc_dmabuf_req {
361718dceddSDavid Howells 	uint32_t size;
362718dceddSDavid Howells 	uint32_t pad64;
363718dceddSDavid Howells };
364718dceddSDavid Howells 
365718dceddSDavid Howells /**
366718dceddSDavid Howells  * struct drm_vmw_dmabuf_rep
367718dceddSDavid Howells  *
368718dceddSDavid Howells  * @map_handle: Offset to use in the mmap() call used to map the buffer.
369718dceddSDavid Howells  * @handle: Handle unique to this buffer. Used for unreferencing.
370718dceddSDavid Howells  * @cur_gmr_id: GMR id to use in the command stream when this buffer is
371718dceddSDavid Howells  * referenced. See not above.
372718dceddSDavid Howells  * @cur_gmr_offset: Offset to use in the command stream when this buffer is
373718dceddSDavid Howells  * referenced. See note above.
374718dceddSDavid Howells  *
375718dceddSDavid Howells  * Output data from the DRM_VMW_ALLOC_DMABUF Ioctl.
376718dceddSDavid Howells  */
377718dceddSDavid Howells 
378718dceddSDavid Howells struct drm_vmw_dmabuf_rep {
379718dceddSDavid Howells 	uint64_t map_handle;
380718dceddSDavid Howells 	uint32_t handle;
381718dceddSDavid Howells 	uint32_t cur_gmr_id;
382718dceddSDavid Howells 	uint32_t cur_gmr_offset;
383718dceddSDavid Howells 	uint32_t pad64;
384718dceddSDavid Howells };
385718dceddSDavid Howells 
386718dceddSDavid Howells /**
387718dceddSDavid Howells  * union drm_vmw_dmabuf_arg
388718dceddSDavid Howells  *
389718dceddSDavid Howells  * @req: Input data as described above.
390718dceddSDavid Howells  * @rep: Output data as described above.
391718dceddSDavid Howells  *
392718dceddSDavid Howells  * Argument to the DRM_VMW_ALLOC_DMABUF Ioctl.
393718dceddSDavid Howells  */
394718dceddSDavid Howells 
395718dceddSDavid Howells union drm_vmw_alloc_dmabuf_arg {
396718dceddSDavid Howells 	struct drm_vmw_alloc_dmabuf_req req;
397718dceddSDavid Howells 	struct drm_vmw_dmabuf_rep rep;
398718dceddSDavid Howells };
399718dceddSDavid Howells 
400718dceddSDavid Howells /*************************************************************************/
401718dceddSDavid Howells /**
402718dceddSDavid Howells  * DRM_VMW_UNREF_DMABUF - Free a DMA buffer.
403718dceddSDavid Howells  *
404718dceddSDavid Howells  */
405718dceddSDavid Howells 
406718dceddSDavid Howells /**
407718dceddSDavid Howells  * struct drm_vmw_unref_dmabuf_arg
408718dceddSDavid Howells  *
409718dceddSDavid Howells  * @handle: Handle indicating what buffer to free. Obtained from the
410718dceddSDavid Howells  * DRM_VMW_ALLOC_DMABUF Ioctl.
411718dceddSDavid Howells  *
412718dceddSDavid Howells  * Argument to the DRM_VMW_UNREF_DMABUF Ioctl.
413718dceddSDavid Howells  */
414718dceddSDavid Howells 
415718dceddSDavid Howells struct drm_vmw_unref_dmabuf_arg {
416718dceddSDavid Howells 	uint32_t handle;
417718dceddSDavid Howells 	uint32_t pad64;
418718dceddSDavid Howells };
419718dceddSDavid Howells 
420718dceddSDavid Howells /*************************************************************************/
421718dceddSDavid Howells /**
422718dceddSDavid Howells  * DRM_VMW_CONTROL_STREAM - Control overlays, aka streams.
423718dceddSDavid Howells  *
424718dceddSDavid Howells  * This IOCTL controls the overlay units of the svga device.
425718dceddSDavid Howells  * The SVGA overlay units does not work like regular hardware units in
426718dceddSDavid Howells  * that they do not automaticaly read back the contents of the given dma
427718dceddSDavid Howells  * buffer. But instead only read back for each call to this ioctl, and
428718dceddSDavid Howells  * at any point between this call being made and a following call that
429718dceddSDavid Howells  * either changes the buffer or disables the stream.
430718dceddSDavid Howells  */
431718dceddSDavid Howells 
432718dceddSDavid Howells /**
433718dceddSDavid Howells  * struct drm_vmw_rect
434718dceddSDavid Howells  *
435718dceddSDavid Howells  * Defines a rectangle. Used in the overlay ioctl to define
436718dceddSDavid Howells  * source and destination rectangle.
437718dceddSDavid Howells  */
438718dceddSDavid Howells 
439718dceddSDavid Howells struct drm_vmw_rect {
440718dceddSDavid Howells 	int32_t x;
441718dceddSDavid Howells 	int32_t y;
442718dceddSDavid Howells 	uint32_t w;
443718dceddSDavid Howells 	uint32_t h;
444718dceddSDavid Howells };
445718dceddSDavid Howells 
446718dceddSDavid Howells /**
447718dceddSDavid Howells  * struct drm_vmw_control_stream_arg
448718dceddSDavid Howells  *
449718dceddSDavid Howells  * @stream_id: Stearm to control
450718dceddSDavid Howells  * @enabled: If false all following arguments are ignored.
451718dceddSDavid Howells  * @handle: Handle to buffer for getting data from.
452718dceddSDavid Howells  * @format: Format of the overlay as understood by the host.
453718dceddSDavid Howells  * @width: Width of the overlay.
454718dceddSDavid Howells  * @height: Height of the overlay.
455718dceddSDavid Howells  * @size: Size of the overlay in bytes.
456718dceddSDavid Howells  * @pitch: Array of pitches, the two last are only used for YUV12 formats.
457718dceddSDavid Howells  * @offset: Offset from start of dma buffer to overlay.
458718dceddSDavid Howells  * @src: Source rect, must be within the defined area above.
459718dceddSDavid Howells  * @dst: Destination rect, x and y may be negative.
460718dceddSDavid Howells  *
461718dceddSDavid Howells  * Argument to the DRM_VMW_CONTROL_STREAM Ioctl.
462718dceddSDavid Howells  */
463718dceddSDavid Howells 
464718dceddSDavid Howells struct drm_vmw_control_stream_arg {
465718dceddSDavid Howells 	uint32_t stream_id;
466718dceddSDavid Howells 	uint32_t enabled;
467718dceddSDavid Howells 
468718dceddSDavid Howells 	uint32_t flags;
469718dceddSDavid Howells 	uint32_t color_key;
470718dceddSDavid Howells 
471718dceddSDavid Howells 	uint32_t handle;
472718dceddSDavid Howells 	uint32_t offset;
473718dceddSDavid Howells 	int32_t format;
474718dceddSDavid Howells 	uint32_t size;
475718dceddSDavid Howells 	uint32_t width;
476718dceddSDavid Howells 	uint32_t height;
477718dceddSDavid Howells 	uint32_t pitch[3];
478718dceddSDavid Howells 
479718dceddSDavid Howells 	uint32_t pad64;
480718dceddSDavid Howells 	struct drm_vmw_rect src;
481718dceddSDavid Howells 	struct drm_vmw_rect dst;
482718dceddSDavid Howells };
483718dceddSDavid Howells 
484718dceddSDavid Howells /*************************************************************************/
485718dceddSDavid Howells /**
486718dceddSDavid Howells  * DRM_VMW_CURSOR_BYPASS - Give extra information about cursor bypass.
487718dceddSDavid Howells  *
488718dceddSDavid Howells  */
489718dceddSDavid Howells 
490718dceddSDavid Howells #define DRM_VMW_CURSOR_BYPASS_ALL    (1 << 0)
491718dceddSDavid Howells #define DRM_VMW_CURSOR_BYPASS_FLAGS       (1)
492718dceddSDavid Howells 
493718dceddSDavid Howells /**
494718dceddSDavid Howells  * struct drm_vmw_cursor_bypass_arg
495718dceddSDavid Howells  *
496718dceddSDavid Howells  * @flags: Flags.
497718dceddSDavid Howells  * @crtc_id: Crtc id, only used if DMR_CURSOR_BYPASS_ALL isn't passed.
498718dceddSDavid Howells  * @xpos: X position of cursor.
499718dceddSDavid Howells  * @ypos: Y position of cursor.
500718dceddSDavid Howells  * @xhot: X hotspot.
501718dceddSDavid Howells  * @yhot: Y hotspot.
502718dceddSDavid Howells  *
503718dceddSDavid Howells  * Argument to the DRM_VMW_CURSOR_BYPASS Ioctl.
504718dceddSDavid Howells  */
505718dceddSDavid Howells 
506718dceddSDavid Howells struct drm_vmw_cursor_bypass_arg {
507718dceddSDavid Howells 	uint32_t flags;
508718dceddSDavid Howells 	uint32_t crtc_id;
509718dceddSDavid Howells 	int32_t xpos;
510718dceddSDavid Howells 	int32_t ypos;
511718dceddSDavid Howells 	int32_t xhot;
512718dceddSDavid Howells 	int32_t yhot;
513718dceddSDavid Howells };
514718dceddSDavid Howells 
515718dceddSDavid Howells /*************************************************************************/
516718dceddSDavid Howells /**
517718dceddSDavid Howells  * DRM_VMW_CLAIM_STREAM - Claim a single stream.
518718dceddSDavid Howells  */
519718dceddSDavid Howells 
520718dceddSDavid Howells /**
521718dceddSDavid Howells  * struct drm_vmw_context_arg
522718dceddSDavid Howells  *
523718dceddSDavid Howells  * @stream_id: Device unique context ID.
524718dceddSDavid Howells  *
525718dceddSDavid Howells  * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
526718dceddSDavid Howells  * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
527718dceddSDavid Howells  */
528718dceddSDavid Howells 
529718dceddSDavid Howells struct drm_vmw_stream_arg {
530718dceddSDavid Howells 	uint32_t stream_id;
531718dceddSDavid Howells 	uint32_t pad64;
532718dceddSDavid Howells };
533718dceddSDavid Howells 
534718dceddSDavid Howells /*************************************************************************/
535718dceddSDavid Howells /**
536718dceddSDavid Howells  * DRM_VMW_UNREF_STREAM - Unclaim a stream.
537718dceddSDavid Howells  *
538718dceddSDavid Howells  * Return a single stream that was claimed by this process. Also makes
539718dceddSDavid Howells  * sure that the stream has been stopped.
540718dceddSDavid Howells  */
541718dceddSDavid Howells 
542718dceddSDavid Howells /*************************************************************************/
543718dceddSDavid Howells /**
544718dceddSDavid Howells  * DRM_VMW_GET_3D_CAP
545718dceddSDavid Howells  *
546718dceddSDavid Howells  * Read 3D capabilities from the FIFO
547718dceddSDavid Howells  *
548718dceddSDavid Howells  */
549718dceddSDavid Howells 
550718dceddSDavid Howells /**
551718dceddSDavid Howells  * struct drm_vmw_get_3d_cap_arg
552718dceddSDavid Howells  *
553718dceddSDavid Howells  * @buffer: Pointer to a buffer for capability data, cast to an uint64_t
554718dceddSDavid Howells  * @size: Max size to copy
555718dceddSDavid Howells  *
556718dceddSDavid Howells  * Input argument to the DRM_VMW_GET_3D_CAP_IOCTL
557718dceddSDavid Howells  * ioctls.
558718dceddSDavid Howells  */
559718dceddSDavid Howells 
560718dceddSDavid Howells struct drm_vmw_get_3d_cap_arg {
561718dceddSDavid Howells 	uint64_t buffer;
562718dceddSDavid Howells 	uint32_t max_size;
563718dceddSDavid Howells 	uint32_t pad64;
564718dceddSDavid Howells };
565718dceddSDavid Howells 
566718dceddSDavid Howells /*************************************************************************/
567718dceddSDavid Howells /**
568718dceddSDavid Howells  * DRM_VMW_FENCE_WAIT
569718dceddSDavid Howells  *
570718dceddSDavid Howells  * Waits for a fence object to signal. The wait is interruptible, so that
571718dceddSDavid Howells  * signals may be delivered during the interrupt. The wait may timeout,
572718dceddSDavid Howells  * in which case the calls returns -EBUSY. If the wait is restarted,
573718dceddSDavid Howells  * that is restarting without resetting @cookie_valid to zero,
574718dceddSDavid Howells  * the timeout is computed from the first call.
575718dceddSDavid Howells  *
576718dceddSDavid Howells  * The flags argument to the DRM_VMW_FENCE_WAIT ioctl indicates what to wait
577718dceddSDavid Howells  * on:
578718dceddSDavid Howells  * DRM_VMW_FENCE_FLAG_EXEC: All commands ahead of the fence in the command
579718dceddSDavid Howells  * stream
580718dceddSDavid Howells  * have executed.
581718dceddSDavid Howells  * DRM_VMW_FENCE_FLAG_QUERY: All query results resulting from query finish
582718dceddSDavid Howells  * commands
583718dceddSDavid Howells  * in the buffer given to the EXECBUF ioctl returning the fence object handle
584718dceddSDavid Howells  * are available to user-space.
585718dceddSDavid Howells  *
586718dceddSDavid Howells  * DRM_VMW_WAIT_OPTION_UNREF: If this wait option is given, and the
587718dceddSDavid Howells  * fenc wait ioctl returns 0, the fence object has been unreferenced after
588718dceddSDavid Howells  * the wait.
589718dceddSDavid Howells  */
590718dceddSDavid Howells 
591718dceddSDavid Howells #define DRM_VMW_FENCE_FLAG_EXEC   (1 << 0)
592718dceddSDavid Howells #define DRM_VMW_FENCE_FLAG_QUERY  (1 << 1)
593718dceddSDavid Howells 
594718dceddSDavid Howells #define DRM_VMW_WAIT_OPTION_UNREF (1 << 0)
595718dceddSDavid Howells 
596718dceddSDavid Howells /**
597718dceddSDavid Howells  * struct drm_vmw_fence_wait_arg
598718dceddSDavid Howells  *
599718dceddSDavid Howells  * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
600718dceddSDavid Howells  * @cookie_valid: Must be reset to 0 on first call. Left alone on restart.
601718dceddSDavid Howells  * @kernel_cookie: Set to 0 on first call. Left alone on restart.
602718dceddSDavid Howells  * @timeout_us: Wait timeout in microseconds. 0 for indefinite timeout.
603718dceddSDavid Howells  * @lazy: Set to 1 if timing is not critical. Allow more than a kernel tick
604718dceddSDavid Howells  * before returning.
605718dceddSDavid Howells  * @flags: Fence flags to wait on.
606718dceddSDavid Howells  * @wait_options: Options that control the behaviour of the wait ioctl.
607718dceddSDavid Howells  *
608718dceddSDavid Howells  * Input argument to the DRM_VMW_FENCE_WAIT ioctl.
609718dceddSDavid Howells  */
610718dceddSDavid Howells 
611718dceddSDavid Howells struct drm_vmw_fence_wait_arg {
612718dceddSDavid Howells 	uint32_t handle;
613718dceddSDavid Howells 	int32_t  cookie_valid;
614718dceddSDavid Howells 	uint64_t kernel_cookie;
615718dceddSDavid Howells 	uint64_t timeout_us;
616718dceddSDavid Howells 	int32_t lazy;
617718dceddSDavid Howells 	int32_t flags;
618718dceddSDavid Howells 	int32_t wait_options;
619718dceddSDavid Howells 	int32_t pad64;
620718dceddSDavid Howells };
621718dceddSDavid Howells 
622718dceddSDavid Howells /*************************************************************************/
623718dceddSDavid Howells /**
624718dceddSDavid Howells  * DRM_VMW_FENCE_SIGNALED
625718dceddSDavid Howells  *
626718dceddSDavid Howells  * Checks if a fence object is signaled..
627718dceddSDavid Howells  */
628718dceddSDavid Howells 
629718dceddSDavid Howells /**
630718dceddSDavid Howells  * struct drm_vmw_fence_signaled_arg
631718dceddSDavid Howells  *
632718dceddSDavid Howells  * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
633718dceddSDavid Howells  * @flags: Fence object flags input to DRM_VMW_FENCE_SIGNALED ioctl
634718dceddSDavid Howells  * @signaled: Out: Flags signaled.
635718dceddSDavid Howells  * @sequence: Out: Highest sequence passed so far. Can be used to signal the
636718dceddSDavid Howells  * EXEC flag of user-space fence objects.
637718dceddSDavid Howells  *
638718dceddSDavid Howells  * Input/Output argument to the DRM_VMW_FENCE_SIGNALED and DRM_VMW_FENCE_UNREF
639718dceddSDavid Howells  * ioctls.
640718dceddSDavid Howells  */
641718dceddSDavid Howells 
642718dceddSDavid Howells struct drm_vmw_fence_signaled_arg {
643718dceddSDavid Howells 	 uint32_t handle;
644718dceddSDavid Howells 	 uint32_t flags;
645718dceddSDavid Howells 	 int32_t signaled;
646718dceddSDavid Howells 	 uint32_t passed_seqno;
647718dceddSDavid Howells 	 uint32_t signaled_flags;
648718dceddSDavid Howells 	 uint32_t pad64;
649718dceddSDavid Howells };
650718dceddSDavid Howells 
651718dceddSDavid Howells /*************************************************************************/
652718dceddSDavid Howells /**
653718dceddSDavid Howells  * DRM_VMW_FENCE_UNREF
654718dceddSDavid Howells  *
655718dceddSDavid Howells  * Unreferences a fence object, and causes it to be destroyed if there are no
656718dceddSDavid Howells  * other references to it.
657718dceddSDavid Howells  *
658718dceddSDavid Howells  */
659718dceddSDavid Howells 
660718dceddSDavid Howells /**
661718dceddSDavid Howells  * struct drm_vmw_fence_arg
662718dceddSDavid Howells  *
663718dceddSDavid Howells  * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
664718dceddSDavid Howells  *
665718dceddSDavid Howells  * Input/Output argument to the DRM_VMW_FENCE_UNREF ioctl..
666718dceddSDavid Howells  */
667718dceddSDavid Howells 
668718dceddSDavid Howells struct drm_vmw_fence_arg {
669718dceddSDavid Howells 	 uint32_t handle;
670718dceddSDavid Howells 	 uint32_t pad64;
671718dceddSDavid Howells };
672718dceddSDavid Howells 
673718dceddSDavid Howells 
674718dceddSDavid Howells /*************************************************************************/
675718dceddSDavid Howells /**
676718dceddSDavid Howells  * DRM_VMW_FENCE_EVENT
677718dceddSDavid Howells  *
678718dceddSDavid Howells  * Queues an event on a fence to be delivered on the drm character device
679718dceddSDavid Howells  * when the fence has signaled the DRM_VMW_FENCE_FLAG_EXEC flag.
680718dceddSDavid Howells  * Optionally the approximate time when the fence signaled is
681718dceddSDavid Howells  * given by the event.
682718dceddSDavid Howells  */
683718dceddSDavid Howells 
684718dceddSDavid Howells /*
685718dceddSDavid Howells  * The event type
686718dceddSDavid Howells  */
687718dceddSDavid Howells #define DRM_VMW_EVENT_FENCE_SIGNALED 0x80000000
688718dceddSDavid Howells 
689718dceddSDavid Howells struct drm_vmw_event_fence {
690718dceddSDavid Howells 	struct drm_event base;
691718dceddSDavid Howells 	uint64_t user_data;
692718dceddSDavid Howells 	uint32_t tv_sec;
693718dceddSDavid Howells 	uint32_t tv_usec;
694718dceddSDavid Howells };
695718dceddSDavid Howells 
696718dceddSDavid Howells /*
697718dceddSDavid Howells  * Flags that may be given to the command.
698718dceddSDavid Howells  */
699718dceddSDavid Howells /* Request fence signaled time on the event. */
700718dceddSDavid Howells #define DRM_VMW_FE_FLAG_REQ_TIME (1 << 0)
701718dceddSDavid Howells 
702718dceddSDavid Howells /**
703718dceddSDavid Howells  * struct drm_vmw_fence_event_arg
704718dceddSDavid Howells  *
705718dceddSDavid Howells  * @fence_rep: Pointer to fence_rep structure cast to uint64_t or 0 if
706718dceddSDavid Howells  * the fence is not supposed to be referenced by user-space.
707718dceddSDavid Howells  * @user_info: Info to be delivered with the event.
708718dceddSDavid Howells  * @handle: Attach the event to this fence only.
709718dceddSDavid Howells  * @flags: A set of flags as defined above.
710718dceddSDavid Howells  */
711718dceddSDavid Howells struct drm_vmw_fence_event_arg {
712718dceddSDavid Howells 	uint64_t fence_rep;
713718dceddSDavid Howells 	uint64_t user_data;
714718dceddSDavid Howells 	uint32_t handle;
715718dceddSDavid Howells 	uint32_t flags;
716718dceddSDavid Howells };
717718dceddSDavid Howells 
718718dceddSDavid Howells 
719718dceddSDavid Howells /*************************************************************************/
720718dceddSDavid Howells /**
721718dceddSDavid Howells  * DRM_VMW_PRESENT
722718dceddSDavid Howells  *
723718dceddSDavid Howells  * Executes an SVGA present on a given fb for a given surface. The surface
724718dceddSDavid Howells  * is placed on the framebuffer. Cliprects are given relative to the given
725718dceddSDavid Howells  * point (the point disignated by dest_{x|y}).
726718dceddSDavid Howells  *
727718dceddSDavid Howells  */
728718dceddSDavid Howells 
729718dceddSDavid Howells /**
730718dceddSDavid Howells  * struct drm_vmw_present_arg
731718dceddSDavid Howells  * @fb_id: framebuffer id to present / read back from.
732718dceddSDavid Howells  * @sid: Surface id to present from.
733718dceddSDavid Howells  * @dest_x: X placement coordinate for surface.
734718dceddSDavid Howells  * @dest_y: Y placement coordinate for surface.
735718dceddSDavid Howells  * @clips_ptr: Pointer to an array of clip rects cast to an uint64_t.
736718dceddSDavid Howells  * @num_clips: Number of cliprects given relative to the framebuffer origin,
737718dceddSDavid Howells  * in the same coordinate space as the frame buffer.
738718dceddSDavid Howells  * @pad64: Unused 64-bit padding.
739718dceddSDavid Howells  *
740718dceddSDavid Howells  * Input argument to the DRM_VMW_PRESENT ioctl.
741718dceddSDavid Howells  */
742718dceddSDavid Howells 
743718dceddSDavid Howells struct drm_vmw_present_arg {
744718dceddSDavid Howells 	uint32_t fb_id;
745718dceddSDavid Howells 	uint32_t sid;
746718dceddSDavid Howells 	int32_t dest_x;
747718dceddSDavid Howells 	int32_t dest_y;
748718dceddSDavid Howells 	uint64_t clips_ptr;
749718dceddSDavid Howells 	uint32_t num_clips;
750718dceddSDavid Howells 	uint32_t pad64;
751718dceddSDavid Howells };
752718dceddSDavid Howells 
753718dceddSDavid Howells 
754718dceddSDavid Howells /*************************************************************************/
755718dceddSDavid Howells /**
756718dceddSDavid Howells  * DRM_VMW_PRESENT_READBACK
757718dceddSDavid Howells  *
758718dceddSDavid Howells  * Executes an SVGA present readback from a given fb to the dma buffer
759718dceddSDavid Howells  * currently bound as the fb. If there is no dma buffer bound to the fb,
760718dceddSDavid Howells  * an error will be returned.
761718dceddSDavid Howells  *
762718dceddSDavid Howells  */
763718dceddSDavid Howells 
764718dceddSDavid Howells /**
765718dceddSDavid Howells  * struct drm_vmw_present_arg
766718dceddSDavid Howells  * @fb_id: fb_id to present / read back from.
767718dceddSDavid Howells  * @num_clips: Number of cliprects.
768718dceddSDavid Howells  * @clips_ptr: Pointer to an array of clip rects cast to an uint64_t.
769718dceddSDavid Howells  * @fence_rep: Pointer to a struct drm_vmw_fence_rep, cast to an uint64_t.
770718dceddSDavid Howells  * If this member is NULL, then the ioctl should not return a fence.
771718dceddSDavid Howells  */
772718dceddSDavid Howells 
773718dceddSDavid Howells struct drm_vmw_present_readback_arg {
774718dceddSDavid Howells 	 uint32_t fb_id;
775718dceddSDavid Howells 	 uint32_t num_clips;
776718dceddSDavid Howells 	 uint64_t clips_ptr;
777718dceddSDavid Howells 	 uint64_t fence_rep;
778718dceddSDavid Howells };
779718dceddSDavid Howells 
780718dceddSDavid Howells /*************************************************************************/
781718dceddSDavid Howells /**
782718dceddSDavid Howells  * DRM_VMW_UPDATE_LAYOUT - Update layout
783718dceddSDavid Howells  *
784718dceddSDavid Howells  * Updates the preferred modes and connection status for connectors. The
785718dceddSDavid Howells  * command consists of one drm_vmw_update_layout_arg pointing to an array
786718dceddSDavid Howells  * of num_outputs drm_vmw_rect's.
787718dceddSDavid Howells  */
788718dceddSDavid Howells 
789718dceddSDavid Howells /**
790718dceddSDavid Howells  * struct drm_vmw_update_layout_arg
791718dceddSDavid Howells  *
792718dceddSDavid Howells  * @num_outputs: number of active connectors
793718dceddSDavid Howells  * @rects: pointer to array of drm_vmw_rect cast to an uint64_t
794718dceddSDavid Howells  *
795718dceddSDavid Howells  * Input argument to the DRM_VMW_UPDATE_LAYOUT Ioctl.
796718dceddSDavid Howells  */
797718dceddSDavid Howells struct drm_vmw_update_layout_arg {
798718dceddSDavid Howells 	uint32_t num_outputs;
799718dceddSDavid Howells 	uint32_t pad64;
800718dceddSDavid Howells 	uint64_t rects;
801718dceddSDavid Howells };
802718dceddSDavid Howells 
803cfe4d53eSThomas Hellstrom 
804cfe4d53eSThomas Hellstrom /*************************************************************************/
805cfe4d53eSThomas Hellstrom /**
806cfe4d53eSThomas Hellstrom  * DRM_VMW_CREATE_SHADER - Create shader
807cfe4d53eSThomas Hellstrom  *
808cfe4d53eSThomas Hellstrom  * Creates a shader and optionally binds it to a dma buffer containing
809cfe4d53eSThomas Hellstrom  * the shader byte-code.
810cfe4d53eSThomas Hellstrom  */
811cfe4d53eSThomas Hellstrom 
812cfe4d53eSThomas Hellstrom /**
813cfe4d53eSThomas Hellstrom  * enum drm_vmw_shader_type - Shader types
814cfe4d53eSThomas Hellstrom  */
815cfe4d53eSThomas Hellstrom enum drm_vmw_shader_type {
816cfe4d53eSThomas Hellstrom 	drm_vmw_shader_type_vs = 0,
817cfe4d53eSThomas Hellstrom 	drm_vmw_shader_type_ps,
818cfe4d53eSThomas Hellstrom 	drm_vmw_shader_type_gs
819cfe4d53eSThomas Hellstrom };
820cfe4d53eSThomas Hellstrom 
821cfe4d53eSThomas Hellstrom 
822cfe4d53eSThomas Hellstrom /**
823cfe4d53eSThomas Hellstrom  * struct drm_vmw_shader_create_arg
824cfe4d53eSThomas Hellstrom  *
825cfe4d53eSThomas Hellstrom  * @shader_type: Shader type of the shader to create.
826cfe4d53eSThomas Hellstrom  * @size: Size of the byte-code in bytes.
827cfe4d53eSThomas Hellstrom  * where the shader byte-code starts
828cfe4d53eSThomas Hellstrom  * @buffer_handle: Buffer handle identifying the buffer containing the
829cfe4d53eSThomas Hellstrom  * shader byte-code
830cfe4d53eSThomas Hellstrom  * @shader_handle: On successful completion contains a handle that
831cfe4d53eSThomas Hellstrom  * can be used to subsequently identify the shader.
832cfe4d53eSThomas Hellstrom  * @offset: Offset in bytes into the buffer given by @buffer_handle,
833cfe4d53eSThomas Hellstrom  *
834cfe4d53eSThomas Hellstrom  * Input / Output argument to the DRM_VMW_CREATE_SHADER Ioctl.
835cfe4d53eSThomas Hellstrom  */
836cfe4d53eSThomas Hellstrom struct drm_vmw_shader_create_arg {
837cfe4d53eSThomas Hellstrom 	enum drm_vmw_shader_type shader_type;
838cfe4d53eSThomas Hellstrom 	uint32_t size;
839cfe4d53eSThomas Hellstrom 	uint32_t buffer_handle;
840cfe4d53eSThomas Hellstrom 	uint32_t shader_handle;
841cfe4d53eSThomas Hellstrom 	uint64_t offset;
842cfe4d53eSThomas Hellstrom };
843cfe4d53eSThomas Hellstrom 
844cfe4d53eSThomas Hellstrom /*************************************************************************/
845cfe4d53eSThomas Hellstrom /**
846cfe4d53eSThomas Hellstrom  * DRM_VMW_UNREF_SHADER - Unreferences a shader
847cfe4d53eSThomas Hellstrom  *
848cfe4d53eSThomas Hellstrom  * Destroys a user-space reference to a shader, optionally destroying
849cfe4d53eSThomas Hellstrom  * it.
850cfe4d53eSThomas Hellstrom  */
851cfe4d53eSThomas Hellstrom 
852cfe4d53eSThomas Hellstrom /**
853cfe4d53eSThomas Hellstrom  * struct drm_vmw_shader_arg
854cfe4d53eSThomas Hellstrom  *
855cfe4d53eSThomas Hellstrom  * @handle: Handle identifying the shader to destroy.
856cfe4d53eSThomas Hellstrom  *
857cfe4d53eSThomas Hellstrom  * Input argument to the DRM_VMW_UNREF_SHADER ioctl.
858cfe4d53eSThomas Hellstrom  */
859cfe4d53eSThomas Hellstrom struct drm_vmw_shader_arg {
860cfe4d53eSThomas Hellstrom 	uint32_t handle;
861cfe4d53eSThomas Hellstrom 	uint32_t pad64;
862cfe4d53eSThomas Hellstrom };
863cfe4d53eSThomas Hellstrom 
864cfe4d53eSThomas Hellstrom /*************************************************************************/
865cfe4d53eSThomas Hellstrom /**
866cfe4d53eSThomas Hellstrom  * DRM_VMW_GB_SURFACE_CREATE - Create a host guest-backed surface.
867cfe4d53eSThomas Hellstrom  *
868cfe4d53eSThomas Hellstrom  * Allocates a surface handle and queues a create surface command
869cfe4d53eSThomas Hellstrom  * for the host on the first use of the surface. The surface ID can
870cfe4d53eSThomas Hellstrom  * be used as the surface ID in commands referencing the surface.
871cfe4d53eSThomas Hellstrom  */
872cfe4d53eSThomas Hellstrom 
873cfe4d53eSThomas Hellstrom /**
874cfe4d53eSThomas Hellstrom  * enum drm_vmw_surface_flags
875cfe4d53eSThomas Hellstrom  *
876cfe4d53eSThomas Hellstrom  * @drm_vmw_surface_flag_shareable:     Whether the surface is shareable
877cfe4d53eSThomas Hellstrom  * @drm_vmw_surface_flag_scanout:       Whether the surface is a scanout
878cfe4d53eSThomas Hellstrom  *                                      surface.
879cfe4d53eSThomas Hellstrom  * @drm_vmw_surface_flag_create_buffer: Create a backup buffer if none is
880cfe4d53eSThomas Hellstrom  *                                      given.
881cfe4d53eSThomas Hellstrom  */
882cfe4d53eSThomas Hellstrom enum drm_vmw_surface_flags {
883cfe4d53eSThomas Hellstrom 	drm_vmw_surface_flag_shareable = (1 << 0),
884cfe4d53eSThomas Hellstrom 	drm_vmw_surface_flag_scanout = (1 << 1),
885cfe4d53eSThomas Hellstrom 	drm_vmw_surface_flag_create_buffer = (1 << 2)
886cfe4d53eSThomas Hellstrom };
887cfe4d53eSThomas Hellstrom 
888cfe4d53eSThomas Hellstrom /**
889cfe4d53eSThomas Hellstrom  * struct drm_vmw_gb_surface_create_req
890cfe4d53eSThomas Hellstrom  *
891cfe4d53eSThomas Hellstrom  * @svga3d_flags:     SVGA3d surface flags for the device.
892cfe4d53eSThomas Hellstrom  * @format:           SVGA3d format.
893cfe4d53eSThomas Hellstrom  * @mip_level:        Number of mip levels for all faces.
894cfe4d53eSThomas Hellstrom  * @drm_surface_flags Flags as described above.
89515c6f656SZack Rusin  * @multisample_count Future use. Set to 0.
896cfe4d53eSThomas Hellstrom  * @autogen_filter    Future use. Set to 0.
897cfe4d53eSThomas Hellstrom  * @buffer_handle     Buffer handle of backup buffer. SVGA3D_INVALID_ID
898cfe4d53eSThomas Hellstrom  *                    if none.
899cfe4d53eSThomas Hellstrom  * @base_size         Size of the base mip level for all faces.
900cfe4d53eSThomas Hellstrom  *
901cfe4d53eSThomas Hellstrom  * Input argument to the  DRM_VMW_GB_SURFACE_CREATE Ioctl.
902cfe4d53eSThomas Hellstrom  * Part of output argument for the DRM_VMW_GB_SURFACE_REF Ioctl.
903cfe4d53eSThomas Hellstrom  */
904cfe4d53eSThomas Hellstrom struct drm_vmw_gb_surface_create_req {
905cfe4d53eSThomas Hellstrom 	uint32_t svga3d_flags;
906cfe4d53eSThomas Hellstrom 	uint32_t format;
907cfe4d53eSThomas Hellstrom 	uint32_t mip_levels;
908cfe4d53eSThomas Hellstrom 	enum drm_vmw_surface_flags drm_surface_flags;
909cfe4d53eSThomas Hellstrom 	uint32_t multisample_count;
910cfe4d53eSThomas Hellstrom 	uint32_t autogen_filter;
911cfe4d53eSThomas Hellstrom 	uint32_t buffer_handle;
912cfe4d53eSThomas Hellstrom 	uint32_t pad64;
913cfe4d53eSThomas Hellstrom 	struct drm_vmw_size base_size;
914cfe4d53eSThomas Hellstrom };
915cfe4d53eSThomas Hellstrom 
916cfe4d53eSThomas Hellstrom /**
917cfe4d53eSThomas Hellstrom  * struct drm_vmw_gb_surface_create_rep
918cfe4d53eSThomas Hellstrom  *
919cfe4d53eSThomas Hellstrom  * @handle:            Surface handle.
920cfe4d53eSThomas Hellstrom  * @backup_size:       Size of backup buffers for this surface.
921cfe4d53eSThomas Hellstrom  * @buffer_handle:     Handle of backup buffer. SVGA3D_INVALID_ID if none.
922cfe4d53eSThomas Hellstrom  * @buffer_size:       Actual size of the buffer identified by
923cfe4d53eSThomas Hellstrom  *                     @buffer_handle
924cfe4d53eSThomas Hellstrom  * @buffer_map_handle: Offset into device address space for the buffer
925cfe4d53eSThomas Hellstrom  *                     identified by @buffer_handle.
926cfe4d53eSThomas Hellstrom  *
927cfe4d53eSThomas Hellstrom  * Part of output argument for the DRM_VMW_GB_SURFACE_REF ioctl.
928cfe4d53eSThomas Hellstrom  * Output argument for the DRM_VMW_GB_SURFACE_CREATE ioctl.
929cfe4d53eSThomas Hellstrom  */
930cfe4d53eSThomas Hellstrom struct drm_vmw_gb_surface_create_rep {
931cfe4d53eSThomas Hellstrom 	uint32_t handle;
932cfe4d53eSThomas Hellstrom 	uint32_t backup_size;
933cfe4d53eSThomas Hellstrom 	uint32_t buffer_handle;
934cfe4d53eSThomas Hellstrom 	uint32_t buffer_size;
935cfe4d53eSThomas Hellstrom 	uint64_t buffer_map_handle;
936cfe4d53eSThomas Hellstrom };
937cfe4d53eSThomas Hellstrom 
938cfe4d53eSThomas Hellstrom /**
939cfe4d53eSThomas Hellstrom  * union drm_vmw_gb_surface_create_arg
940cfe4d53eSThomas Hellstrom  *
941cfe4d53eSThomas Hellstrom  * @req: Input argument as described above.
942cfe4d53eSThomas Hellstrom  * @rep: Output argument as described above.
943cfe4d53eSThomas Hellstrom  *
944cfe4d53eSThomas Hellstrom  * Argument to the DRM_VMW_GB_SURFACE_CREATE ioctl.
945cfe4d53eSThomas Hellstrom  */
946cfe4d53eSThomas Hellstrom union drm_vmw_gb_surface_create_arg {
947cfe4d53eSThomas Hellstrom 	struct drm_vmw_gb_surface_create_rep rep;
948cfe4d53eSThomas Hellstrom 	struct drm_vmw_gb_surface_create_req req;
949cfe4d53eSThomas Hellstrom };
950cfe4d53eSThomas Hellstrom 
951cfe4d53eSThomas Hellstrom /*************************************************************************/
952cfe4d53eSThomas Hellstrom /**
953cfe4d53eSThomas Hellstrom  * DRM_VMW_GB_SURFACE_REF - Reference a host surface.
954cfe4d53eSThomas Hellstrom  *
955cfe4d53eSThomas Hellstrom  * Puts a reference on a host surface with a given handle, as previously
956cfe4d53eSThomas Hellstrom  * returned by the DRM_VMW_GB_SURFACE_CREATE ioctl.
957cfe4d53eSThomas Hellstrom  * A reference will make sure the surface isn't destroyed while we hold
958cfe4d53eSThomas Hellstrom  * it and will allow the calling client to use the surface handle in
959cfe4d53eSThomas Hellstrom  * the command stream.
960cfe4d53eSThomas Hellstrom  *
961cfe4d53eSThomas Hellstrom  * On successful return, the Ioctl returns the surface information given
962cfe4d53eSThomas Hellstrom  * to and returned from the DRM_VMW_GB_SURFACE_CREATE ioctl.
963cfe4d53eSThomas Hellstrom  */
964cfe4d53eSThomas Hellstrom 
965cfe4d53eSThomas Hellstrom /**
966cfe4d53eSThomas Hellstrom  * struct drm_vmw_gb_surface_reference_arg
967cfe4d53eSThomas Hellstrom  *
968cfe4d53eSThomas Hellstrom  * @creq: The data used as input when the surface was created, as described
969cfe4d53eSThomas Hellstrom  *        above at "struct drm_vmw_gb_surface_create_req"
970cfe4d53eSThomas Hellstrom  * @crep: Additional data output when the surface was created, as described
971cfe4d53eSThomas Hellstrom  *        above at "struct drm_vmw_gb_surface_create_rep"
972cfe4d53eSThomas Hellstrom  *
973cfe4d53eSThomas Hellstrom  * Output Argument to the DRM_VMW_GB_SURFACE_REF ioctl.
974cfe4d53eSThomas Hellstrom  */
975cfe4d53eSThomas Hellstrom struct drm_vmw_gb_surface_ref_rep {
976cfe4d53eSThomas Hellstrom 	struct drm_vmw_gb_surface_create_req creq;
977cfe4d53eSThomas Hellstrom 	struct drm_vmw_gb_surface_create_rep crep;
978cfe4d53eSThomas Hellstrom };
979cfe4d53eSThomas Hellstrom 
980cfe4d53eSThomas Hellstrom /**
981cfe4d53eSThomas Hellstrom  * union drm_vmw_gb_surface_reference_arg
982cfe4d53eSThomas Hellstrom  *
983cfe4d53eSThomas Hellstrom  * @req: Input data as described above at "struct drm_vmw_surface_arg"
984cfe4d53eSThomas Hellstrom  * @rep: Output data as described above at "struct drm_vmw_gb_surface_ref_rep"
985cfe4d53eSThomas Hellstrom  *
986cfe4d53eSThomas Hellstrom  * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl.
987cfe4d53eSThomas Hellstrom  */
988cfe4d53eSThomas Hellstrom union drm_vmw_gb_surface_reference_arg {
989cfe4d53eSThomas Hellstrom 	struct drm_vmw_gb_surface_ref_rep rep;
990cfe4d53eSThomas Hellstrom 	struct drm_vmw_surface_arg req;
991cfe4d53eSThomas Hellstrom };
992cfe4d53eSThomas Hellstrom 
993cfe4d53eSThomas Hellstrom 
9941d7a5cbfSThomas Hellstrom /*************************************************************************/
9951d7a5cbfSThomas Hellstrom /**
9961d7a5cbfSThomas Hellstrom  * DRM_VMW_SYNCCPU - Sync a DMA buffer / MOB for CPU access.
9971d7a5cbfSThomas Hellstrom  *
9981d7a5cbfSThomas Hellstrom  * Idles any previously submitted GPU operations on the buffer and
9991d7a5cbfSThomas Hellstrom  * by default blocks command submissions that reference the buffer.
10001d7a5cbfSThomas Hellstrom  * If the file descriptor used to grab a blocking CPU sync is closed, the
10011d7a5cbfSThomas Hellstrom  * cpu sync is released.
10021d7a5cbfSThomas Hellstrom  * The flags argument indicates how the grab / release operation should be
10031d7a5cbfSThomas Hellstrom  * performed:
10041d7a5cbfSThomas Hellstrom  */
10051d7a5cbfSThomas Hellstrom 
10061d7a5cbfSThomas Hellstrom /**
10071d7a5cbfSThomas Hellstrom  * enum drm_vmw_synccpu_flags - Synccpu flags:
10081d7a5cbfSThomas Hellstrom  *
10091d7a5cbfSThomas Hellstrom  * @drm_vmw_synccpu_read: Sync for read. If sync is done for read only, it's a
10101d7a5cbfSThomas Hellstrom  * hint to the kernel to allow command submissions that references the buffer
10111d7a5cbfSThomas Hellstrom  * for read-only.
10121d7a5cbfSThomas Hellstrom  * @drm_vmw_synccpu_write: Sync for write. Block all command submissions
10131d7a5cbfSThomas Hellstrom  * referencing this buffer.
10141d7a5cbfSThomas Hellstrom  * @drm_vmw_synccpu_dontblock: Dont wait for GPU idle, but rather return
10151d7a5cbfSThomas Hellstrom  * -EBUSY should the buffer be busy.
10161d7a5cbfSThomas Hellstrom  * @drm_vmw_synccpu_allow_cs: Allow command submission that touches the buffer
10171d7a5cbfSThomas Hellstrom  * while the buffer is synced for CPU. This is similar to the GEM bo idle
10181d7a5cbfSThomas Hellstrom  * behavior.
10191d7a5cbfSThomas Hellstrom  */
10201d7a5cbfSThomas Hellstrom enum drm_vmw_synccpu_flags {
10211d7a5cbfSThomas Hellstrom 	drm_vmw_synccpu_read = (1 << 0),
10221d7a5cbfSThomas Hellstrom 	drm_vmw_synccpu_write = (1 << 1),
10231d7a5cbfSThomas Hellstrom 	drm_vmw_synccpu_dontblock = (1 << 2),
10241d7a5cbfSThomas Hellstrom 	drm_vmw_synccpu_allow_cs = (1 << 3)
10251d7a5cbfSThomas Hellstrom };
10261d7a5cbfSThomas Hellstrom 
10271d7a5cbfSThomas Hellstrom /**
10281d7a5cbfSThomas Hellstrom  * enum drm_vmw_synccpu_op - Synccpu operations:
10291d7a5cbfSThomas Hellstrom  *
10301d7a5cbfSThomas Hellstrom  * @drm_vmw_synccpu_grab:    Grab the buffer for CPU operations
10311d7a5cbfSThomas Hellstrom  * @drm_vmw_synccpu_release: Release a previous grab.
10321d7a5cbfSThomas Hellstrom  */
10331d7a5cbfSThomas Hellstrom enum drm_vmw_synccpu_op {
10341d7a5cbfSThomas Hellstrom 	drm_vmw_synccpu_grab,
10351d7a5cbfSThomas Hellstrom 	drm_vmw_synccpu_release
10361d7a5cbfSThomas Hellstrom };
10371d7a5cbfSThomas Hellstrom 
10381d7a5cbfSThomas Hellstrom /**
10391d7a5cbfSThomas Hellstrom  * struct drm_vmw_synccpu_arg
10401d7a5cbfSThomas Hellstrom  *
10411d7a5cbfSThomas Hellstrom  * @op:			     The synccpu operation as described above.
10421d7a5cbfSThomas Hellstrom  * @handle:		     Handle identifying the buffer object.
10431d7a5cbfSThomas Hellstrom  * @flags:		     Flags as described above.
10441d7a5cbfSThomas Hellstrom  */
10451d7a5cbfSThomas Hellstrom struct drm_vmw_synccpu_arg {
10461d7a5cbfSThomas Hellstrom 	enum drm_vmw_synccpu_op op;
10471d7a5cbfSThomas Hellstrom 	enum drm_vmw_synccpu_flags flags;
10481d7a5cbfSThomas Hellstrom 	uint32_t handle;
10491d7a5cbfSThomas Hellstrom 	uint32_t pad64;
10501d7a5cbfSThomas Hellstrom };
1051cfe4d53eSThomas Hellstrom 
1052718dceddSDavid Howells #endif
1053