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