1bf215546Sopenharmony_ci/**************************************************************************
2bf215546Sopenharmony_ci *
3bf215546Sopenharmony_ci * Copyright © 2009-2022 VMware, Inc., Palo Alto, CA., USA
4bf215546Sopenharmony_ci * All Rights Reserved.
5bf215546Sopenharmony_ci *
6bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
7bf215546Sopenharmony_ci * copy of this software and associated documentation files (the
8bf215546Sopenharmony_ci * "Software"), to deal in the Software without restriction, including
9bf215546Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish,
10bf215546Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to
11bf215546Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to
12bf215546Sopenharmony_ci * the following conditions:
13bf215546Sopenharmony_ci *
14bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the
15bf215546Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions
16bf215546Sopenharmony_ci * of the Software.
17bf215546Sopenharmony_ci *
18bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21bf215546Sopenharmony_ci * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22bf215546Sopenharmony_ci * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23bf215546Sopenharmony_ci * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24bf215546Sopenharmony_ci * USE OR OTHER DEALINGS IN THE SOFTWARE.
25bf215546Sopenharmony_ci *
26bf215546Sopenharmony_ci **************************************************************************/
27bf215546Sopenharmony_ci
28bf215546Sopenharmony_ci#ifndef __VMWGFX_DRM_H__
29bf215546Sopenharmony_ci#define __VMWGFX_DRM_H__
30bf215546Sopenharmony_ci
31bf215546Sopenharmony_ci#include "drm.h"
32bf215546Sopenharmony_ci
33bf215546Sopenharmony_ci#if defined(__cplusplus)
34bf215546Sopenharmony_ciextern "C" {
35bf215546Sopenharmony_ci#endif
36bf215546Sopenharmony_ci
37bf215546Sopenharmony_ci#define DRM_VMW_MAX_SURFACE_FACES 6
38bf215546Sopenharmony_ci#define DRM_VMW_MAX_MIP_LEVELS 24
39bf215546Sopenharmony_ci
40bf215546Sopenharmony_ci
41bf215546Sopenharmony_ci#define DRM_VMW_GET_PARAM            0
42bf215546Sopenharmony_ci#define DRM_VMW_ALLOC_DMABUF         1
43bf215546Sopenharmony_ci#define DRM_VMW_ALLOC_BO             1
44bf215546Sopenharmony_ci#define DRM_VMW_UNREF_DMABUF         2
45bf215546Sopenharmony_ci#define DRM_VMW_HANDLE_CLOSE         2
46bf215546Sopenharmony_ci#define DRM_VMW_CURSOR_BYPASS        3
47bf215546Sopenharmony_ci/* guarded by DRM_VMW_PARAM_NUM_STREAMS != 0*/
48bf215546Sopenharmony_ci#define DRM_VMW_CONTROL_STREAM       4
49bf215546Sopenharmony_ci#define DRM_VMW_CLAIM_STREAM         5
50bf215546Sopenharmony_ci#define DRM_VMW_UNREF_STREAM         6
51bf215546Sopenharmony_ci/* guarded by DRM_VMW_PARAM_3D == 1 */
52bf215546Sopenharmony_ci#define DRM_VMW_CREATE_CONTEXT       7
53bf215546Sopenharmony_ci#define DRM_VMW_UNREF_CONTEXT        8
54bf215546Sopenharmony_ci#define DRM_VMW_CREATE_SURFACE       9
55bf215546Sopenharmony_ci#define DRM_VMW_UNREF_SURFACE        10
56bf215546Sopenharmony_ci#define DRM_VMW_REF_SURFACE          11
57bf215546Sopenharmony_ci#define DRM_VMW_EXECBUF              12
58bf215546Sopenharmony_ci#define DRM_VMW_GET_3D_CAP           13
59bf215546Sopenharmony_ci#define DRM_VMW_FENCE_WAIT           14
60bf215546Sopenharmony_ci#define DRM_VMW_FENCE_SIGNALED       15
61bf215546Sopenharmony_ci#define DRM_VMW_FENCE_UNREF          16
62bf215546Sopenharmony_ci#define DRM_VMW_FENCE_EVENT          17
63bf215546Sopenharmony_ci#define DRM_VMW_PRESENT              18
64bf215546Sopenharmony_ci#define DRM_VMW_PRESENT_READBACK     19
65bf215546Sopenharmony_ci#define DRM_VMW_UPDATE_LAYOUT        20
66bf215546Sopenharmony_ci#define DRM_VMW_CREATE_SHADER        21
67bf215546Sopenharmony_ci#define DRM_VMW_UNREF_SHADER         22
68bf215546Sopenharmony_ci#define DRM_VMW_GB_SURFACE_CREATE    23
69bf215546Sopenharmony_ci#define DRM_VMW_GB_SURFACE_REF       24
70bf215546Sopenharmony_ci#define DRM_VMW_SYNCCPU              25
71bf215546Sopenharmony_ci#define DRM_VMW_CREATE_EXTENDED_CONTEXT 26
72bf215546Sopenharmony_ci#define DRM_VMW_GB_SURFACE_CREATE_EXT   27
73bf215546Sopenharmony_ci#define DRM_VMW_GB_SURFACE_REF_EXT      28
74bf215546Sopenharmony_ci#define DRM_VMW_MSG                     29
75bf215546Sopenharmony_ci#define DRM_VMW_MKSSTAT_RESET           30
76bf215546Sopenharmony_ci#define DRM_VMW_MKSSTAT_ADD             31
77bf215546Sopenharmony_ci#define DRM_VMW_MKSSTAT_REMOVE          32
78bf215546Sopenharmony_ci
79bf215546Sopenharmony_ci/*************************************************************************/
80bf215546Sopenharmony_ci/**
81bf215546Sopenharmony_ci * DRM_VMW_GET_PARAM - get device information.
82bf215546Sopenharmony_ci *
83bf215546Sopenharmony_ci * DRM_VMW_PARAM_FIFO_OFFSET:
84bf215546Sopenharmony_ci * Offset to use to map the first page of the FIFO read-only.
85bf215546Sopenharmony_ci * The fifo is mapped using the mmap() system call on the drm device.
86bf215546Sopenharmony_ci *
87bf215546Sopenharmony_ci * DRM_VMW_PARAM_OVERLAY_IOCTL:
88bf215546Sopenharmony_ci * Does the driver support the overlay ioctl.
89bf215546Sopenharmony_ci *
90bf215546Sopenharmony_ci * DRM_VMW_PARAM_SM4_1
91bf215546Sopenharmony_ci * SM4_1 support is enabled.
92bf215546Sopenharmony_ci *
93bf215546Sopenharmony_ci * DRM_VMW_PARAM_SM5
94bf215546Sopenharmony_ci * SM5 support is enabled.
95bf215546Sopenharmony_ci *
96bf215546Sopenharmony_ci * DRM_VMW_PARAM_GL43
97bf215546Sopenharmony_ci * SM5.1+GL4.3 support is enabled.
98bf215546Sopenharmony_ci *
99bf215546Sopenharmony_ci * DRM_VMW_PARAM_DEVICE_ID
100bf215546Sopenharmony_ci * PCI ID of the underlying SVGA device.
101bf215546Sopenharmony_ci */
102bf215546Sopenharmony_ci
103bf215546Sopenharmony_ci#define DRM_VMW_PARAM_NUM_STREAMS      0
104bf215546Sopenharmony_ci#define DRM_VMW_PARAM_NUM_FREE_STREAMS 1
105bf215546Sopenharmony_ci#define DRM_VMW_PARAM_3D               2
106bf215546Sopenharmony_ci#define DRM_VMW_PARAM_HW_CAPS          3
107bf215546Sopenharmony_ci#define DRM_VMW_PARAM_FIFO_CAPS        4
108bf215546Sopenharmony_ci#define DRM_VMW_PARAM_MAX_FB_SIZE      5
109bf215546Sopenharmony_ci#define DRM_VMW_PARAM_FIFO_HW_VERSION  6
110bf215546Sopenharmony_ci#define DRM_VMW_PARAM_MAX_SURF_MEMORY  7
111bf215546Sopenharmony_ci#define DRM_VMW_PARAM_3D_CAPS_SIZE     8
112bf215546Sopenharmony_ci#define DRM_VMW_PARAM_MAX_MOB_MEMORY   9
113bf215546Sopenharmony_ci#define DRM_VMW_PARAM_MAX_MOB_SIZE     10
114bf215546Sopenharmony_ci#define DRM_VMW_PARAM_SCREEN_TARGET    11
115bf215546Sopenharmony_ci#define DRM_VMW_PARAM_DX               12
116bf215546Sopenharmony_ci#define DRM_VMW_PARAM_HW_CAPS2         13
117bf215546Sopenharmony_ci#define DRM_VMW_PARAM_SM4_1            14
118bf215546Sopenharmony_ci#define DRM_VMW_PARAM_SM5              15
119bf215546Sopenharmony_ci#define DRM_VMW_PARAM_GL43             16
120bf215546Sopenharmony_ci#define DRM_VMW_PARAM_DEVICE_ID        17
121bf215546Sopenharmony_ci
122bf215546Sopenharmony_ci/**
123bf215546Sopenharmony_ci * enum drm_vmw_handle_type - handle type for ref ioctls
124bf215546Sopenharmony_ci *
125bf215546Sopenharmony_ci */
126bf215546Sopenharmony_cienum drm_vmw_handle_type {
127bf215546Sopenharmony_ci	DRM_VMW_HANDLE_LEGACY = 0,
128bf215546Sopenharmony_ci	DRM_VMW_HANDLE_PRIME = 1
129bf215546Sopenharmony_ci};
130bf215546Sopenharmony_ci
131bf215546Sopenharmony_ci/**
132bf215546Sopenharmony_ci * struct drm_vmw_getparam_arg
133bf215546Sopenharmony_ci *
134bf215546Sopenharmony_ci * @value: Returned value. //Out
135bf215546Sopenharmony_ci * @param: Parameter to query. //In.
136bf215546Sopenharmony_ci *
137bf215546Sopenharmony_ci * Argument to the DRM_VMW_GET_PARAM Ioctl.
138bf215546Sopenharmony_ci */
139bf215546Sopenharmony_ci
140bf215546Sopenharmony_cistruct drm_vmw_getparam_arg {
141bf215546Sopenharmony_ci	__u64 value;
142bf215546Sopenharmony_ci	__u32 param;
143bf215546Sopenharmony_ci	__u32 pad64;
144bf215546Sopenharmony_ci};
145bf215546Sopenharmony_ci
146bf215546Sopenharmony_ci/*************************************************************************/
147bf215546Sopenharmony_ci/**
148bf215546Sopenharmony_ci * DRM_VMW_CREATE_CONTEXT - Create a host context.
149bf215546Sopenharmony_ci *
150bf215546Sopenharmony_ci * Allocates a device unique context id, and queues a create context command
151bf215546Sopenharmony_ci * for the host. Does not wait for host completion.
152bf215546Sopenharmony_ci */
153bf215546Sopenharmony_ci
154bf215546Sopenharmony_ci/**
155bf215546Sopenharmony_ci * struct drm_vmw_context_arg
156bf215546Sopenharmony_ci *
157bf215546Sopenharmony_ci * @cid: Device unique context ID.
158bf215546Sopenharmony_ci *
159bf215546Sopenharmony_ci * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
160bf215546Sopenharmony_ci * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
161bf215546Sopenharmony_ci */
162bf215546Sopenharmony_ci
163bf215546Sopenharmony_cistruct drm_vmw_context_arg {
164bf215546Sopenharmony_ci	__s32 cid;
165bf215546Sopenharmony_ci	__u32 pad64;
166bf215546Sopenharmony_ci};
167bf215546Sopenharmony_ci
168bf215546Sopenharmony_ci/*************************************************************************/
169bf215546Sopenharmony_ci/**
170bf215546Sopenharmony_ci * DRM_VMW_UNREF_CONTEXT - Create a host context.
171bf215546Sopenharmony_ci *
172bf215546Sopenharmony_ci * Frees a global context id, and queues a destroy host command for the host.
173bf215546Sopenharmony_ci * Does not wait for host completion. The context ID can be used directly
174bf215546Sopenharmony_ci * in the command stream and shows up as the same context ID on the host.
175bf215546Sopenharmony_ci */
176bf215546Sopenharmony_ci
177bf215546Sopenharmony_ci/*************************************************************************/
178bf215546Sopenharmony_ci/**
179bf215546Sopenharmony_ci * DRM_VMW_CREATE_SURFACE - Create a host suface.
180bf215546Sopenharmony_ci *
181bf215546Sopenharmony_ci * Allocates a device unique surface id, and queues a create surface command
182bf215546Sopenharmony_ci * for the host. Does not wait for host completion. The surface ID can be
183bf215546Sopenharmony_ci * used directly in the command stream and shows up as the same surface
184bf215546Sopenharmony_ci * ID on the host.
185bf215546Sopenharmony_ci */
186bf215546Sopenharmony_ci
187bf215546Sopenharmony_ci/**
188bf215546Sopenharmony_ci * struct drm_wmv_surface_create_req
189bf215546Sopenharmony_ci *
190bf215546Sopenharmony_ci * @flags: Surface flags as understood by the host.
191bf215546Sopenharmony_ci * @format: Surface format as understood by the host.
192bf215546Sopenharmony_ci * @mip_levels: Number of mip levels for each face.
193bf215546Sopenharmony_ci * An unused face should have 0 encoded.
194bf215546Sopenharmony_ci * @size_addr: Address of a user-space array of sruct drm_vmw_size
195bf215546Sopenharmony_ci * cast to an __u64 for 32-64 bit compatibility.
196bf215546Sopenharmony_ci * The size of the array should equal the total number of mipmap levels.
197bf215546Sopenharmony_ci * @shareable: Boolean whether other clients (as identified by file descriptors)
198bf215546Sopenharmony_ci * may reference this surface.
199bf215546Sopenharmony_ci * @scanout: Boolean whether the surface is intended to be used as a
200bf215546Sopenharmony_ci * scanout.
201bf215546Sopenharmony_ci *
202bf215546Sopenharmony_ci * Input data to the DRM_VMW_CREATE_SURFACE Ioctl.
203bf215546Sopenharmony_ci * Output data from the DRM_VMW_REF_SURFACE Ioctl.
204bf215546Sopenharmony_ci */
205bf215546Sopenharmony_ci
206bf215546Sopenharmony_cistruct drm_vmw_surface_create_req {
207bf215546Sopenharmony_ci	__u32 flags;
208bf215546Sopenharmony_ci	__u32 format;
209bf215546Sopenharmony_ci	__u32 mip_levels[DRM_VMW_MAX_SURFACE_FACES];
210bf215546Sopenharmony_ci	__u64 size_addr;
211bf215546Sopenharmony_ci	__s32 shareable;
212bf215546Sopenharmony_ci	__s32 scanout;
213bf215546Sopenharmony_ci};
214bf215546Sopenharmony_ci
215bf215546Sopenharmony_ci/**
216bf215546Sopenharmony_ci * struct drm_wmv_surface_arg
217bf215546Sopenharmony_ci *
218bf215546Sopenharmony_ci * @sid: Surface id of created surface or surface to destroy or reference.
219bf215546Sopenharmony_ci * @handle_type: Handle type for DRM_VMW_REF_SURFACE Ioctl.
220bf215546Sopenharmony_ci *
221bf215546Sopenharmony_ci * Output data from the DRM_VMW_CREATE_SURFACE Ioctl.
222bf215546Sopenharmony_ci * Input argument to the DRM_VMW_UNREF_SURFACE Ioctl.
223bf215546Sopenharmony_ci * Input argument to the DRM_VMW_REF_SURFACE Ioctl.
224bf215546Sopenharmony_ci */
225bf215546Sopenharmony_ci
226bf215546Sopenharmony_cistruct drm_vmw_surface_arg {
227bf215546Sopenharmony_ci	__s32 sid;
228bf215546Sopenharmony_ci	enum drm_vmw_handle_type handle_type;
229bf215546Sopenharmony_ci};
230bf215546Sopenharmony_ci
231bf215546Sopenharmony_ci/**
232bf215546Sopenharmony_ci * struct drm_vmw_size ioctl.
233bf215546Sopenharmony_ci *
234bf215546Sopenharmony_ci * @width - mip level width
235bf215546Sopenharmony_ci * @height - mip level height
236bf215546Sopenharmony_ci * @depth - mip level depth
237bf215546Sopenharmony_ci *
238bf215546Sopenharmony_ci * Description of a mip level.
239bf215546Sopenharmony_ci * Input data to the DRM_WMW_CREATE_SURFACE Ioctl.
240bf215546Sopenharmony_ci */
241bf215546Sopenharmony_ci
242bf215546Sopenharmony_cistruct drm_vmw_size {
243bf215546Sopenharmony_ci	__u32 width;
244bf215546Sopenharmony_ci	__u32 height;
245bf215546Sopenharmony_ci	__u32 depth;
246bf215546Sopenharmony_ci	__u32 pad64;
247bf215546Sopenharmony_ci};
248bf215546Sopenharmony_ci
249bf215546Sopenharmony_ci/**
250bf215546Sopenharmony_ci * union drm_vmw_surface_create_arg
251bf215546Sopenharmony_ci *
252bf215546Sopenharmony_ci * @rep: Output data as described above.
253bf215546Sopenharmony_ci * @req: Input data as described above.
254bf215546Sopenharmony_ci *
255bf215546Sopenharmony_ci * Argument to the DRM_VMW_CREATE_SURFACE Ioctl.
256bf215546Sopenharmony_ci */
257bf215546Sopenharmony_ci
258bf215546Sopenharmony_ciunion drm_vmw_surface_create_arg {
259bf215546Sopenharmony_ci	struct drm_vmw_surface_arg rep;
260bf215546Sopenharmony_ci	struct drm_vmw_surface_create_req req;
261bf215546Sopenharmony_ci};
262bf215546Sopenharmony_ci
263bf215546Sopenharmony_ci/*************************************************************************/
264bf215546Sopenharmony_ci/**
265bf215546Sopenharmony_ci * DRM_VMW_REF_SURFACE - Reference a host surface.
266bf215546Sopenharmony_ci *
267bf215546Sopenharmony_ci * Puts a reference on a host surface with a give sid, as previously
268bf215546Sopenharmony_ci * returned by the DRM_VMW_CREATE_SURFACE ioctl.
269bf215546Sopenharmony_ci * A reference will make sure the surface isn't destroyed while we hold
270bf215546Sopenharmony_ci * it and will allow the calling client to use the surface ID in the command
271bf215546Sopenharmony_ci * stream.
272bf215546Sopenharmony_ci *
273bf215546Sopenharmony_ci * On successful return, the Ioctl returns the surface information given
274bf215546Sopenharmony_ci * in the DRM_VMW_CREATE_SURFACE ioctl.
275bf215546Sopenharmony_ci */
276bf215546Sopenharmony_ci
277bf215546Sopenharmony_ci/**
278bf215546Sopenharmony_ci * union drm_vmw_surface_reference_arg
279bf215546Sopenharmony_ci *
280bf215546Sopenharmony_ci * @rep: Output data as described above.
281bf215546Sopenharmony_ci * @req: Input data as described above.
282bf215546Sopenharmony_ci *
283bf215546Sopenharmony_ci * Argument to the DRM_VMW_REF_SURFACE Ioctl.
284bf215546Sopenharmony_ci */
285bf215546Sopenharmony_ci
286bf215546Sopenharmony_ciunion drm_vmw_surface_reference_arg {
287bf215546Sopenharmony_ci	struct drm_vmw_surface_create_req rep;
288bf215546Sopenharmony_ci	struct drm_vmw_surface_arg req;
289bf215546Sopenharmony_ci};
290bf215546Sopenharmony_ci
291bf215546Sopenharmony_ci/*************************************************************************/
292bf215546Sopenharmony_ci/**
293bf215546Sopenharmony_ci * DRM_VMW_UNREF_SURFACE - Unreference a host surface.
294bf215546Sopenharmony_ci *
295bf215546Sopenharmony_ci * Clear a reference previously put on a host surface.
296bf215546Sopenharmony_ci * When all references are gone, including the one implicitly placed
297bf215546Sopenharmony_ci * on creation,
298bf215546Sopenharmony_ci * a destroy surface command will be queued for the host.
299bf215546Sopenharmony_ci * Does not wait for completion.
300bf215546Sopenharmony_ci */
301bf215546Sopenharmony_ci
302bf215546Sopenharmony_ci/*************************************************************************/
303bf215546Sopenharmony_ci/**
304bf215546Sopenharmony_ci * DRM_VMW_EXECBUF
305bf215546Sopenharmony_ci *
306bf215546Sopenharmony_ci * Submit a command buffer for execution on the host, and return a
307bf215546Sopenharmony_ci * fence seqno that when signaled, indicates that the command buffer has
308bf215546Sopenharmony_ci * executed.
309bf215546Sopenharmony_ci */
310bf215546Sopenharmony_ci
311bf215546Sopenharmony_ci/**
312bf215546Sopenharmony_ci * struct drm_vmw_execbuf_arg
313bf215546Sopenharmony_ci *
314bf215546Sopenharmony_ci * @commands: User-space address of a command buffer cast to an __u64.
315bf215546Sopenharmony_ci * @command-size: Size in bytes of the command buffer.
316bf215546Sopenharmony_ci * @throttle-us: Sleep until software is less than @throttle_us
317bf215546Sopenharmony_ci * microseconds ahead of hardware. The driver may round this value
318bf215546Sopenharmony_ci * to the nearest kernel tick.
319bf215546Sopenharmony_ci * @fence_rep: User-space address of a struct drm_vmw_fence_rep cast to an
320bf215546Sopenharmony_ci * __u64.
321bf215546Sopenharmony_ci * @version: Allows expanding the execbuf ioctl parameters without breaking
322bf215546Sopenharmony_ci * backwards compatibility, since user-space will always tell the kernel
323bf215546Sopenharmony_ci * which version it uses.
324bf215546Sopenharmony_ci * @flags: Execbuf flags.
325bf215546Sopenharmony_ci * @imported_fence_fd:  FD for a fence imported from another device
326bf215546Sopenharmony_ci *
327bf215546Sopenharmony_ci * Argument to the DRM_VMW_EXECBUF Ioctl.
328bf215546Sopenharmony_ci */
329bf215546Sopenharmony_ci
330bf215546Sopenharmony_ci#define DRM_VMW_EXECBUF_VERSION 2
331bf215546Sopenharmony_ci
332bf215546Sopenharmony_ci#define DRM_VMW_EXECBUF_FLAG_IMPORT_FENCE_FD (1 << 0)
333bf215546Sopenharmony_ci#define DRM_VMW_EXECBUF_FLAG_EXPORT_FENCE_FD (1 << 1)
334bf215546Sopenharmony_ci
335bf215546Sopenharmony_cistruct drm_vmw_execbuf_arg {
336bf215546Sopenharmony_ci	__u64 commands;
337bf215546Sopenharmony_ci	__u32 command_size;
338bf215546Sopenharmony_ci	__u32 throttle_us;
339bf215546Sopenharmony_ci	__u64 fence_rep;
340bf215546Sopenharmony_ci	__u32 version;
341bf215546Sopenharmony_ci	__u32 flags;
342bf215546Sopenharmony_ci	__u32 context_handle;
343bf215546Sopenharmony_ci	__s32 imported_fence_fd;
344bf215546Sopenharmony_ci};
345bf215546Sopenharmony_ci
346bf215546Sopenharmony_ci/**
347bf215546Sopenharmony_ci * struct drm_vmw_fence_rep
348bf215546Sopenharmony_ci *
349bf215546Sopenharmony_ci * @handle: Fence object handle for fence associated with a command submission.
350bf215546Sopenharmony_ci * @mask: Fence flags relevant for this fence object.
351bf215546Sopenharmony_ci * @seqno: Fence sequence number in fifo. A fence object with a lower
352bf215546Sopenharmony_ci * seqno will signal the EXEC flag before a fence object with a higher
353bf215546Sopenharmony_ci * seqno. This can be used by user-space to avoid kernel calls to determine
354bf215546Sopenharmony_ci * whether a fence has signaled the EXEC flag. Note that @seqno will
355bf215546Sopenharmony_ci * wrap at 32-bit.
356bf215546Sopenharmony_ci * @passed_seqno: The highest seqno number processed by the hardware
357bf215546Sopenharmony_ci * so far. This can be used to mark user-space fence objects as signaled, and
358bf215546Sopenharmony_ci * to determine whether a fence seqno might be stale.
359bf215546Sopenharmony_ci * @fd: FD associated with the fence, -1 if not exported
360bf215546Sopenharmony_ci * @error: This member should've been set to -EFAULT on submission.
361bf215546Sopenharmony_ci * The following actions should be take on completion:
362bf215546Sopenharmony_ci * error == -EFAULT: Fence communication failed. The host is synchronized.
363bf215546Sopenharmony_ci * Use the last fence id read from the FIFO fence register.
364bf215546Sopenharmony_ci * error != 0 && error != -EFAULT:
365bf215546Sopenharmony_ci * Fence submission failed. The host is synchronized. Use the fence_seq member.
366bf215546Sopenharmony_ci * error == 0: All is OK, The host may not be synchronized.
367bf215546Sopenharmony_ci * Use the fence_seq member.
368bf215546Sopenharmony_ci *
369bf215546Sopenharmony_ci * Input / Output data to the DRM_VMW_EXECBUF Ioctl.
370bf215546Sopenharmony_ci */
371bf215546Sopenharmony_ci
372bf215546Sopenharmony_cistruct drm_vmw_fence_rep {
373bf215546Sopenharmony_ci	__u32 handle;
374bf215546Sopenharmony_ci	__u32 mask;
375bf215546Sopenharmony_ci	__u32 seqno;
376bf215546Sopenharmony_ci	__u32 passed_seqno;
377bf215546Sopenharmony_ci	__s32 fd;
378bf215546Sopenharmony_ci	__s32 error;
379bf215546Sopenharmony_ci};
380bf215546Sopenharmony_ci
381bf215546Sopenharmony_ci/*************************************************************************/
382bf215546Sopenharmony_ci/**
383bf215546Sopenharmony_ci * DRM_VMW_ALLOC_BO
384bf215546Sopenharmony_ci *
385bf215546Sopenharmony_ci * Allocate a buffer object that is visible also to the host.
386bf215546Sopenharmony_ci * NOTE: The buffer is
387bf215546Sopenharmony_ci * identified by a handle and an offset, which are private to the guest, but
388bf215546Sopenharmony_ci * useable in the command stream. The guest kernel may translate these
389bf215546Sopenharmony_ci * and patch up the command stream accordingly. In the future, the offset may
390bf215546Sopenharmony_ci * be zero at all times, or it may disappear from the interface before it is
391bf215546Sopenharmony_ci * fixed.
392bf215546Sopenharmony_ci *
393bf215546Sopenharmony_ci * The buffer object may stay user-space mapped in the guest at all times,
394bf215546Sopenharmony_ci * and is thus suitable for sub-allocation.
395bf215546Sopenharmony_ci *
396bf215546Sopenharmony_ci * Buffer objects are mapped using the mmap() syscall on the drm device.
397bf215546Sopenharmony_ci */
398bf215546Sopenharmony_ci
399bf215546Sopenharmony_ci/**
400bf215546Sopenharmony_ci * struct drm_vmw_alloc_bo_req
401bf215546Sopenharmony_ci *
402bf215546Sopenharmony_ci * @size: Required minimum size of the buffer.
403bf215546Sopenharmony_ci *
404bf215546Sopenharmony_ci * Input data to the DRM_VMW_ALLOC_BO Ioctl.
405bf215546Sopenharmony_ci */
406bf215546Sopenharmony_ci
407bf215546Sopenharmony_cistruct drm_vmw_alloc_bo_req {
408bf215546Sopenharmony_ci	__u32 size;
409bf215546Sopenharmony_ci	__u32 pad64;
410bf215546Sopenharmony_ci};
411bf215546Sopenharmony_ci#define drm_vmw_alloc_dmabuf_req drm_vmw_alloc_bo_req
412bf215546Sopenharmony_ci
413bf215546Sopenharmony_ci/**
414bf215546Sopenharmony_ci * struct drm_vmw_bo_rep
415bf215546Sopenharmony_ci *
416bf215546Sopenharmony_ci * @map_handle: Offset to use in the mmap() call used to map the buffer.
417bf215546Sopenharmony_ci * @handle: Handle unique to this buffer. Used for unreferencing.
418bf215546Sopenharmony_ci * @cur_gmr_id: GMR id to use in the command stream when this buffer is
419bf215546Sopenharmony_ci * referenced. See not above.
420bf215546Sopenharmony_ci * @cur_gmr_offset: Offset to use in the command stream when this buffer is
421bf215546Sopenharmony_ci * referenced. See note above.
422bf215546Sopenharmony_ci *
423bf215546Sopenharmony_ci * Output data from the DRM_VMW_ALLOC_BO Ioctl.
424bf215546Sopenharmony_ci */
425bf215546Sopenharmony_ci
426bf215546Sopenharmony_cistruct drm_vmw_bo_rep {
427bf215546Sopenharmony_ci	__u64 map_handle;
428bf215546Sopenharmony_ci	__u32 handle;
429bf215546Sopenharmony_ci	__u32 cur_gmr_id;
430bf215546Sopenharmony_ci	__u32 cur_gmr_offset;
431bf215546Sopenharmony_ci	__u32 pad64;
432bf215546Sopenharmony_ci};
433bf215546Sopenharmony_ci#define drm_vmw_dmabuf_rep drm_vmw_bo_rep
434bf215546Sopenharmony_ci
435bf215546Sopenharmony_ci/**
436bf215546Sopenharmony_ci * union drm_vmw_alloc_bo_arg
437bf215546Sopenharmony_ci *
438bf215546Sopenharmony_ci * @req: Input data as described above.
439bf215546Sopenharmony_ci * @rep: Output data as described above.
440bf215546Sopenharmony_ci *
441bf215546Sopenharmony_ci * Argument to the DRM_VMW_ALLOC_BO Ioctl.
442bf215546Sopenharmony_ci */
443bf215546Sopenharmony_ci
444bf215546Sopenharmony_ciunion drm_vmw_alloc_bo_arg {
445bf215546Sopenharmony_ci	struct drm_vmw_alloc_bo_req req;
446bf215546Sopenharmony_ci	struct drm_vmw_bo_rep rep;
447bf215546Sopenharmony_ci};
448bf215546Sopenharmony_ci#define drm_vmw_alloc_dmabuf_arg drm_vmw_alloc_bo_arg
449bf215546Sopenharmony_ci
450bf215546Sopenharmony_ci/*************************************************************************/
451bf215546Sopenharmony_ci/**
452bf215546Sopenharmony_ci * DRM_VMW_CONTROL_STREAM - Control overlays, aka streams.
453bf215546Sopenharmony_ci *
454bf215546Sopenharmony_ci * This IOCTL controls the overlay units of the svga device.
455bf215546Sopenharmony_ci * The SVGA overlay units does not work like regular hardware units in
456bf215546Sopenharmony_ci * that they do not automaticaly read back the contents of the given dma
457bf215546Sopenharmony_ci * buffer. But instead only read back for each call to this ioctl, and
458bf215546Sopenharmony_ci * at any point between this call being made and a following call that
459bf215546Sopenharmony_ci * either changes the buffer or disables the stream.
460bf215546Sopenharmony_ci */
461bf215546Sopenharmony_ci
462bf215546Sopenharmony_ci/**
463bf215546Sopenharmony_ci * struct drm_vmw_rect
464bf215546Sopenharmony_ci *
465bf215546Sopenharmony_ci * Defines a rectangle. Used in the overlay ioctl to define
466bf215546Sopenharmony_ci * source and destination rectangle.
467bf215546Sopenharmony_ci */
468bf215546Sopenharmony_ci
469bf215546Sopenharmony_cistruct drm_vmw_rect {
470bf215546Sopenharmony_ci	__s32 x;
471bf215546Sopenharmony_ci	__s32 y;
472bf215546Sopenharmony_ci	__u32 w;
473bf215546Sopenharmony_ci	__u32 h;
474bf215546Sopenharmony_ci};
475bf215546Sopenharmony_ci
476bf215546Sopenharmony_ci/**
477bf215546Sopenharmony_ci * struct drm_vmw_control_stream_arg
478bf215546Sopenharmony_ci *
479bf215546Sopenharmony_ci * @stream_id: Stearm to control
480bf215546Sopenharmony_ci * @enabled: If false all following arguments are ignored.
481bf215546Sopenharmony_ci * @handle: Handle to buffer for getting data from.
482bf215546Sopenharmony_ci * @format: Format of the overlay as understood by the host.
483bf215546Sopenharmony_ci * @width: Width of the overlay.
484bf215546Sopenharmony_ci * @height: Height of the overlay.
485bf215546Sopenharmony_ci * @size: Size of the overlay in bytes.
486bf215546Sopenharmony_ci * @pitch: Array of pitches, the two last are only used for YUV12 formats.
487bf215546Sopenharmony_ci * @offset: Offset from start of dma buffer to overlay.
488bf215546Sopenharmony_ci * @src: Source rect, must be within the defined area above.
489bf215546Sopenharmony_ci * @dst: Destination rect, x and y may be negative.
490bf215546Sopenharmony_ci *
491bf215546Sopenharmony_ci * Argument to the DRM_VMW_CONTROL_STREAM Ioctl.
492bf215546Sopenharmony_ci */
493bf215546Sopenharmony_ci
494bf215546Sopenharmony_cistruct drm_vmw_control_stream_arg {
495bf215546Sopenharmony_ci	__u32 stream_id;
496bf215546Sopenharmony_ci	__u32 enabled;
497bf215546Sopenharmony_ci
498bf215546Sopenharmony_ci	__u32 flags;
499bf215546Sopenharmony_ci	__u32 color_key;
500bf215546Sopenharmony_ci
501bf215546Sopenharmony_ci	__u32 handle;
502bf215546Sopenharmony_ci	__u32 offset;
503bf215546Sopenharmony_ci	__s32 format;
504bf215546Sopenharmony_ci	__u32 size;
505bf215546Sopenharmony_ci	__u32 width;
506bf215546Sopenharmony_ci	__u32 height;
507bf215546Sopenharmony_ci	__u32 pitch[3];
508bf215546Sopenharmony_ci
509bf215546Sopenharmony_ci	__u32 pad64;
510bf215546Sopenharmony_ci	struct drm_vmw_rect src;
511bf215546Sopenharmony_ci	struct drm_vmw_rect dst;
512bf215546Sopenharmony_ci};
513bf215546Sopenharmony_ci
514bf215546Sopenharmony_ci/*************************************************************************/
515bf215546Sopenharmony_ci/**
516bf215546Sopenharmony_ci * DRM_VMW_CURSOR_BYPASS - Give extra information about cursor bypass.
517bf215546Sopenharmony_ci *
518bf215546Sopenharmony_ci */
519bf215546Sopenharmony_ci
520bf215546Sopenharmony_ci#define DRM_VMW_CURSOR_BYPASS_ALL    (1 << 0)
521bf215546Sopenharmony_ci#define DRM_VMW_CURSOR_BYPASS_FLAGS       (1)
522bf215546Sopenharmony_ci
523bf215546Sopenharmony_ci/**
524bf215546Sopenharmony_ci * struct drm_vmw_cursor_bypass_arg
525bf215546Sopenharmony_ci *
526bf215546Sopenharmony_ci * @flags: Flags.
527bf215546Sopenharmony_ci * @crtc_id: Crtc id, only used if DMR_CURSOR_BYPASS_ALL isn't passed.
528bf215546Sopenharmony_ci * @xpos: X position of cursor.
529bf215546Sopenharmony_ci * @ypos: Y position of cursor.
530bf215546Sopenharmony_ci * @xhot: X hotspot.
531bf215546Sopenharmony_ci * @yhot: Y hotspot.
532bf215546Sopenharmony_ci *
533bf215546Sopenharmony_ci * Argument to the DRM_VMW_CURSOR_BYPASS Ioctl.
534bf215546Sopenharmony_ci */
535bf215546Sopenharmony_ci
536bf215546Sopenharmony_cistruct drm_vmw_cursor_bypass_arg {
537bf215546Sopenharmony_ci	__u32 flags;
538bf215546Sopenharmony_ci	__u32 crtc_id;
539bf215546Sopenharmony_ci	__s32 xpos;
540bf215546Sopenharmony_ci	__s32 ypos;
541bf215546Sopenharmony_ci	__s32 xhot;
542bf215546Sopenharmony_ci	__s32 yhot;
543bf215546Sopenharmony_ci};
544bf215546Sopenharmony_ci
545bf215546Sopenharmony_ci/*************************************************************************/
546bf215546Sopenharmony_ci/**
547bf215546Sopenharmony_ci * DRM_VMW_CLAIM_STREAM - Claim a single stream.
548bf215546Sopenharmony_ci */
549bf215546Sopenharmony_ci
550bf215546Sopenharmony_ci/**
551bf215546Sopenharmony_ci * struct drm_vmw_context_arg
552bf215546Sopenharmony_ci *
553bf215546Sopenharmony_ci * @stream_id: Device unique context ID.
554bf215546Sopenharmony_ci *
555bf215546Sopenharmony_ci * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
556bf215546Sopenharmony_ci * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
557bf215546Sopenharmony_ci */
558bf215546Sopenharmony_ci
559bf215546Sopenharmony_cistruct drm_vmw_stream_arg {
560bf215546Sopenharmony_ci	__u32 stream_id;
561bf215546Sopenharmony_ci	__u32 pad64;
562bf215546Sopenharmony_ci};
563bf215546Sopenharmony_ci
564bf215546Sopenharmony_ci/*************************************************************************/
565bf215546Sopenharmony_ci/**
566bf215546Sopenharmony_ci * DRM_VMW_UNREF_STREAM - Unclaim a stream.
567bf215546Sopenharmony_ci *
568bf215546Sopenharmony_ci * Return a single stream that was claimed by this process. Also makes
569bf215546Sopenharmony_ci * sure that the stream has been stopped.
570bf215546Sopenharmony_ci */
571bf215546Sopenharmony_ci
572bf215546Sopenharmony_ci/*************************************************************************/
573bf215546Sopenharmony_ci/**
574bf215546Sopenharmony_ci * DRM_VMW_GET_3D_CAP
575bf215546Sopenharmony_ci *
576bf215546Sopenharmony_ci * Read 3D capabilities from the FIFO
577bf215546Sopenharmony_ci *
578bf215546Sopenharmony_ci */
579bf215546Sopenharmony_ci
580bf215546Sopenharmony_ci/**
581bf215546Sopenharmony_ci * struct drm_vmw_get_3d_cap_arg
582bf215546Sopenharmony_ci *
583bf215546Sopenharmony_ci * @buffer: Pointer to a buffer for capability data, cast to an __u64
584bf215546Sopenharmony_ci * @size: Max size to copy
585bf215546Sopenharmony_ci *
586bf215546Sopenharmony_ci * Input argument to the DRM_VMW_GET_3D_CAP_IOCTL
587bf215546Sopenharmony_ci * ioctls.
588bf215546Sopenharmony_ci */
589bf215546Sopenharmony_ci
590bf215546Sopenharmony_cistruct drm_vmw_get_3d_cap_arg {
591bf215546Sopenharmony_ci	__u64 buffer;
592bf215546Sopenharmony_ci	__u32 max_size;
593bf215546Sopenharmony_ci	__u32 pad64;
594bf215546Sopenharmony_ci};
595bf215546Sopenharmony_ci
596bf215546Sopenharmony_ci/*************************************************************************/
597bf215546Sopenharmony_ci/**
598bf215546Sopenharmony_ci * DRM_VMW_FENCE_WAIT
599bf215546Sopenharmony_ci *
600bf215546Sopenharmony_ci * Waits for a fence object to signal. The wait is interruptible, so that
601bf215546Sopenharmony_ci * signals may be delivered during the interrupt. The wait may timeout,
602bf215546Sopenharmony_ci * in which case the calls returns -EBUSY. If the wait is restarted,
603bf215546Sopenharmony_ci * that is restarting without resetting @cookie_valid to zero,
604bf215546Sopenharmony_ci * the timeout is computed from the first call.
605bf215546Sopenharmony_ci *
606bf215546Sopenharmony_ci * The flags argument to the DRM_VMW_FENCE_WAIT ioctl indicates what to wait
607bf215546Sopenharmony_ci * on:
608bf215546Sopenharmony_ci * DRM_VMW_FENCE_FLAG_EXEC: All commands ahead of the fence in the command
609bf215546Sopenharmony_ci * stream
610bf215546Sopenharmony_ci * have executed.
611bf215546Sopenharmony_ci * DRM_VMW_FENCE_FLAG_QUERY: All query results resulting from query finish
612bf215546Sopenharmony_ci * commands
613bf215546Sopenharmony_ci * in the buffer given to the EXECBUF ioctl returning the fence object handle
614bf215546Sopenharmony_ci * are available to user-space.
615bf215546Sopenharmony_ci *
616bf215546Sopenharmony_ci * DRM_VMW_WAIT_OPTION_UNREF: If this wait option is given, and the
617bf215546Sopenharmony_ci * fenc wait ioctl returns 0, the fence object has been unreferenced after
618bf215546Sopenharmony_ci * the wait.
619bf215546Sopenharmony_ci */
620bf215546Sopenharmony_ci
621bf215546Sopenharmony_ci#define DRM_VMW_FENCE_FLAG_EXEC   (1 << 0)
622bf215546Sopenharmony_ci#define DRM_VMW_FENCE_FLAG_QUERY  (1 << 1)
623bf215546Sopenharmony_ci
624bf215546Sopenharmony_ci#define DRM_VMW_WAIT_OPTION_UNREF (1 << 0)
625bf215546Sopenharmony_ci
626bf215546Sopenharmony_ci/**
627bf215546Sopenharmony_ci * struct drm_vmw_fence_wait_arg
628bf215546Sopenharmony_ci *
629bf215546Sopenharmony_ci * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
630bf215546Sopenharmony_ci * @cookie_valid: Must be reset to 0 on first call. Left alone on restart.
631bf215546Sopenharmony_ci * @kernel_cookie: Set to 0 on first call. Left alone on restart.
632bf215546Sopenharmony_ci * @timeout_us: Wait timeout in microseconds. 0 for indefinite timeout.
633bf215546Sopenharmony_ci * @lazy: Set to 1 if timing is not critical. Allow more than a kernel tick
634bf215546Sopenharmony_ci * before returning.
635bf215546Sopenharmony_ci * @flags: Fence flags to wait on.
636bf215546Sopenharmony_ci * @wait_options: Options that control the behaviour of the wait ioctl.
637bf215546Sopenharmony_ci *
638bf215546Sopenharmony_ci * Input argument to the DRM_VMW_FENCE_WAIT ioctl.
639bf215546Sopenharmony_ci */
640bf215546Sopenharmony_ci
641bf215546Sopenharmony_cistruct drm_vmw_fence_wait_arg {
642bf215546Sopenharmony_ci	__u32 handle;
643bf215546Sopenharmony_ci	__s32  cookie_valid;
644bf215546Sopenharmony_ci	__u64 kernel_cookie;
645bf215546Sopenharmony_ci	__u64 timeout_us;
646bf215546Sopenharmony_ci	__s32 lazy;
647bf215546Sopenharmony_ci	__s32 flags;
648bf215546Sopenharmony_ci	__s32 wait_options;
649bf215546Sopenharmony_ci	__s32 pad64;
650bf215546Sopenharmony_ci};
651bf215546Sopenharmony_ci
652bf215546Sopenharmony_ci/*************************************************************************/
653bf215546Sopenharmony_ci/**
654bf215546Sopenharmony_ci * DRM_VMW_FENCE_SIGNALED
655bf215546Sopenharmony_ci *
656bf215546Sopenharmony_ci * Checks if a fence object is signaled..
657bf215546Sopenharmony_ci */
658bf215546Sopenharmony_ci
659bf215546Sopenharmony_ci/**
660bf215546Sopenharmony_ci * struct drm_vmw_fence_signaled_arg
661bf215546Sopenharmony_ci *
662bf215546Sopenharmony_ci * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
663bf215546Sopenharmony_ci * @flags: Fence object flags input to DRM_VMW_FENCE_SIGNALED ioctl
664bf215546Sopenharmony_ci * @signaled: Out: Flags signaled.
665bf215546Sopenharmony_ci * @sequence: Out: Highest sequence passed so far. Can be used to signal the
666bf215546Sopenharmony_ci * EXEC flag of user-space fence objects.
667bf215546Sopenharmony_ci *
668bf215546Sopenharmony_ci * Input/Output argument to the DRM_VMW_FENCE_SIGNALED and DRM_VMW_FENCE_UNREF
669bf215546Sopenharmony_ci * ioctls.
670bf215546Sopenharmony_ci */
671bf215546Sopenharmony_ci
672bf215546Sopenharmony_cistruct drm_vmw_fence_signaled_arg {
673bf215546Sopenharmony_ci	 __u32 handle;
674bf215546Sopenharmony_ci	 __u32 flags;
675bf215546Sopenharmony_ci	 __s32 signaled;
676bf215546Sopenharmony_ci	 __u32 passed_seqno;
677bf215546Sopenharmony_ci	 __u32 signaled_flags;
678bf215546Sopenharmony_ci	 __u32 pad64;
679bf215546Sopenharmony_ci};
680bf215546Sopenharmony_ci
681bf215546Sopenharmony_ci/*************************************************************************/
682bf215546Sopenharmony_ci/**
683bf215546Sopenharmony_ci * DRM_VMW_FENCE_UNREF
684bf215546Sopenharmony_ci *
685bf215546Sopenharmony_ci * Unreferences a fence object, and causes it to be destroyed if there are no
686bf215546Sopenharmony_ci * other references to it.
687bf215546Sopenharmony_ci *
688bf215546Sopenharmony_ci */
689bf215546Sopenharmony_ci
690bf215546Sopenharmony_ci/**
691bf215546Sopenharmony_ci * struct drm_vmw_fence_arg
692bf215546Sopenharmony_ci *
693bf215546Sopenharmony_ci * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
694bf215546Sopenharmony_ci *
695bf215546Sopenharmony_ci * Input/Output argument to the DRM_VMW_FENCE_UNREF ioctl..
696bf215546Sopenharmony_ci */
697bf215546Sopenharmony_ci
698bf215546Sopenharmony_cistruct drm_vmw_fence_arg {
699bf215546Sopenharmony_ci	 __u32 handle;
700bf215546Sopenharmony_ci	 __u32 pad64;
701bf215546Sopenharmony_ci};
702bf215546Sopenharmony_ci
703bf215546Sopenharmony_ci
704bf215546Sopenharmony_ci/*************************************************************************/
705bf215546Sopenharmony_ci/**
706bf215546Sopenharmony_ci * DRM_VMW_FENCE_EVENT
707bf215546Sopenharmony_ci *
708bf215546Sopenharmony_ci * Queues an event on a fence to be delivered on the drm character device
709bf215546Sopenharmony_ci * when the fence has signaled the DRM_VMW_FENCE_FLAG_EXEC flag.
710bf215546Sopenharmony_ci * Optionally the approximate time when the fence signaled is
711bf215546Sopenharmony_ci * given by the event.
712bf215546Sopenharmony_ci */
713bf215546Sopenharmony_ci
714bf215546Sopenharmony_ci/*
715bf215546Sopenharmony_ci * The event type
716bf215546Sopenharmony_ci */
717bf215546Sopenharmony_ci#define DRM_VMW_EVENT_FENCE_SIGNALED 0x80000000
718bf215546Sopenharmony_ci
719bf215546Sopenharmony_cistruct drm_vmw_event_fence {
720bf215546Sopenharmony_ci	struct drm_event base;
721bf215546Sopenharmony_ci	__u64 user_data;
722bf215546Sopenharmony_ci	__u32 tv_sec;
723bf215546Sopenharmony_ci	__u32 tv_usec;
724bf215546Sopenharmony_ci};
725bf215546Sopenharmony_ci
726bf215546Sopenharmony_ci/*
727bf215546Sopenharmony_ci * Flags that may be given to the command.
728bf215546Sopenharmony_ci */
729bf215546Sopenharmony_ci/* Request fence signaled time on the event. */
730bf215546Sopenharmony_ci#define DRM_VMW_FE_FLAG_REQ_TIME (1 << 0)
731bf215546Sopenharmony_ci
732bf215546Sopenharmony_ci/**
733bf215546Sopenharmony_ci * struct drm_vmw_fence_event_arg
734bf215546Sopenharmony_ci *
735bf215546Sopenharmony_ci * @fence_rep: Pointer to fence_rep structure cast to __u64 or 0 if
736bf215546Sopenharmony_ci * the fence is not supposed to be referenced by user-space.
737bf215546Sopenharmony_ci * @user_info: Info to be delivered with the event.
738bf215546Sopenharmony_ci * @handle: Attach the event to this fence only.
739bf215546Sopenharmony_ci * @flags: A set of flags as defined above.
740bf215546Sopenharmony_ci */
741bf215546Sopenharmony_cistruct drm_vmw_fence_event_arg {
742bf215546Sopenharmony_ci	__u64 fence_rep;
743bf215546Sopenharmony_ci	__u64 user_data;
744bf215546Sopenharmony_ci	__u32 handle;
745bf215546Sopenharmony_ci	__u32 flags;
746bf215546Sopenharmony_ci};
747bf215546Sopenharmony_ci
748bf215546Sopenharmony_ci
749bf215546Sopenharmony_ci/*************************************************************************/
750bf215546Sopenharmony_ci/**
751bf215546Sopenharmony_ci * DRM_VMW_PRESENT
752bf215546Sopenharmony_ci *
753bf215546Sopenharmony_ci * Executes an SVGA present on a given fb for a given surface. The surface
754bf215546Sopenharmony_ci * is placed on the framebuffer. Cliprects are given relative to the given
755bf215546Sopenharmony_ci * point (the point disignated by dest_{x|y}).
756bf215546Sopenharmony_ci *
757bf215546Sopenharmony_ci */
758bf215546Sopenharmony_ci
759bf215546Sopenharmony_ci/**
760bf215546Sopenharmony_ci * struct drm_vmw_present_arg
761bf215546Sopenharmony_ci * @fb_id: framebuffer id to present / read back from.
762bf215546Sopenharmony_ci * @sid: Surface id to present from.
763bf215546Sopenharmony_ci * @dest_x: X placement coordinate for surface.
764bf215546Sopenharmony_ci * @dest_y: Y placement coordinate for surface.
765bf215546Sopenharmony_ci * @clips_ptr: Pointer to an array of clip rects cast to an __u64.
766bf215546Sopenharmony_ci * @num_clips: Number of cliprects given relative to the framebuffer origin,
767bf215546Sopenharmony_ci * in the same coordinate space as the frame buffer.
768bf215546Sopenharmony_ci * @pad64: Unused 64-bit padding.
769bf215546Sopenharmony_ci *
770bf215546Sopenharmony_ci * Input argument to the DRM_VMW_PRESENT ioctl.
771bf215546Sopenharmony_ci */
772bf215546Sopenharmony_ci
773bf215546Sopenharmony_cistruct drm_vmw_present_arg {
774bf215546Sopenharmony_ci	__u32 fb_id;
775bf215546Sopenharmony_ci	__u32 sid;
776bf215546Sopenharmony_ci	__s32 dest_x;
777bf215546Sopenharmony_ci	__s32 dest_y;
778bf215546Sopenharmony_ci	__u64 clips_ptr;
779bf215546Sopenharmony_ci	__u32 num_clips;
780bf215546Sopenharmony_ci	__u32 pad64;
781bf215546Sopenharmony_ci};
782bf215546Sopenharmony_ci
783bf215546Sopenharmony_ci
784bf215546Sopenharmony_ci/*************************************************************************/
785bf215546Sopenharmony_ci/**
786bf215546Sopenharmony_ci * DRM_VMW_PRESENT_READBACK
787bf215546Sopenharmony_ci *
788bf215546Sopenharmony_ci * Executes an SVGA present readback from a given fb to the dma buffer
789bf215546Sopenharmony_ci * currently bound as the fb. If there is no dma buffer bound to the fb,
790bf215546Sopenharmony_ci * an error will be returned.
791bf215546Sopenharmony_ci *
792bf215546Sopenharmony_ci */
793bf215546Sopenharmony_ci
794bf215546Sopenharmony_ci/**
795bf215546Sopenharmony_ci * struct drm_vmw_present_arg
796bf215546Sopenharmony_ci * @fb_id: fb_id to present / read back from.
797bf215546Sopenharmony_ci * @num_clips: Number of cliprects.
798bf215546Sopenharmony_ci * @clips_ptr: Pointer to an array of clip rects cast to an __u64.
799bf215546Sopenharmony_ci * @fence_rep: Pointer to a struct drm_vmw_fence_rep, cast to an __u64.
800bf215546Sopenharmony_ci * If this member is NULL, then the ioctl should not return a fence.
801bf215546Sopenharmony_ci */
802bf215546Sopenharmony_ci
803bf215546Sopenharmony_cistruct drm_vmw_present_readback_arg {
804bf215546Sopenharmony_ci	 __u32 fb_id;
805bf215546Sopenharmony_ci	 __u32 num_clips;
806bf215546Sopenharmony_ci	 __u64 clips_ptr;
807bf215546Sopenharmony_ci	 __u64 fence_rep;
808bf215546Sopenharmony_ci};
809bf215546Sopenharmony_ci
810bf215546Sopenharmony_ci/*************************************************************************/
811bf215546Sopenharmony_ci/**
812bf215546Sopenharmony_ci * DRM_VMW_UPDATE_LAYOUT - Update layout
813bf215546Sopenharmony_ci *
814bf215546Sopenharmony_ci * Updates the preferred modes and connection status for connectors. The
815bf215546Sopenharmony_ci * command consists of one drm_vmw_update_layout_arg pointing to an array
816bf215546Sopenharmony_ci * of num_outputs drm_vmw_rect's.
817bf215546Sopenharmony_ci */
818bf215546Sopenharmony_ci
819bf215546Sopenharmony_ci/**
820bf215546Sopenharmony_ci * struct drm_vmw_update_layout_arg
821bf215546Sopenharmony_ci *
822bf215546Sopenharmony_ci * @num_outputs: number of active connectors
823bf215546Sopenharmony_ci * @rects: pointer to array of drm_vmw_rect cast to an __u64
824bf215546Sopenharmony_ci *
825bf215546Sopenharmony_ci * Input argument to the DRM_VMW_UPDATE_LAYOUT Ioctl.
826bf215546Sopenharmony_ci */
827bf215546Sopenharmony_cistruct drm_vmw_update_layout_arg {
828bf215546Sopenharmony_ci	__u32 num_outputs;
829bf215546Sopenharmony_ci	__u32 pad64;
830bf215546Sopenharmony_ci	__u64 rects;
831bf215546Sopenharmony_ci};
832bf215546Sopenharmony_ci
833bf215546Sopenharmony_ci
834bf215546Sopenharmony_ci/*************************************************************************/
835bf215546Sopenharmony_ci/**
836bf215546Sopenharmony_ci * DRM_VMW_CREATE_SHADER - Create shader
837bf215546Sopenharmony_ci *
838bf215546Sopenharmony_ci * Creates a shader and optionally binds it to a dma buffer containing
839bf215546Sopenharmony_ci * the shader byte-code.
840bf215546Sopenharmony_ci */
841bf215546Sopenharmony_ci
842bf215546Sopenharmony_ci/**
843bf215546Sopenharmony_ci * enum drm_vmw_shader_type - Shader types
844bf215546Sopenharmony_ci */
845bf215546Sopenharmony_cienum drm_vmw_shader_type {
846bf215546Sopenharmony_ci	drm_vmw_shader_type_vs = 0,
847bf215546Sopenharmony_ci	drm_vmw_shader_type_ps,
848bf215546Sopenharmony_ci};
849bf215546Sopenharmony_ci
850bf215546Sopenharmony_ci
851bf215546Sopenharmony_ci/**
852bf215546Sopenharmony_ci * struct drm_vmw_shader_create_arg
853bf215546Sopenharmony_ci *
854bf215546Sopenharmony_ci * @shader_type: Shader type of the shader to create.
855bf215546Sopenharmony_ci * @size: Size of the byte-code in bytes.
856bf215546Sopenharmony_ci * where the shader byte-code starts
857bf215546Sopenharmony_ci * @buffer_handle: Buffer handle identifying the buffer containing the
858bf215546Sopenharmony_ci * shader byte-code
859bf215546Sopenharmony_ci * @shader_handle: On successful completion contains a handle that
860bf215546Sopenharmony_ci * can be used to subsequently identify the shader.
861bf215546Sopenharmony_ci * @offset: Offset in bytes into the buffer given by @buffer_handle,
862bf215546Sopenharmony_ci *
863bf215546Sopenharmony_ci * Input / Output argument to the DRM_VMW_CREATE_SHADER Ioctl.
864bf215546Sopenharmony_ci */
865bf215546Sopenharmony_cistruct drm_vmw_shader_create_arg {
866bf215546Sopenharmony_ci	enum drm_vmw_shader_type shader_type;
867bf215546Sopenharmony_ci	__u32 size;
868bf215546Sopenharmony_ci	__u32 buffer_handle;
869bf215546Sopenharmony_ci	__u32 shader_handle;
870bf215546Sopenharmony_ci	__u64 offset;
871bf215546Sopenharmony_ci};
872bf215546Sopenharmony_ci
873bf215546Sopenharmony_ci/*************************************************************************/
874bf215546Sopenharmony_ci/**
875bf215546Sopenharmony_ci * DRM_VMW_UNREF_SHADER - Unreferences a shader
876bf215546Sopenharmony_ci *
877bf215546Sopenharmony_ci * Destroys a user-space reference to a shader, optionally destroying
878bf215546Sopenharmony_ci * it.
879bf215546Sopenharmony_ci */
880bf215546Sopenharmony_ci
881bf215546Sopenharmony_ci/**
882bf215546Sopenharmony_ci * struct drm_vmw_shader_arg
883bf215546Sopenharmony_ci *
884bf215546Sopenharmony_ci * @handle: Handle identifying the shader to destroy.
885bf215546Sopenharmony_ci *
886bf215546Sopenharmony_ci * Input argument to the DRM_VMW_UNREF_SHADER ioctl.
887bf215546Sopenharmony_ci */
888bf215546Sopenharmony_cistruct drm_vmw_shader_arg {
889bf215546Sopenharmony_ci	__u32 handle;
890bf215546Sopenharmony_ci	__u32 pad64;
891bf215546Sopenharmony_ci};
892bf215546Sopenharmony_ci
893bf215546Sopenharmony_ci/*************************************************************************/
894bf215546Sopenharmony_ci/**
895bf215546Sopenharmony_ci * DRM_VMW_GB_SURFACE_CREATE - Create a host guest-backed surface.
896bf215546Sopenharmony_ci *
897bf215546Sopenharmony_ci * Allocates a surface handle and queues a create surface command
898bf215546Sopenharmony_ci * for the host on the first use of the surface. The surface ID can
899bf215546Sopenharmony_ci * be used as the surface ID in commands referencing the surface.
900bf215546Sopenharmony_ci */
901bf215546Sopenharmony_ci
902bf215546Sopenharmony_ci/**
903bf215546Sopenharmony_ci * enum drm_vmw_surface_flags
904bf215546Sopenharmony_ci *
905bf215546Sopenharmony_ci * @drm_vmw_surface_flag_shareable:     Whether the surface is shareable
906bf215546Sopenharmony_ci * @drm_vmw_surface_flag_scanout:       Whether the surface is a scanout
907bf215546Sopenharmony_ci *                                      surface.
908bf215546Sopenharmony_ci * @drm_vmw_surface_flag_create_buffer: Create a backup buffer if none is
909bf215546Sopenharmony_ci *                                      given.
910bf215546Sopenharmony_ci * @drm_vmw_surface_flag_coherent:      Back surface with coherent memory.
911bf215546Sopenharmony_ci */
912bf215546Sopenharmony_cienum drm_vmw_surface_flags {
913bf215546Sopenharmony_ci	drm_vmw_surface_flag_shareable = (1 << 0),
914bf215546Sopenharmony_ci	drm_vmw_surface_flag_scanout = (1 << 1),
915bf215546Sopenharmony_ci	drm_vmw_surface_flag_create_buffer = (1 << 2),
916bf215546Sopenharmony_ci	drm_vmw_surface_flag_coherent = (1 << 3),
917bf215546Sopenharmony_ci};
918bf215546Sopenharmony_ci
919bf215546Sopenharmony_ci/**
920bf215546Sopenharmony_ci * struct drm_vmw_gb_surface_create_req
921bf215546Sopenharmony_ci *
922bf215546Sopenharmony_ci * @svga3d_flags:     SVGA3d surface flags for the device.
923bf215546Sopenharmony_ci * @format:           SVGA3d format.
924bf215546Sopenharmony_ci * @mip_level:        Number of mip levels for all faces.
925bf215546Sopenharmony_ci * @drm_surface_flags Flags as described above.
926bf215546Sopenharmony_ci * @multisample_count Future use. Set to 0.
927bf215546Sopenharmony_ci * @autogen_filter    Future use. Set to 0.
928bf215546Sopenharmony_ci * @buffer_handle     Buffer handle of backup buffer. SVGA3D_INVALID_ID
929bf215546Sopenharmony_ci *                    if none.
930bf215546Sopenharmony_ci * @base_size         Size of the base mip level for all faces.
931bf215546Sopenharmony_ci * @array_size        Must be zero for non-DX hardware, and if non-zero
932bf215546Sopenharmony_ci *                    svga3d_flags must have proper bind flags setup.
933bf215546Sopenharmony_ci *
934bf215546Sopenharmony_ci * Input argument to the  DRM_VMW_GB_SURFACE_CREATE Ioctl.
935bf215546Sopenharmony_ci * Part of output argument for the DRM_VMW_GB_SURFACE_REF Ioctl.
936bf215546Sopenharmony_ci */
937bf215546Sopenharmony_cistruct drm_vmw_gb_surface_create_req {
938bf215546Sopenharmony_ci	__u32 svga3d_flags;
939bf215546Sopenharmony_ci	__u32 format;
940bf215546Sopenharmony_ci	__u32 mip_levels;
941bf215546Sopenharmony_ci	enum drm_vmw_surface_flags drm_surface_flags;
942bf215546Sopenharmony_ci	__u32 multisample_count;
943bf215546Sopenharmony_ci	__u32 autogen_filter;
944bf215546Sopenharmony_ci	__u32 buffer_handle;
945bf215546Sopenharmony_ci	__u32 array_size;
946bf215546Sopenharmony_ci	struct drm_vmw_size base_size;
947bf215546Sopenharmony_ci};
948bf215546Sopenharmony_ci
949bf215546Sopenharmony_ci/**
950bf215546Sopenharmony_ci * struct drm_vmw_gb_surface_create_rep
951bf215546Sopenharmony_ci *
952bf215546Sopenharmony_ci * @handle:            Surface handle.
953bf215546Sopenharmony_ci * @backup_size:       Size of backup buffers for this surface.
954bf215546Sopenharmony_ci * @buffer_handle:     Handle of backup buffer. SVGA3D_INVALID_ID if none.
955bf215546Sopenharmony_ci * @buffer_size:       Actual size of the buffer identified by
956bf215546Sopenharmony_ci *                     @buffer_handle
957bf215546Sopenharmony_ci * @buffer_map_handle: Offset into device address space for the buffer
958bf215546Sopenharmony_ci *                     identified by @buffer_handle.
959bf215546Sopenharmony_ci *
960bf215546Sopenharmony_ci * Part of output argument for the DRM_VMW_GB_SURFACE_REF ioctl.
961bf215546Sopenharmony_ci * Output argument for the DRM_VMW_GB_SURFACE_CREATE ioctl.
962bf215546Sopenharmony_ci */
963bf215546Sopenharmony_cistruct drm_vmw_gb_surface_create_rep {
964bf215546Sopenharmony_ci	__u32 handle;
965bf215546Sopenharmony_ci	__u32 backup_size;
966bf215546Sopenharmony_ci	__u32 buffer_handle;
967bf215546Sopenharmony_ci	__u32 buffer_size;
968bf215546Sopenharmony_ci	__u64 buffer_map_handle;
969bf215546Sopenharmony_ci};
970bf215546Sopenharmony_ci
971bf215546Sopenharmony_ci/**
972bf215546Sopenharmony_ci * union drm_vmw_gb_surface_create_arg
973bf215546Sopenharmony_ci *
974bf215546Sopenharmony_ci * @req: Input argument as described above.
975bf215546Sopenharmony_ci * @rep: Output argument as described above.
976bf215546Sopenharmony_ci *
977bf215546Sopenharmony_ci * Argument to the DRM_VMW_GB_SURFACE_CREATE ioctl.
978bf215546Sopenharmony_ci */
979bf215546Sopenharmony_ciunion drm_vmw_gb_surface_create_arg {
980bf215546Sopenharmony_ci	struct drm_vmw_gb_surface_create_rep rep;
981bf215546Sopenharmony_ci	struct drm_vmw_gb_surface_create_req req;
982bf215546Sopenharmony_ci};
983bf215546Sopenharmony_ci
984bf215546Sopenharmony_ci/*************************************************************************/
985bf215546Sopenharmony_ci/**
986bf215546Sopenharmony_ci * DRM_VMW_GB_SURFACE_REF - Reference a host surface.
987bf215546Sopenharmony_ci *
988bf215546Sopenharmony_ci * Puts a reference on a host surface with a given handle, as previously
989bf215546Sopenharmony_ci * returned by the DRM_VMW_GB_SURFACE_CREATE ioctl.
990bf215546Sopenharmony_ci * A reference will make sure the surface isn't destroyed while we hold
991bf215546Sopenharmony_ci * it and will allow the calling client to use the surface handle in
992bf215546Sopenharmony_ci * the command stream.
993bf215546Sopenharmony_ci *
994bf215546Sopenharmony_ci * On successful return, the Ioctl returns the surface information given
995bf215546Sopenharmony_ci * to and returned from the DRM_VMW_GB_SURFACE_CREATE ioctl.
996bf215546Sopenharmony_ci */
997bf215546Sopenharmony_ci
998bf215546Sopenharmony_ci/**
999bf215546Sopenharmony_ci * struct drm_vmw_gb_surface_reference_arg
1000bf215546Sopenharmony_ci *
1001bf215546Sopenharmony_ci * @creq: The data used as input when the surface was created, as described
1002bf215546Sopenharmony_ci *        above at "struct drm_vmw_gb_surface_create_req"
1003bf215546Sopenharmony_ci * @crep: Additional data output when the surface was created, as described
1004bf215546Sopenharmony_ci *        above at "struct drm_vmw_gb_surface_create_rep"
1005bf215546Sopenharmony_ci *
1006bf215546Sopenharmony_ci * Output Argument to the DRM_VMW_GB_SURFACE_REF ioctl.
1007bf215546Sopenharmony_ci */
1008bf215546Sopenharmony_cistruct drm_vmw_gb_surface_ref_rep {
1009bf215546Sopenharmony_ci	struct drm_vmw_gb_surface_create_req creq;
1010bf215546Sopenharmony_ci	struct drm_vmw_gb_surface_create_rep crep;
1011bf215546Sopenharmony_ci};
1012bf215546Sopenharmony_ci
1013bf215546Sopenharmony_ci/**
1014bf215546Sopenharmony_ci * union drm_vmw_gb_surface_reference_arg
1015bf215546Sopenharmony_ci *
1016bf215546Sopenharmony_ci * @req: Input data as described above at "struct drm_vmw_surface_arg"
1017bf215546Sopenharmony_ci * @rep: Output data as described above at "struct drm_vmw_gb_surface_ref_rep"
1018bf215546Sopenharmony_ci *
1019bf215546Sopenharmony_ci * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl.
1020bf215546Sopenharmony_ci */
1021bf215546Sopenharmony_ciunion drm_vmw_gb_surface_reference_arg {
1022bf215546Sopenharmony_ci	struct drm_vmw_gb_surface_ref_rep rep;
1023bf215546Sopenharmony_ci	struct drm_vmw_surface_arg req;
1024bf215546Sopenharmony_ci};
1025bf215546Sopenharmony_ci
1026bf215546Sopenharmony_ci
1027bf215546Sopenharmony_ci/*************************************************************************/
1028bf215546Sopenharmony_ci/**
1029bf215546Sopenharmony_ci * DRM_VMW_SYNCCPU - Sync a DMA buffer / MOB for CPU access.
1030bf215546Sopenharmony_ci *
1031bf215546Sopenharmony_ci * Idles any previously submitted GPU operations on the buffer and
1032bf215546Sopenharmony_ci * by default blocks command submissions that reference the buffer.
1033bf215546Sopenharmony_ci * If the file descriptor used to grab a blocking CPU sync is closed, the
1034bf215546Sopenharmony_ci * cpu sync is released.
1035bf215546Sopenharmony_ci * The flags argument indicates how the grab / release operation should be
1036bf215546Sopenharmony_ci * performed:
1037bf215546Sopenharmony_ci */
1038bf215546Sopenharmony_ci
1039bf215546Sopenharmony_ci/**
1040bf215546Sopenharmony_ci * enum drm_vmw_synccpu_flags - Synccpu flags:
1041bf215546Sopenharmony_ci *
1042bf215546Sopenharmony_ci * @drm_vmw_synccpu_read: Sync for read. If sync is done for read only, it's a
1043bf215546Sopenharmony_ci * hint to the kernel to allow command submissions that references the buffer
1044bf215546Sopenharmony_ci * for read-only.
1045bf215546Sopenharmony_ci * @drm_vmw_synccpu_write: Sync for write. Block all command submissions
1046bf215546Sopenharmony_ci * referencing this buffer.
1047bf215546Sopenharmony_ci * @drm_vmw_synccpu_dontblock: Dont wait for GPU idle, but rather return
1048bf215546Sopenharmony_ci * -EBUSY should the buffer be busy.
1049bf215546Sopenharmony_ci * @drm_vmw_synccpu_allow_cs: Allow command submission that touches the buffer
1050bf215546Sopenharmony_ci * while the buffer is synced for CPU. This is similar to the GEM bo idle
1051bf215546Sopenharmony_ci * behavior.
1052bf215546Sopenharmony_ci */
1053bf215546Sopenharmony_cienum drm_vmw_synccpu_flags {
1054bf215546Sopenharmony_ci	drm_vmw_synccpu_read = (1 << 0),
1055bf215546Sopenharmony_ci	drm_vmw_synccpu_write = (1 << 1),
1056bf215546Sopenharmony_ci	drm_vmw_synccpu_dontblock = (1 << 2),
1057bf215546Sopenharmony_ci	drm_vmw_synccpu_allow_cs = (1 << 3)
1058bf215546Sopenharmony_ci};
1059bf215546Sopenharmony_ci
1060bf215546Sopenharmony_ci/**
1061bf215546Sopenharmony_ci * enum drm_vmw_synccpu_op - Synccpu operations:
1062bf215546Sopenharmony_ci *
1063bf215546Sopenharmony_ci * @drm_vmw_synccpu_grab:    Grab the buffer for CPU operations
1064bf215546Sopenharmony_ci * @drm_vmw_synccpu_release: Release a previous grab.
1065bf215546Sopenharmony_ci */
1066bf215546Sopenharmony_cienum drm_vmw_synccpu_op {
1067bf215546Sopenharmony_ci	drm_vmw_synccpu_grab,
1068bf215546Sopenharmony_ci	drm_vmw_synccpu_release
1069bf215546Sopenharmony_ci};
1070bf215546Sopenharmony_ci
1071bf215546Sopenharmony_ci/**
1072bf215546Sopenharmony_ci * struct drm_vmw_synccpu_arg
1073bf215546Sopenharmony_ci *
1074bf215546Sopenharmony_ci * @op:			     The synccpu operation as described above.
1075bf215546Sopenharmony_ci * @handle:		     Handle identifying the buffer object.
1076bf215546Sopenharmony_ci * @flags:		     Flags as described above.
1077bf215546Sopenharmony_ci */
1078bf215546Sopenharmony_cistruct drm_vmw_synccpu_arg {
1079bf215546Sopenharmony_ci	enum drm_vmw_synccpu_op op;
1080bf215546Sopenharmony_ci	enum drm_vmw_synccpu_flags flags;
1081bf215546Sopenharmony_ci	__u32 handle;
1082bf215546Sopenharmony_ci	__u32 pad64;
1083bf215546Sopenharmony_ci};
1084bf215546Sopenharmony_ci
1085bf215546Sopenharmony_ci/*************************************************************************/
1086bf215546Sopenharmony_ci/**
1087bf215546Sopenharmony_ci * DRM_VMW_CREATE_EXTENDED_CONTEXT - Create a host context.
1088bf215546Sopenharmony_ci *
1089bf215546Sopenharmony_ci * Allocates a device unique context id, and queues a create context command
1090bf215546Sopenharmony_ci * for the host. Does not wait for host completion.
1091bf215546Sopenharmony_ci */
1092bf215546Sopenharmony_cienum drm_vmw_extended_context {
1093bf215546Sopenharmony_ci	drm_vmw_context_legacy,
1094bf215546Sopenharmony_ci	drm_vmw_context_dx
1095bf215546Sopenharmony_ci};
1096bf215546Sopenharmony_ci
1097bf215546Sopenharmony_ci/**
1098bf215546Sopenharmony_ci * union drm_vmw_extended_context_arg
1099bf215546Sopenharmony_ci *
1100bf215546Sopenharmony_ci * @req: Context type.
1101bf215546Sopenharmony_ci * @rep: Context identifier.
1102bf215546Sopenharmony_ci *
1103bf215546Sopenharmony_ci * Argument to the DRM_VMW_CREATE_EXTENDED_CONTEXT Ioctl.
1104bf215546Sopenharmony_ci */
1105bf215546Sopenharmony_ciunion drm_vmw_extended_context_arg {
1106bf215546Sopenharmony_ci	enum drm_vmw_extended_context req;
1107bf215546Sopenharmony_ci	struct drm_vmw_context_arg rep;
1108bf215546Sopenharmony_ci};
1109bf215546Sopenharmony_ci
1110bf215546Sopenharmony_ci/*************************************************************************/
1111bf215546Sopenharmony_ci/*
1112bf215546Sopenharmony_ci * DRM_VMW_HANDLE_CLOSE - Close a user-space handle and release its
1113bf215546Sopenharmony_ci * underlying resource.
1114bf215546Sopenharmony_ci *
1115bf215546Sopenharmony_ci * Note that this ioctl is overlaid on the deprecated DRM_VMW_UNREF_DMABUF
1116bf215546Sopenharmony_ci * Ioctl.
1117bf215546Sopenharmony_ci */
1118bf215546Sopenharmony_ci
1119bf215546Sopenharmony_ci/**
1120bf215546Sopenharmony_ci * struct drm_vmw_handle_close_arg
1121bf215546Sopenharmony_ci *
1122bf215546Sopenharmony_ci * @handle: Handle to close.
1123bf215546Sopenharmony_ci *
1124bf215546Sopenharmony_ci * Argument to the DRM_VMW_HANDLE_CLOSE Ioctl.
1125bf215546Sopenharmony_ci */
1126bf215546Sopenharmony_cistruct drm_vmw_handle_close_arg {
1127bf215546Sopenharmony_ci	__u32 handle;
1128bf215546Sopenharmony_ci	__u32 pad64;
1129bf215546Sopenharmony_ci};
1130bf215546Sopenharmony_ci#define drm_vmw_unref_dmabuf_arg drm_vmw_handle_close_arg
1131bf215546Sopenharmony_ci
1132bf215546Sopenharmony_ci/*************************************************************************/
1133bf215546Sopenharmony_ci/**
1134bf215546Sopenharmony_ci * DRM_VMW_GB_SURFACE_CREATE_EXT - Create a host guest-backed surface.
1135bf215546Sopenharmony_ci *
1136bf215546Sopenharmony_ci * Allocates a surface handle and queues a create surface command
1137bf215546Sopenharmony_ci * for the host on the first use of the surface. The surface ID can
1138bf215546Sopenharmony_ci * be used as the surface ID in commands referencing the surface.
1139bf215546Sopenharmony_ci *
1140bf215546Sopenharmony_ci * This new command extends DRM_VMW_GB_SURFACE_CREATE by adding version
1141bf215546Sopenharmony_ci * parameter and 64 bit svga flag.
1142bf215546Sopenharmony_ci */
1143bf215546Sopenharmony_ci
1144bf215546Sopenharmony_ci/**
1145bf215546Sopenharmony_ci * enum drm_vmw_surface_version
1146bf215546Sopenharmony_ci *
1147bf215546Sopenharmony_ci * @drm_vmw_surface_gb_v1: Corresponds to current gb surface format with
1148bf215546Sopenharmony_ci * svga3d surface flags split into 2, upper half and lower half.
1149bf215546Sopenharmony_ci */
1150bf215546Sopenharmony_cienum drm_vmw_surface_version {
1151bf215546Sopenharmony_ci	drm_vmw_gb_surface_v1,
1152bf215546Sopenharmony_ci};
1153bf215546Sopenharmony_ci
1154bf215546Sopenharmony_ci/**
1155bf215546Sopenharmony_ci * struct drm_vmw_gb_surface_create_ext_req
1156bf215546Sopenharmony_ci *
1157bf215546Sopenharmony_ci * @base: Surface create parameters.
1158bf215546Sopenharmony_ci * @version: Version of surface create ioctl.
1159bf215546Sopenharmony_ci * @svga3d_flags_upper_32_bits: Upper 32 bits of svga3d flags.
1160bf215546Sopenharmony_ci * @multisample_pattern: Multisampling pattern when msaa is supported.
1161bf215546Sopenharmony_ci * @quality_level: Precision settings for each sample.
1162bf215546Sopenharmony_ci * @buffer_byte_stride: Buffer byte stride.
1163bf215546Sopenharmony_ci * @must_be_zero: Reserved for future usage.
1164bf215546Sopenharmony_ci *
1165bf215546Sopenharmony_ci * Input argument to the  DRM_VMW_GB_SURFACE_CREATE_EXT Ioctl.
1166bf215546Sopenharmony_ci * Part of output argument for the DRM_VMW_GB_SURFACE_REF_EXT Ioctl.
1167bf215546Sopenharmony_ci */
1168bf215546Sopenharmony_cistruct drm_vmw_gb_surface_create_ext_req {
1169bf215546Sopenharmony_ci	struct drm_vmw_gb_surface_create_req base;
1170bf215546Sopenharmony_ci	enum drm_vmw_surface_version version;
1171bf215546Sopenharmony_ci	__u32 svga3d_flags_upper_32_bits;
1172bf215546Sopenharmony_ci	__u32 multisample_pattern;
1173bf215546Sopenharmony_ci	__u32 quality_level;
1174bf215546Sopenharmony_ci	__u32 buffer_byte_stride;
1175bf215546Sopenharmony_ci	__u32 must_be_zero;
1176bf215546Sopenharmony_ci};
1177bf215546Sopenharmony_ci
1178bf215546Sopenharmony_ci/**
1179bf215546Sopenharmony_ci * union drm_vmw_gb_surface_create_ext_arg
1180bf215546Sopenharmony_ci *
1181bf215546Sopenharmony_ci * @req: Input argument as described above.
1182bf215546Sopenharmony_ci * @rep: Output argument as described above.
1183bf215546Sopenharmony_ci *
1184bf215546Sopenharmony_ci * Argument to the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl.
1185bf215546Sopenharmony_ci */
1186bf215546Sopenharmony_ciunion drm_vmw_gb_surface_create_ext_arg {
1187bf215546Sopenharmony_ci	struct drm_vmw_gb_surface_create_rep rep;
1188bf215546Sopenharmony_ci	struct drm_vmw_gb_surface_create_ext_req req;
1189bf215546Sopenharmony_ci};
1190bf215546Sopenharmony_ci
1191bf215546Sopenharmony_ci/*************************************************************************/
1192bf215546Sopenharmony_ci/**
1193bf215546Sopenharmony_ci * DRM_VMW_GB_SURFACE_REF_EXT - Reference a host surface.
1194bf215546Sopenharmony_ci *
1195bf215546Sopenharmony_ci * Puts a reference on a host surface with a given handle, as previously
1196bf215546Sopenharmony_ci * returned by the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl.
1197bf215546Sopenharmony_ci * A reference will make sure the surface isn't destroyed while we hold
1198bf215546Sopenharmony_ci * it and will allow the calling client to use the surface handle in
1199bf215546Sopenharmony_ci * the command stream.
1200bf215546Sopenharmony_ci *
1201bf215546Sopenharmony_ci * On successful return, the Ioctl returns the surface information given
1202bf215546Sopenharmony_ci * to and returned from the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl.
1203bf215546Sopenharmony_ci */
1204bf215546Sopenharmony_ci
1205bf215546Sopenharmony_ci/**
1206bf215546Sopenharmony_ci * struct drm_vmw_gb_surface_ref_ext_rep
1207bf215546Sopenharmony_ci *
1208bf215546Sopenharmony_ci * @creq: The data used as input when the surface was created, as described
1209bf215546Sopenharmony_ci *        above at "struct drm_vmw_gb_surface_create_ext_req"
1210bf215546Sopenharmony_ci * @crep: Additional data output when the surface was created, as described
1211bf215546Sopenharmony_ci *        above at "struct drm_vmw_gb_surface_create_rep"
1212bf215546Sopenharmony_ci *
1213bf215546Sopenharmony_ci * Output Argument to the DRM_VMW_GB_SURFACE_REF_EXT ioctl.
1214bf215546Sopenharmony_ci */
1215bf215546Sopenharmony_cistruct drm_vmw_gb_surface_ref_ext_rep {
1216bf215546Sopenharmony_ci	struct drm_vmw_gb_surface_create_ext_req creq;
1217bf215546Sopenharmony_ci	struct drm_vmw_gb_surface_create_rep crep;
1218bf215546Sopenharmony_ci};
1219bf215546Sopenharmony_ci
1220bf215546Sopenharmony_ci/**
1221bf215546Sopenharmony_ci * union drm_vmw_gb_surface_reference_ext_arg
1222bf215546Sopenharmony_ci *
1223bf215546Sopenharmony_ci * @req: Input data as described above at "struct drm_vmw_surface_arg"
1224bf215546Sopenharmony_ci * @rep: Output data as described above at
1225bf215546Sopenharmony_ci *       "struct drm_vmw_gb_surface_ref_ext_rep"
1226bf215546Sopenharmony_ci *
1227bf215546Sopenharmony_ci * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl.
1228bf215546Sopenharmony_ci */
1229bf215546Sopenharmony_ciunion drm_vmw_gb_surface_reference_ext_arg {
1230bf215546Sopenharmony_ci	struct drm_vmw_gb_surface_ref_ext_rep rep;
1231bf215546Sopenharmony_ci	struct drm_vmw_surface_arg req;
1232bf215546Sopenharmony_ci};
1233bf215546Sopenharmony_ci
1234bf215546Sopenharmony_ci/**
1235bf215546Sopenharmony_ci * struct drm_vmw_msg_arg
1236bf215546Sopenharmony_ci *
1237bf215546Sopenharmony_ci * @send: Pointer to user-space msg string (null terminated).
1238bf215546Sopenharmony_ci * @receive: Pointer to user-space receive buffer.
1239bf215546Sopenharmony_ci * @send_only: Boolean whether this is only sending or receiving too.
1240bf215546Sopenharmony_ci *
1241bf215546Sopenharmony_ci * Argument to the DRM_VMW_MSG ioctl.
1242bf215546Sopenharmony_ci */
1243bf215546Sopenharmony_cistruct drm_vmw_msg_arg {
1244bf215546Sopenharmony_ci	__u64 send;
1245bf215546Sopenharmony_ci	__u64 receive;
1246bf215546Sopenharmony_ci	__s32 send_only;
1247bf215546Sopenharmony_ci	__u32 receive_len;
1248bf215546Sopenharmony_ci};
1249bf215546Sopenharmony_ci
1250bf215546Sopenharmony_ci/**
1251bf215546Sopenharmony_ci * struct drm_vmw_mksstat_add_arg
1252bf215546Sopenharmony_ci *
1253bf215546Sopenharmony_ci * @stat: Pointer to user-space stat-counters array, page-aligned.
1254bf215546Sopenharmony_ci * @info: Pointer to user-space counter-infos array, page-aligned.
1255bf215546Sopenharmony_ci * @strs: Pointer to user-space stat strings, page-aligned.
1256bf215546Sopenharmony_ci * @stat_len: Length in bytes of stat-counters array.
1257bf215546Sopenharmony_ci * @info_len: Length in bytes of counter-infos array.
1258bf215546Sopenharmony_ci * @strs_len: Length in bytes of the stat strings, terminators included.
1259bf215546Sopenharmony_ci * @description: Pointer to instance descriptor string; will be truncated
1260bf215546Sopenharmony_ci *               to MKS_GUEST_STAT_INSTANCE_DESC_LENGTH chars.
1261bf215546Sopenharmony_ci * @id: Output identifier of the produced record; -1 if error.
1262bf215546Sopenharmony_ci *
1263bf215546Sopenharmony_ci * Argument to the DRM_VMW_MKSSTAT_ADD ioctl.
1264bf215546Sopenharmony_ci */
1265bf215546Sopenharmony_cistruct drm_vmw_mksstat_add_arg {
1266bf215546Sopenharmony_ci	__u64 stat;
1267bf215546Sopenharmony_ci	__u64 info;
1268bf215546Sopenharmony_ci	__u64 strs;
1269bf215546Sopenharmony_ci	__u64 stat_len;
1270bf215546Sopenharmony_ci	__u64 info_len;
1271bf215546Sopenharmony_ci	__u64 strs_len;
1272bf215546Sopenharmony_ci	__u64 description;
1273bf215546Sopenharmony_ci	__u64 id;
1274bf215546Sopenharmony_ci};
1275bf215546Sopenharmony_ci
1276bf215546Sopenharmony_ci/**
1277bf215546Sopenharmony_ci * struct drm_vmw_mksstat_remove_arg
1278bf215546Sopenharmony_ci *
1279bf215546Sopenharmony_ci * @id: Identifier of the record being disposed, originally obtained through
1280bf215546Sopenharmony_ci *      DRM_VMW_MKSSTAT_ADD ioctl.
1281bf215546Sopenharmony_ci *
1282bf215546Sopenharmony_ci * Argument to the DRM_VMW_MKSSTAT_REMOVE ioctl.
1283bf215546Sopenharmony_ci */
1284bf215546Sopenharmony_cistruct drm_vmw_mksstat_remove_arg {
1285bf215546Sopenharmony_ci	__u64 id;
1286bf215546Sopenharmony_ci};
1287bf215546Sopenharmony_ci
1288bf215546Sopenharmony_ci#if defined(__cplusplus)
1289bf215546Sopenharmony_ci}
1290bf215546Sopenharmony_ci#endif
1291bf215546Sopenharmony_ci
1292bf215546Sopenharmony_ci#endif
1293