162306a36Sopenharmony_ci/**************************************************************************
262306a36Sopenharmony_ci *
362306a36Sopenharmony_ci * Copyright © 2009-2022 VMware, Inc., Palo Alto, CA., USA
462306a36Sopenharmony_ci * All Rights Reserved.
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
762306a36Sopenharmony_ci * copy of this software and associated documentation files (the
862306a36Sopenharmony_ci * "Software"), to deal in the Software without restriction, including
962306a36Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish,
1062306a36Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to
1162306a36Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to
1262306a36Sopenharmony_ci * the following conditions:
1362306a36Sopenharmony_ci *
1462306a36Sopenharmony_ci * The above copyright notice and this permission notice (including the
1562306a36Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions
1662306a36Sopenharmony_ci * of the Software.
1762306a36Sopenharmony_ci *
1862306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1962306a36Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2062306a36Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
2162306a36Sopenharmony_ci * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
2262306a36Sopenharmony_ci * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
2362306a36Sopenharmony_ci * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
2462306a36Sopenharmony_ci * USE OR OTHER DEALINGS IN THE SOFTWARE.
2562306a36Sopenharmony_ci *
2662306a36Sopenharmony_ci **************************************************************************/
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci#ifndef __VMWGFX_DRM_H__
2962306a36Sopenharmony_ci#define __VMWGFX_DRM_H__
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci#include "drm.h"
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci#if defined(__cplusplus)
3462306a36Sopenharmony_ciextern "C" {
3562306a36Sopenharmony_ci#endif
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci#define DRM_VMW_MAX_SURFACE_FACES 6
3862306a36Sopenharmony_ci#define DRM_VMW_MAX_MIP_LEVELS 24
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci#define DRM_VMW_GET_PARAM            0
4262306a36Sopenharmony_ci#define DRM_VMW_ALLOC_DMABUF         1
4362306a36Sopenharmony_ci#define DRM_VMW_ALLOC_BO             1
4462306a36Sopenharmony_ci#define DRM_VMW_UNREF_DMABUF         2
4562306a36Sopenharmony_ci#define DRM_VMW_HANDLE_CLOSE         2
4662306a36Sopenharmony_ci#define DRM_VMW_CURSOR_BYPASS        3
4762306a36Sopenharmony_ci/* guarded by DRM_VMW_PARAM_NUM_STREAMS != 0*/
4862306a36Sopenharmony_ci#define DRM_VMW_CONTROL_STREAM       4
4962306a36Sopenharmony_ci#define DRM_VMW_CLAIM_STREAM         5
5062306a36Sopenharmony_ci#define DRM_VMW_UNREF_STREAM         6
5162306a36Sopenharmony_ci/* guarded by DRM_VMW_PARAM_3D == 1 */
5262306a36Sopenharmony_ci#define DRM_VMW_CREATE_CONTEXT       7
5362306a36Sopenharmony_ci#define DRM_VMW_UNREF_CONTEXT        8
5462306a36Sopenharmony_ci#define DRM_VMW_CREATE_SURFACE       9
5562306a36Sopenharmony_ci#define DRM_VMW_UNREF_SURFACE        10
5662306a36Sopenharmony_ci#define DRM_VMW_REF_SURFACE          11
5762306a36Sopenharmony_ci#define DRM_VMW_EXECBUF              12
5862306a36Sopenharmony_ci#define DRM_VMW_GET_3D_CAP           13
5962306a36Sopenharmony_ci#define DRM_VMW_FENCE_WAIT           14
6062306a36Sopenharmony_ci#define DRM_VMW_FENCE_SIGNALED       15
6162306a36Sopenharmony_ci#define DRM_VMW_FENCE_UNREF          16
6262306a36Sopenharmony_ci#define DRM_VMW_FENCE_EVENT          17
6362306a36Sopenharmony_ci#define DRM_VMW_PRESENT              18
6462306a36Sopenharmony_ci#define DRM_VMW_PRESENT_READBACK     19
6562306a36Sopenharmony_ci#define DRM_VMW_UPDATE_LAYOUT        20
6662306a36Sopenharmony_ci#define DRM_VMW_CREATE_SHADER        21
6762306a36Sopenharmony_ci#define DRM_VMW_UNREF_SHADER         22
6862306a36Sopenharmony_ci#define DRM_VMW_GB_SURFACE_CREATE    23
6962306a36Sopenharmony_ci#define DRM_VMW_GB_SURFACE_REF       24
7062306a36Sopenharmony_ci#define DRM_VMW_SYNCCPU              25
7162306a36Sopenharmony_ci#define DRM_VMW_CREATE_EXTENDED_CONTEXT 26
7262306a36Sopenharmony_ci#define DRM_VMW_GB_SURFACE_CREATE_EXT   27
7362306a36Sopenharmony_ci#define DRM_VMW_GB_SURFACE_REF_EXT      28
7462306a36Sopenharmony_ci#define DRM_VMW_MSG                     29
7562306a36Sopenharmony_ci#define DRM_VMW_MKSSTAT_RESET           30
7662306a36Sopenharmony_ci#define DRM_VMW_MKSSTAT_ADD             31
7762306a36Sopenharmony_ci#define DRM_VMW_MKSSTAT_REMOVE          32
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci/*************************************************************************/
8062306a36Sopenharmony_ci/**
8162306a36Sopenharmony_ci * DRM_VMW_GET_PARAM - get device information.
8262306a36Sopenharmony_ci *
8362306a36Sopenharmony_ci * DRM_VMW_PARAM_FIFO_OFFSET:
8462306a36Sopenharmony_ci * Offset to use to map the first page of the FIFO read-only.
8562306a36Sopenharmony_ci * The fifo is mapped using the mmap() system call on the drm device.
8662306a36Sopenharmony_ci *
8762306a36Sopenharmony_ci * DRM_VMW_PARAM_OVERLAY_IOCTL:
8862306a36Sopenharmony_ci * Does the driver support the overlay ioctl.
8962306a36Sopenharmony_ci *
9062306a36Sopenharmony_ci * DRM_VMW_PARAM_SM4_1
9162306a36Sopenharmony_ci * SM4_1 support is enabled.
9262306a36Sopenharmony_ci *
9362306a36Sopenharmony_ci * DRM_VMW_PARAM_SM5
9462306a36Sopenharmony_ci * SM5 support is enabled.
9562306a36Sopenharmony_ci *
9662306a36Sopenharmony_ci * DRM_VMW_PARAM_GL43
9762306a36Sopenharmony_ci * SM5.1+GL4.3 support is enabled.
9862306a36Sopenharmony_ci *
9962306a36Sopenharmony_ci * DRM_VMW_PARAM_DEVICE_ID
10062306a36Sopenharmony_ci * PCI ID of the underlying SVGA device.
10162306a36Sopenharmony_ci */
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci#define DRM_VMW_PARAM_NUM_STREAMS      0
10462306a36Sopenharmony_ci#define DRM_VMW_PARAM_NUM_FREE_STREAMS 1
10562306a36Sopenharmony_ci#define DRM_VMW_PARAM_3D               2
10662306a36Sopenharmony_ci#define DRM_VMW_PARAM_HW_CAPS          3
10762306a36Sopenharmony_ci#define DRM_VMW_PARAM_FIFO_CAPS        4
10862306a36Sopenharmony_ci#define DRM_VMW_PARAM_MAX_FB_SIZE      5
10962306a36Sopenharmony_ci#define DRM_VMW_PARAM_FIFO_HW_VERSION  6
11062306a36Sopenharmony_ci#define DRM_VMW_PARAM_MAX_SURF_MEMORY  7
11162306a36Sopenharmony_ci#define DRM_VMW_PARAM_3D_CAPS_SIZE     8
11262306a36Sopenharmony_ci#define DRM_VMW_PARAM_MAX_MOB_MEMORY   9
11362306a36Sopenharmony_ci#define DRM_VMW_PARAM_MAX_MOB_SIZE     10
11462306a36Sopenharmony_ci#define DRM_VMW_PARAM_SCREEN_TARGET    11
11562306a36Sopenharmony_ci#define DRM_VMW_PARAM_DX               12
11662306a36Sopenharmony_ci#define DRM_VMW_PARAM_HW_CAPS2         13
11762306a36Sopenharmony_ci#define DRM_VMW_PARAM_SM4_1            14
11862306a36Sopenharmony_ci#define DRM_VMW_PARAM_SM5              15
11962306a36Sopenharmony_ci#define DRM_VMW_PARAM_GL43             16
12062306a36Sopenharmony_ci#define DRM_VMW_PARAM_DEVICE_ID        17
12162306a36Sopenharmony_ci
12262306a36Sopenharmony_ci/**
12362306a36Sopenharmony_ci * enum drm_vmw_handle_type - handle type for ref ioctls
12462306a36Sopenharmony_ci *
12562306a36Sopenharmony_ci */
12662306a36Sopenharmony_cienum drm_vmw_handle_type {
12762306a36Sopenharmony_ci	DRM_VMW_HANDLE_LEGACY = 0,
12862306a36Sopenharmony_ci	DRM_VMW_HANDLE_PRIME = 1
12962306a36Sopenharmony_ci};
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ci/**
13262306a36Sopenharmony_ci * struct drm_vmw_getparam_arg
13362306a36Sopenharmony_ci *
13462306a36Sopenharmony_ci * @value: Returned value. //Out
13562306a36Sopenharmony_ci * @param: Parameter to query. //In.
13662306a36Sopenharmony_ci *
13762306a36Sopenharmony_ci * Argument to the DRM_VMW_GET_PARAM Ioctl.
13862306a36Sopenharmony_ci */
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_cistruct drm_vmw_getparam_arg {
14162306a36Sopenharmony_ci	__u64 value;
14262306a36Sopenharmony_ci	__u32 param;
14362306a36Sopenharmony_ci	__u32 pad64;
14462306a36Sopenharmony_ci};
14562306a36Sopenharmony_ci
14662306a36Sopenharmony_ci/*************************************************************************/
14762306a36Sopenharmony_ci/**
14862306a36Sopenharmony_ci * DRM_VMW_CREATE_CONTEXT - Create a host context.
14962306a36Sopenharmony_ci *
15062306a36Sopenharmony_ci * Allocates a device unique context id, and queues a create context command
15162306a36Sopenharmony_ci * for the host. Does not wait for host completion.
15262306a36Sopenharmony_ci */
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_ci/**
15562306a36Sopenharmony_ci * struct drm_vmw_context_arg
15662306a36Sopenharmony_ci *
15762306a36Sopenharmony_ci * @cid: Device unique context ID.
15862306a36Sopenharmony_ci *
15962306a36Sopenharmony_ci * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
16062306a36Sopenharmony_ci * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
16162306a36Sopenharmony_ci */
16262306a36Sopenharmony_ci
16362306a36Sopenharmony_cistruct drm_vmw_context_arg {
16462306a36Sopenharmony_ci	__s32 cid;
16562306a36Sopenharmony_ci	__u32 pad64;
16662306a36Sopenharmony_ci};
16762306a36Sopenharmony_ci
16862306a36Sopenharmony_ci/*************************************************************************/
16962306a36Sopenharmony_ci/**
17062306a36Sopenharmony_ci * DRM_VMW_UNREF_CONTEXT - Create a host context.
17162306a36Sopenharmony_ci *
17262306a36Sopenharmony_ci * Frees a global context id, and queues a destroy host command for the host.
17362306a36Sopenharmony_ci * Does not wait for host completion. The context ID can be used directly
17462306a36Sopenharmony_ci * in the command stream and shows up as the same context ID on the host.
17562306a36Sopenharmony_ci */
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_ci/*************************************************************************/
17862306a36Sopenharmony_ci/**
17962306a36Sopenharmony_ci * DRM_VMW_CREATE_SURFACE - Create a host suface.
18062306a36Sopenharmony_ci *
18162306a36Sopenharmony_ci * Allocates a device unique surface id, and queues a create surface command
18262306a36Sopenharmony_ci * for the host. Does not wait for host completion. The surface ID can be
18362306a36Sopenharmony_ci * used directly in the command stream and shows up as the same surface
18462306a36Sopenharmony_ci * ID on the host.
18562306a36Sopenharmony_ci */
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_ci/**
18862306a36Sopenharmony_ci * struct drm_wmv_surface_create_req
18962306a36Sopenharmony_ci *
19062306a36Sopenharmony_ci * @flags: Surface flags as understood by the host.
19162306a36Sopenharmony_ci * @format: Surface format as understood by the host.
19262306a36Sopenharmony_ci * @mip_levels: Number of mip levels for each face.
19362306a36Sopenharmony_ci * An unused face should have 0 encoded.
19462306a36Sopenharmony_ci * @size_addr: Address of a user-space array of sruct drm_vmw_size
19562306a36Sopenharmony_ci * cast to an __u64 for 32-64 bit compatibility.
19662306a36Sopenharmony_ci * The size of the array should equal the total number of mipmap levels.
19762306a36Sopenharmony_ci * @shareable: Boolean whether other clients (as identified by file descriptors)
19862306a36Sopenharmony_ci * may reference this surface.
19962306a36Sopenharmony_ci * @scanout: Boolean whether the surface is intended to be used as a
20062306a36Sopenharmony_ci * scanout.
20162306a36Sopenharmony_ci *
20262306a36Sopenharmony_ci * Input data to the DRM_VMW_CREATE_SURFACE Ioctl.
20362306a36Sopenharmony_ci * Output data from the DRM_VMW_REF_SURFACE Ioctl.
20462306a36Sopenharmony_ci */
20562306a36Sopenharmony_ci
20662306a36Sopenharmony_cistruct drm_vmw_surface_create_req {
20762306a36Sopenharmony_ci	__u32 flags;
20862306a36Sopenharmony_ci	__u32 format;
20962306a36Sopenharmony_ci	__u32 mip_levels[DRM_VMW_MAX_SURFACE_FACES];
21062306a36Sopenharmony_ci	__u64 size_addr;
21162306a36Sopenharmony_ci	__s32 shareable;
21262306a36Sopenharmony_ci	__s32 scanout;
21362306a36Sopenharmony_ci};
21462306a36Sopenharmony_ci
21562306a36Sopenharmony_ci/**
21662306a36Sopenharmony_ci * struct drm_wmv_surface_arg
21762306a36Sopenharmony_ci *
21862306a36Sopenharmony_ci * @sid: Surface id of created surface or surface to destroy or reference.
21962306a36Sopenharmony_ci * @handle_type: Handle type for DRM_VMW_REF_SURFACE Ioctl.
22062306a36Sopenharmony_ci *
22162306a36Sopenharmony_ci * Output data from the DRM_VMW_CREATE_SURFACE Ioctl.
22262306a36Sopenharmony_ci * Input argument to the DRM_VMW_UNREF_SURFACE Ioctl.
22362306a36Sopenharmony_ci * Input argument to the DRM_VMW_REF_SURFACE Ioctl.
22462306a36Sopenharmony_ci */
22562306a36Sopenharmony_ci
22662306a36Sopenharmony_cistruct drm_vmw_surface_arg {
22762306a36Sopenharmony_ci	__s32 sid;
22862306a36Sopenharmony_ci	enum drm_vmw_handle_type handle_type;
22962306a36Sopenharmony_ci};
23062306a36Sopenharmony_ci
23162306a36Sopenharmony_ci/**
23262306a36Sopenharmony_ci * struct drm_vmw_size ioctl.
23362306a36Sopenharmony_ci *
23462306a36Sopenharmony_ci * @width - mip level width
23562306a36Sopenharmony_ci * @height - mip level height
23662306a36Sopenharmony_ci * @depth - mip level depth
23762306a36Sopenharmony_ci *
23862306a36Sopenharmony_ci * Description of a mip level.
23962306a36Sopenharmony_ci * Input data to the DRM_WMW_CREATE_SURFACE Ioctl.
24062306a36Sopenharmony_ci */
24162306a36Sopenharmony_ci
24262306a36Sopenharmony_cistruct drm_vmw_size {
24362306a36Sopenharmony_ci	__u32 width;
24462306a36Sopenharmony_ci	__u32 height;
24562306a36Sopenharmony_ci	__u32 depth;
24662306a36Sopenharmony_ci	__u32 pad64;
24762306a36Sopenharmony_ci};
24862306a36Sopenharmony_ci
24962306a36Sopenharmony_ci/**
25062306a36Sopenharmony_ci * union drm_vmw_surface_create_arg
25162306a36Sopenharmony_ci *
25262306a36Sopenharmony_ci * @rep: Output data as described above.
25362306a36Sopenharmony_ci * @req: Input data as described above.
25462306a36Sopenharmony_ci *
25562306a36Sopenharmony_ci * Argument to the DRM_VMW_CREATE_SURFACE Ioctl.
25662306a36Sopenharmony_ci */
25762306a36Sopenharmony_ci
25862306a36Sopenharmony_ciunion drm_vmw_surface_create_arg {
25962306a36Sopenharmony_ci	struct drm_vmw_surface_arg rep;
26062306a36Sopenharmony_ci	struct drm_vmw_surface_create_req req;
26162306a36Sopenharmony_ci};
26262306a36Sopenharmony_ci
26362306a36Sopenharmony_ci/*************************************************************************/
26462306a36Sopenharmony_ci/**
26562306a36Sopenharmony_ci * DRM_VMW_REF_SURFACE - Reference a host surface.
26662306a36Sopenharmony_ci *
26762306a36Sopenharmony_ci * Puts a reference on a host surface with a give sid, as previously
26862306a36Sopenharmony_ci * returned by the DRM_VMW_CREATE_SURFACE ioctl.
26962306a36Sopenharmony_ci * A reference will make sure the surface isn't destroyed while we hold
27062306a36Sopenharmony_ci * it and will allow the calling client to use the surface ID in the command
27162306a36Sopenharmony_ci * stream.
27262306a36Sopenharmony_ci *
27362306a36Sopenharmony_ci * On successful return, the Ioctl returns the surface information given
27462306a36Sopenharmony_ci * in the DRM_VMW_CREATE_SURFACE ioctl.
27562306a36Sopenharmony_ci */
27662306a36Sopenharmony_ci
27762306a36Sopenharmony_ci/**
27862306a36Sopenharmony_ci * union drm_vmw_surface_reference_arg
27962306a36Sopenharmony_ci *
28062306a36Sopenharmony_ci * @rep: Output data as described above.
28162306a36Sopenharmony_ci * @req: Input data as described above.
28262306a36Sopenharmony_ci *
28362306a36Sopenharmony_ci * Argument to the DRM_VMW_REF_SURFACE Ioctl.
28462306a36Sopenharmony_ci */
28562306a36Sopenharmony_ci
28662306a36Sopenharmony_ciunion drm_vmw_surface_reference_arg {
28762306a36Sopenharmony_ci	struct drm_vmw_surface_create_req rep;
28862306a36Sopenharmony_ci	struct drm_vmw_surface_arg req;
28962306a36Sopenharmony_ci};
29062306a36Sopenharmony_ci
29162306a36Sopenharmony_ci/*************************************************************************/
29262306a36Sopenharmony_ci/**
29362306a36Sopenharmony_ci * DRM_VMW_UNREF_SURFACE - Unreference a host surface.
29462306a36Sopenharmony_ci *
29562306a36Sopenharmony_ci * Clear a reference previously put on a host surface.
29662306a36Sopenharmony_ci * When all references are gone, including the one implicitly placed
29762306a36Sopenharmony_ci * on creation,
29862306a36Sopenharmony_ci * a destroy surface command will be queued for the host.
29962306a36Sopenharmony_ci * Does not wait for completion.
30062306a36Sopenharmony_ci */
30162306a36Sopenharmony_ci
30262306a36Sopenharmony_ci/*************************************************************************/
30362306a36Sopenharmony_ci/**
30462306a36Sopenharmony_ci * DRM_VMW_EXECBUF
30562306a36Sopenharmony_ci *
30662306a36Sopenharmony_ci * Submit a command buffer for execution on the host, and return a
30762306a36Sopenharmony_ci * fence seqno that when signaled, indicates that the command buffer has
30862306a36Sopenharmony_ci * executed.
30962306a36Sopenharmony_ci */
31062306a36Sopenharmony_ci
31162306a36Sopenharmony_ci/**
31262306a36Sopenharmony_ci * struct drm_vmw_execbuf_arg
31362306a36Sopenharmony_ci *
31462306a36Sopenharmony_ci * @commands: User-space address of a command buffer cast to an __u64.
31562306a36Sopenharmony_ci * @command-size: Size in bytes of the command buffer.
31662306a36Sopenharmony_ci * @throttle-us: Sleep until software is less than @throttle_us
31762306a36Sopenharmony_ci * microseconds ahead of hardware. The driver may round this value
31862306a36Sopenharmony_ci * to the nearest kernel tick.
31962306a36Sopenharmony_ci * @fence_rep: User-space address of a struct drm_vmw_fence_rep cast to an
32062306a36Sopenharmony_ci * __u64.
32162306a36Sopenharmony_ci * @version: Allows expanding the execbuf ioctl parameters without breaking
32262306a36Sopenharmony_ci * backwards compatibility, since user-space will always tell the kernel
32362306a36Sopenharmony_ci * which version it uses.
32462306a36Sopenharmony_ci * @flags: Execbuf flags.
32562306a36Sopenharmony_ci * @imported_fence_fd:  FD for a fence imported from another device
32662306a36Sopenharmony_ci *
32762306a36Sopenharmony_ci * Argument to the DRM_VMW_EXECBUF Ioctl.
32862306a36Sopenharmony_ci */
32962306a36Sopenharmony_ci
33062306a36Sopenharmony_ci#define DRM_VMW_EXECBUF_VERSION 2
33162306a36Sopenharmony_ci
33262306a36Sopenharmony_ci#define DRM_VMW_EXECBUF_FLAG_IMPORT_FENCE_FD (1 << 0)
33362306a36Sopenharmony_ci#define DRM_VMW_EXECBUF_FLAG_EXPORT_FENCE_FD (1 << 1)
33462306a36Sopenharmony_ci
33562306a36Sopenharmony_cistruct drm_vmw_execbuf_arg {
33662306a36Sopenharmony_ci	__u64 commands;
33762306a36Sopenharmony_ci	__u32 command_size;
33862306a36Sopenharmony_ci	__u32 throttle_us;
33962306a36Sopenharmony_ci	__u64 fence_rep;
34062306a36Sopenharmony_ci	__u32 version;
34162306a36Sopenharmony_ci	__u32 flags;
34262306a36Sopenharmony_ci	__u32 context_handle;
34362306a36Sopenharmony_ci	__s32 imported_fence_fd;
34462306a36Sopenharmony_ci};
34562306a36Sopenharmony_ci
34662306a36Sopenharmony_ci/**
34762306a36Sopenharmony_ci * struct drm_vmw_fence_rep
34862306a36Sopenharmony_ci *
34962306a36Sopenharmony_ci * @handle: Fence object handle for fence associated with a command submission.
35062306a36Sopenharmony_ci * @mask: Fence flags relevant for this fence object.
35162306a36Sopenharmony_ci * @seqno: Fence sequence number in fifo. A fence object with a lower
35262306a36Sopenharmony_ci * seqno will signal the EXEC flag before a fence object with a higher
35362306a36Sopenharmony_ci * seqno. This can be used by user-space to avoid kernel calls to determine
35462306a36Sopenharmony_ci * whether a fence has signaled the EXEC flag. Note that @seqno will
35562306a36Sopenharmony_ci * wrap at 32-bit.
35662306a36Sopenharmony_ci * @passed_seqno: The highest seqno number processed by the hardware
35762306a36Sopenharmony_ci * so far. This can be used to mark user-space fence objects as signaled, and
35862306a36Sopenharmony_ci * to determine whether a fence seqno might be stale.
35962306a36Sopenharmony_ci * @fd: FD associated with the fence, -1 if not exported
36062306a36Sopenharmony_ci * @error: This member should've been set to -EFAULT on submission.
36162306a36Sopenharmony_ci * The following actions should be take on completion:
36262306a36Sopenharmony_ci * error == -EFAULT: Fence communication failed. The host is synchronized.
36362306a36Sopenharmony_ci * Use the last fence id read from the FIFO fence register.
36462306a36Sopenharmony_ci * error != 0 && error != -EFAULT:
36562306a36Sopenharmony_ci * Fence submission failed. The host is synchronized. Use the fence_seq member.
36662306a36Sopenharmony_ci * error == 0: All is OK, The host may not be synchronized.
36762306a36Sopenharmony_ci * Use the fence_seq member.
36862306a36Sopenharmony_ci *
36962306a36Sopenharmony_ci * Input / Output data to the DRM_VMW_EXECBUF Ioctl.
37062306a36Sopenharmony_ci */
37162306a36Sopenharmony_ci
37262306a36Sopenharmony_cistruct drm_vmw_fence_rep {
37362306a36Sopenharmony_ci	__u32 handle;
37462306a36Sopenharmony_ci	__u32 mask;
37562306a36Sopenharmony_ci	__u32 seqno;
37662306a36Sopenharmony_ci	__u32 passed_seqno;
37762306a36Sopenharmony_ci	__s32 fd;
37862306a36Sopenharmony_ci	__s32 error;
37962306a36Sopenharmony_ci};
38062306a36Sopenharmony_ci
38162306a36Sopenharmony_ci/*************************************************************************/
38262306a36Sopenharmony_ci/**
38362306a36Sopenharmony_ci * DRM_VMW_ALLOC_BO
38462306a36Sopenharmony_ci *
38562306a36Sopenharmony_ci * Allocate a buffer object that is visible also to the host.
38662306a36Sopenharmony_ci * NOTE: The buffer is
38762306a36Sopenharmony_ci * identified by a handle and an offset, which are private to the guest, but
38862306a36Sopenharmony_ci * useable in the command stream. The guest kernel may translate these
38962306a36Sopenharmony_ci * and patch up the command stream accordingly. In the future, the offset may
39062306a36Sopenharmony_ci * be zero at all times, or it may disappear from the interface before it is
39162306a36Sopenharmony_ci * fixed.
39262306a36Sopenharmony_ci *
39362306a36Sopenharmony_ci * The buffer object may stay user-space mapped in the guest at all times,
39462306a36Sopenharmony_ci * and is thus suitable for sub-allocation.
39562306a36Sopenharmony_ci *
39662306a36Sopenharmony_ci * Buffer objects are mapped using the mmap() syscall on the drm device.
39762306a36Sopenharmony_ci */
39862306a36Sopenharmony_ci
39962306a36Sopenharmony_ci/**
40062306a36Sopenharmony_ci * struct drm_vmw_alloc_bo_req
40162306a36Sopenharmony_ci *
40262306a36Sopenharmony_ci * @size: Required minimum size of the buffer.
40362306a36Sopenharmony_ci *
40462306a36Sopenharmony_ci * Input data to the DRM_VMW_ALLOC_BO Ioctl.
40562306a36Sopenharmony_ci */
40662306a36Sopenharmony_ci
40762306a36Sopenharmony_cistruct drm_vmw_alloc_bo_req {
40862306a36Sopenharmony_ci	__u32 size;
40962306a36Sopenharmony_ci	__u32 pad64;
41062306a36Sopenharmony_ci};
41162306a36Sopenharmony_ci#define drm_vmw_alloc_dmabuf_req drm_vmw_alloc_bo_req
41262306a36Sopenharmony_ci
41362306a36Sopenharmony_ci/**
41462306a36Sopenharmony_ci * struct drm_vmw_bo_rep
41562306a36Sopenharmony_ci *
41662306a36Sopenharmony_ci * @map_handle: Offset to use in the mmap() call used to map the buffer.
41762306a36Sopenharmony_ci * @handle: Handle unique to this buffer. Used for unreferencing.
41862306a36Sopenharmony_ci * @cur_gmr_id: GMR id to use in the command stream when this buffer is
41962306a36Sopenharmony_ci * referenced. See not above.
42062306a36Sopenharmony_ci * @cur_gmr_offset: Offset to use in the command stream when this buffer is
42162306a36Sopenharmony_ci * referenced. See note above.
42262306a36Sopenharmony_ci *
42362306a36Sopenharmony_ci * Output data from the DRM_VMW_ALLOC_BO Ioctl.
42462306a36Sopenharmony_ci */
42562306a36Sopenharmony_ci
42662306a36Sopenharmony_cistruct drm_vmw_bo_rep {
42762306a36Sopenharmony_ci	__u64 map_handle;
42862306a36Sopenharmony_ci	__u32 handle;
42962306a36Sopenharmony_ci	__u32 cur_gmr_id;
43062306a36Sopenharmony_ci	__u32 cur_gmr_offset;
43162306a36Sopenharmony_ci	__u32 pad64;
43262306a36Sopenharmony_ci};
43362306a36Sopenharmony_ci#define drm_vmw_dmabuf_rep drm_vmw_bo_rep
43462306a36Sopenharmony_ci
43562306a36Sopenharmony_ci/**
43662306a36Sopenharmony_ci * union drm_vmw_alloc_bo_arg
43762306a36Sopenharmony_ci *
43862306a36Sopenharmony_ci * @req: Input data as described above.
43962306a36Sopenharmony_ci * @rep: Output data as described above.
44062306a36Sopenharmony_ci *
44162306a36Sopenharmony_ci * Argument to the DRM_VMW_ALLOC_BO Ioctl.
44262306a36Sopenharmony_ci */
44362306a36Sopenharmony_ci
44462306a36Sopenharmony_ciunion drm_vmw_alloc_bo_arg {
44562306a36Sopenharmony_ci	struct drm_vmw_alloc_bo_req req;
44662306a36Sopenharmony_ci	struct drm_vmw_bo_rep rep;
44762306a36Sopenharmony_ci};
44862306a36Sopenharmony_ci#define drm_vmw_alloc_dmabuf_arg drm_vmw_alloc_bo_arg
44962306a36Sopenharmony_ci
45062306a36Sopenharmony_ci/*************************************************************************/
45162306a36Sopenharmony_ci/**
45262306a36Sopenharmony_ci * DRM_VMW_CONTROL_STREAM - Control overlays, aka streams.
45362306a36Sopenharmony_ci *
45462306a36Sopenharmony_ci * This IOCTL controls the overlay units of the svga device.
45562306a36Sopenharmony_ci * The SVGA overlay units does not work like regular hardware units in
45662306a36Sopenharmony_ci * that they do not automaticaly read back the contents of the given dma
45762306a36Sopenharmony_ci * buffer. But instead only read back for each call to this ioctl, and
45862306a36Sopenharmony_ci * at any point between this call being made and a following call that
45962306a36Sopenharmony_ci * either changes the buffer or disables the stream.
46062306a36Sopenharmony_ci */
46162306a36Sopenharmony_ci
46262306a36Sopenharmony_ci/**
46362306a36Sopenharmony_ci * struct drm_vmw_rect
46462306a36Sopenharmony_ci *
46562306a36Sopenharmony_ci * Defines a rectangle. Used in the overlay ioctl to define
46662306a36Sopenharmony_ci * source and destination rectangle.
46762306a36Sopenharmony_ci */
46862306a36Sopenharmony_ci
46962306a36Sopenharmony_cistruct drm_vmw_rect {
47062306a36Sopenharmony_ci	__s32 x;
47162306a36Sopenharmony_ci	__s32 y;
47262306a36Sopenharmony_ci	__u32 w;
47362306a36Sopenharmony_ci	__u32 h;
47462306a36Sopenharmony_ci};
47562306a36Sopenharmony_ci
47662306a36Sopenharmony_ci/**
47762306a36Sopenharmony_ci * struct drm_vmw_control_stream_arg
47862306a36Sopenharmony_ci *
47962306a36Sopenharmony_ci * @stream_id: Stearm to control
48062306a36Sopenharmony_ci * @enabled: If false all following arguments are ignored.
48162306a36Sopenharmony_ci * @handle: Handle to buffer for getting data from.
48262306a36Sopenharmony_ci * @format: Format of the overlay as understood by the host.
48362306a36Sopenharmony_ci * @width: Width of the overlay.
48462306a36Sopenharmony_ci * @height: Height of the overlay.
48562306a36Sopenharmony_ci * @size: Size of the overlay in bytes.
48662306a36Sopenharmony_ci * @pitch: Array of pitches, the two last are only used for YUV12 formats.
48762306a36Sopenharmony_ci * @offset: Offset from start of dma buffer to overlay.
48862306a36Sopenharmony_ci * @src: Source rect, must be within the defined area above.
48962306a36Sopenharmony_ci * @dst: Destination rect, x and y may be negative.
49062306a36Sopenharmony_ci *
49162306a36Sopenharmony_ci * Argument to the DRM_VMW_CONTROL_STREAM Ioctl.
49262306a36Sopenharmony_ci */
49362306a36Sopenharmony_ci
49462306a36Sopenharmony_cistruct drm_vmw_control_stream_arg {
49562306a36Sopenharmony_ci	__u32 stream_id;
49662306a36Sopenharmony_ci	__u32 enabled;
49762306a36Sopenharmony_ci
49862306a36Sopenharmony_ci	__u32 flags;
49962306a36Sopenharmony_ci	__u32 color_key;
50062306a36Sopenharmony_ci
50162306a36Sopenharmony_ci	__u32 handle;
50262306a36Sopenharmony_ci	__u32 offset;
50362306a36Sopenharmony_ci	__s32 format;
50462306a36Sopenharmony_ci	__u32 size;
50562306a36Sopenharmony_ci	__u32 width;
50662306a36Sopenharmony_ci	__u32 height;
50762306a36Sopenharmony_ci	__u32 pitch[3];
50862306a36Sopenharmony_ci
50962306a36Sopenharmony_ci	__u32 pad64;
51062306a36Sopenharmony_ci	struct drm_vmw_rect src;
51162306a36Sopenharmony_ci	struct drm_vmw_rect dst;
51262306a36Sopenharmony_ci};
51362306a36Sopenharmony_ci
51462306a36Sopenharmony_ci/*************************************************************************/
51562306a36Sopenharmony_ci/**
51662306a36Sopenharmony_ci * DRM_VMW_CURSOR_BYPASS - Give extra information about cursor bypass.
51762306a36Sopenharmony_ci *
51862306a36Sopenharmony_ci */
51962306a36Sopenharmony_ci
52062306a36Sopenharmony_ci#define DRM_VMW_CURSOR_BYPASS_ALL    (1 << 0)
52162306a36Sopenharmony_ci#define DRM_VMW_CURSOR_BYPASS_FLAGS       (1)
52262306a36Sopenharmony_ci
52362306a36Sopenharmony_ci/**
52462306a36Sopenharmony_ci * struct drm_vmw_cursor_bypass_arg
52562306a36Sopenharmony_ci *
52662306a36Sopenharmony_ci * @flags: Flags.
52762306a36Sopenharmony_ci * @crtc_id: Crtc id, only used if DMR_CURSOR_BYPASS_ALL isn't passed.
52862306a36Sopenharmony_ci * @xpos: X position of cursor.
52962306a36Sopenharmony_ci * @ypos: Y position of cursor.
53062306a36Sopenharmony_ci * @xhot: X hotspot.
53162306a36Sopenharmony_ci * @yhot: Y hotspot.
53262306a36Sopenharmony_ci *
53362306a36Sopenharmony_ci * Argument to the DRM_VMW_CURSOR_BYPASS Ioctl.
53462306a36Sopenharmony_ci */
53562306a36Sopenharmony_ci
53662306a36Sopenharmony_cistruct drm_vmw_cursor_bypass_arg {
53762306a36Sopenharmony_ci	__u32 flags;
53862306a36Sopenharmony_ci	__u32 crtc_id;
53962306a36Sopenharmony_ci	__s32 xpos;
54062306a36Sopenharmony_ci	__s32 ypos;
54162306a36Sopenharmony_ci	__s32 xhot;
54262306a36Sopenharmony_ci	__s32 yhot;
54362306a36Sopenharmony_ci};
54462306a36Sopenharmony_ci
54562306a36Sopenharmony_ci/*************************************************************************/
54662306a36Sopenharmony_ci/**
54762306a36Sopenharmony_ci * DRM_VMW_CLAIM_STREAM - Claim a single stream.
54862306a36Sopenharmony_ci */
54962306a36Sopenharmony_ci
55062306a36Sopenharmony_ci/**
55162306a36Sopenharmony_ci * struct drm_vmw_context_arg
55262306a36Sopenharmony_ci *
55362306a36Sopenharmony_ci * @stream_id: Device unique context ID.
55462306a36Sopenharmony_ci *
55562306a36Sopenharmony_ci * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
55662306a36Sopenharmony_ci * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
55762306a36Sopenharmony_ci */
55862306a36Sopenharmony_ci
55962306a36Sopenharmony_cistruct drm_vmw_stream_arg {
56062306a36Sopenharmony_ci	__u32 stream_id;
56162306a36Sopenharmony_ci	__u32 pad64;
56262306a36Sopenharmony_ci};
56362306a36Sopenharmony_ci
56462306a36Sopenharmony_ci/*************************************************************************/
56562306a36Sopenharmony_ci/**
56662306a36Sopenharmony_ci * DRM_VMW_UNREF_STREAM - Unclaim a stream.
56762306a36Sopenharmony_ci *
56862306a36Sopenharmony_ci * Return a single stream that was claimed by this process. Also makes
56962306a36Sopenharmony_ci * sure that the stream has been stopped.
57062306a36Sopenharmony_ci */
57162306a36Sopenharmony_ci
57262306a36Sopenharmony_ci/*************************************************************************/
57362306a36Sopenharmony_ci/**
57462306a36Sopenharmony_ci * DRM_VMW_GET_3D_CAP
57562306a36Sopenharmony_ci *
57662306a36Sopenharmony_ci * Read 3D capabilities from the FIFO
57762306a36Sopenharmony_ci *
57862306a36Sopenharmony_ci */
57962306a36Sopenharmony_ci
58062306a36Sopenharmony_ci/**
58162306a36Sopenharmony_ci * struct drm_vmw_get_3d_cap_arg
58262306a36Sopenharmony_ci *
58362306a36Sopenharmony_ci * @buffer: Pointer to a buffer for capability data, cast to an __u64
58462306a36Sopenharmony_ci * @size: Max size to copy
58562306a36Sopenharmony_ci *
58662306a36Sopenharmony_ci * Input argument to the DRM_VMW_GET_3D_CAP_IOCTL
58762306a36Sopenharmony_ci * ioctls.
58862306a36Sopenharmony_ci */
58962306a36Sopenharmony_ci
59062306a36Sopenharmony_cistruct drm_vmw_get_3d_cap_arg {
59162306a36Sopenharmony_ci	__u64 buffer;
59262306a36Sopenharmony_ci	__u32 max_size;
59362306a36Sopenharmony_ci	__u32 pad64;
59462306a36Sopenharmony_ci};
59562306a36Sopenharmony_ci
59662306a36Sopenharmony_ci/*************************************************************************/
59762306a36Sopenharmony_ci/**
59862306a36Sopenharmony_ci * DRM_VMW_FENCE_WAIT
59962306a36Sopenharmony_ci *
60062306a36Sopenharmony_ci * Waits for a fence object to signal. The wait is interruptible, so that
60162306a36Sopenharmony_ci * signals may be delivered during the interrupt. The wait may timeout,
60262306a36Sopenharmony_ci * in which case the calls returns -EBUSY. If the wait is restarted,
60362306a36Sopenharmony_ci * that is restarting without resetting @cookie_valid to zero,
60462306a36Sopenharmony_ci * the timeout is computed from the first call.
60562306a36Sopenharmony_ci *
60662306a36Sopenharmony_ci * The flags argument to the DRM_VMW_FENCE_WAIT ioctl indicates what to wait
60762306a36Sopenharmony_ci * on:
60862306a36Sopenharmony_ci * DRM_VMW_FENCE_FLAG_EXEC: All commands ahead of the fence in the command
60962306a36Sopenharmony_ci * stream
61062306a36Sopenharmony_ci * have executed.
61162306a36Sopenharmony_ci * DRM_VMW_FENCE_FLAG_QUERY: All query results resulting from query finish
61262306a36Sopenharmony_ci * commands
61362306a36Sopenharmony_ci * in the buffer given to the EXECBUF ioctl returning the fence object handle
61462306a36Sopenharmony_ci * are available to user-space.
61562306a36Sopenharmony_ci *
61662306a36Sopenharmony_ci * DRM_VMW_WAIT_OPTION_UNREF: If this wait option is given, and the
61762306a36Sopenharmony_ci * fenc wait ioctl returns 0, the fence object has been unreferenced after
61862306a36Sopenharmony_ci * the wait.
61962306a36Sopenharmony_ci */
62062306a36Sopenharmony_ci
62162306a36Sopenharmony_ci#define DRM_VMW_FENCE_FLAG_EXEC   (1 << 0)
62262306a36Sopenharmony_ci#define DRM_VMW_FENCE_FLAG_QUERY  (1 << 1)
62362306a36Sopenharmony_ci
62462306a36Sopenharmony_ci#define DRM_VMW_WAIT_OPTION_UNREF (1 << 0)
62562306a36Sopenharmony_ci
62662306a36Sopenharmony_ci/**
62762306a36Sopenharmony_ci * struct drm_vmw_fence_wait_arg
62862306a36Sopenharmony_ci *
62962306a36Sopenharmony_ci * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
63062306a36Sopenharmony_ci * @cookie_valid: Must be reset to 0 on first call. Left alone on restart.
63162306a36Sopenharmony_ci * @kernel_cookie: Set to 0 on first call. Left alone on restart.
63262306a36Sopenharmony_ci * @timeout_us: Wait timeout in microseconds. 0 for indefinite timeout.
63362306a36Sopenharmony_ci * @lazy: Set to 1 if timing is not critical. Allow more than a kernel tick
63462306a36Sopenharmony_ci * before returning.
63562306a36Sopenharmony_ci * @flags: Fence flags to wait on.
63662306a36Sopenharmony_ci * @wait_options: Options that control the behaviour of the wait ioctl.
63762306a36Sopenharmony_ci *
63862306a36Sopenharmony_ci * Input argument to the DRM_VMW_FENCE_WAIT ioctl.
63962306a36Sopenharmony_ci */
64062306a36Sopenharmony_ci
64162306a36Sopenharmony_cistruct drm_vmw_fence_wait_arg {
64262306a36Sopenharmony_ci	__u32 handle;
64362306a36Sopenharmony_ci	__s32  cookie_valid;
64462306a36Sopenharmony_ci	__u64 kernel_cookie;
64562306a36Sopenharmony_ci	__u64 timeout_us;
64662306a36Sopenharmony_ci	__s32 lazy;
64762306a36Sopenharmony_ci	__s32 flags;
64862306a36Sopenharmony_ci	__s32 wait_options;
64962306a36Sopenharmony_ci	__s32 pad64;
65062306a36Sopenharmony_ci};
65162306a36Sopenharmony_ci
65262306a36Sopenharmony_ci/*************************************************************************/
65362306a36Sopenharmony_ci/**
65462306a36Sopenharmony_ci * DRM_VMW_FENCE_SIGNALED
65562306a36Sopenharmony_ci *
65662306a36Sopenharmony_ci * Checks if a fence object is signaled..
65762306a36Sopenharmony_ci */
65862306a36Sopenharmony_ci
65962306a36Sopenharmony_ci/**
66062306a36Sopenharmony_ci * struct drm_vmw_fence_signaled_arg
66162306a36Sopenharmony_ci *
66262306a36Sopenharmony_ci * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
66362306a36Sopenharmony_ci * @flags: Fence object flags input to DRM_VMW_FENCE_SIGNALED ioctl
66462306a36Sopenharmony_ci * @signaled: Out: Flags signaled.
66562306a36Sopenharmony_ci * @sequence: Out: Highest sequence passed so far. Can be used to signal the
66662306a36Sopenharmony_ci * EXEC flag of user-space fence objects.
66762306a36Sopenharmony_ci *
66862306a36Sopenharmony_ci * Input/Output argument to the DRM_VMW_FENCE_SIGNALED and DRM_VMW_FENCE_UNREF
66962306a36Sopenharmony_ci * ioctls.
67062306a36Sopenharmony_ci */
67162306a36Sopenharmony_ci
67262306a36Sopenharmony_cistruct drm_vmw_fence_signaled_arg {
67362306a36Sopenharmony_ci	 __u32 handle;
67462306a36Sopenharmony_ci	 __u32 flags;
67562306a36Sopenharmony_ci	 __s32 signaled;
67662306a36Sopenharmony_ci	 __u32 passed_seqno;
67762306a36Sopenharmony_ci	 __u32 signaled_flags;
67862306a36Sopenharmony_ci	 __u32 pad64;
67962306a36Sopenharmony_ci};
68062306a36Sopenharmony_ci
68162306a36Sopenharmony_ci/*************************************************************************/
68262306a36Sopenharmony_ci/**
68362306a36Sopenharmony_ci * DRM_VMW_FENCE_UNREF
68462306a36Sopenharmony_ci *
68562306a36Sopenharmony_ci * Unreferences a fence object, and causes it to be destroyed if there are no
68662306a36Sopenharmony_ci * other references to it.
68762306a36Sopenharmony_ci *
68862306a36Sopenharmony_ci */
68962306a36Sopenharmony_ci
69062306a36Sopenharmony_ci/**
69162306a36Sopenharmony_ci * struct drm_vmw_fence_arg
69262306a36Sopenharmony_ci *
69362306a36Sopenharmony_ci * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
69462306a36Sopenharmony_ci *
69562306a36Sopenharmony_ci * Input/Output argument to the DRM_VMW_FENCE_UNREF ioctl..
69662306a36Sopenharmony_ci */
69762306a36Sopenharmony_ci
69862306a36Sopenharmony_cistruct drm_vmw_fence_arg {
69962306a36Sopenharmony_ci	 __u32 handle;
70062306a36Sopenharmony_ci	 __u32 pad64;
70162306a36Sopenharmony_ci};
70262306a36Sopenharmony_ci
70362306a36Sopenharmony_ci
70462306a36Sopenharmony_ci/*************************************************************************/
70562306a36Sopenharmony_ci/**
70662306a36Sopenharmony_ci * DRM_VMW_FENCE_EVENT
70762306a36Sopenharmony_ci *
70862306a36Sopenharmony_ci * Queues an event on a fence to be delivered on the drm character device
70962306a36Sopenharmony_ci * when the fence has signaled the DRM_VMW_FENCE_FLAG_EXEC flag.
71062306a36Sopenharmony_ci * Optionally the approximate time when the fence signaled is
71162306a36Sopenharmony_ci * given by the event.
71262306a36Sopenharmony_ci */
71362306a36Sopenharmony_ci
71462306a36Sopenharmony_ci/*
71562306a36Sopenharmony_ci * The event type
71662306a36Sopenharmony_ci */
71762306a36Sopenharmony_ci#define DRM_VMW_EVENT_FENCE_SIGNALED 0x80000000
71862306a36Sopenharmony_ci
71962306a36Sopenharmony_cistruct drm_vmw_event_fence {
72062306a36Sopenharmony_ci	struct drm_event base;
72162306a36Sopenharmony_ci	__u64 user_data;
72262306a36Sopenharmony_ci	__u32 tv_sec;
72362306a36Sopenharmony_ci	__u32 tv_usec;
72462306a36Sopenharmony_ci};
72562306a36Sopenharmony_ci
72662306a36Sopenharmony_ci/*
72762306a36Sopenharmony_ci * Flags that may be given to the command.
72862306a36Sopenharmony_ci */
72962306a36Sopenharmony_ci/* Request fence signaled time on the event. */
73062306a36Sopenharmony_ci#define DRM_VMW_FE_FLAG_REQ_TIME (1 << 0)
73162306a36Sopenharmony_ci
73262306a36Sopenharmony_ci/**
73362306a36Sopenharmony_ci * struct drm_vmw_fence_event_arg
73462306a36Sopenharmony_ci *
73562306a36Sopenharmony_ci * @fence_rep: Pointer to fence_rep structure cast to __u64 or 0 if
73662306a36Sopenharmony_ci * the fence is not supposed to be referenced by user-space.
73762306a36Sopenharmony_ci * @user_info: Info to be delivered with the event.
73862306a36Sopenharmony_ci * @handle: Attach the event to this fence only.
73962306a36Sopenharmony_ci * @flags: A set of flags as defined above.
74062306a36Sopenharmony_ci */
74162306a36Sopenharmony_cistruct drm_vmw_fence_event_arg {
74262306a36Sopenharmony_ci	__u64 fence_rep;
74362306a36Sopenharmony_ci	__u64 user_data;
74462306a36Sopenharmony_ci	__u32 handle;
74562306a36Sopenharmony_ci	__u32 flags;
74662306a36Sopenharmony_ci};
74762306a36Sopenharmony_ci
74862306a36Sopenharmony_ci
74962306a36Sopenharmony_ci/*************************************************************************/
75062306a36Sopenharmony_ci/**
75162306a36Sopenharmony_ci * DRM_VMW_PRESENT
75262306a36Sopenharmony_ci *
75362306a36Sopenharmony_ci * Executes an SVGA present on a given fb for a given surface. The surface
75462306a36Sopenharmony_ci * is placed on the framebuffer. Cliprects are given relative to the given
75562306a36Sopenharmony_ci * point (the point disignated by dest_{x|y}).
75662306a36Sopenharmony_ci *
75762306a36Sopenharmony_ci */
75862306a36Sopenharmony_ci
75962306a36Sopenharmony_ci/**
76062306a36Sopenharmony_ci * struct drm_vmw_present_arg
76162306a36Sopenharmony_ci * @fb_id: framebuffer id to present / read back from.
76262306a36Sopenharmony_ci * @sid: Surface id to present from.
76362306a36Sopenharmony_ci * @dest_x: X placement coordinate for surface.
76462306a36Sopenharmony_ci * @dest_y: Y placement coordinate for surface.
76562306a36Sopenharmony_ci * @clips_ptr: Pointer to an array of clip rects cast to an __u64.
76662306a36Sopenharmony_ci * @num_clips: Number of cliprects given relative to the framebuffer origin,
76762306a36Sopenharmony_ci * in the same coordinate space as the frame buffer.
76862306a36Sopenharmony_ci * @pad64: Unused 64-bit padding.
76962306a36Sopenharmony_ci *
77062306a36Sopenharmony_ci * Input argument to the DRM_VMW_PRESENT ioctl.
77162306a36Sopenharmony_ci */
77262306a36Sopenharmony_ci
77362306a36Sopenharmony_cistruct drm_vmw_present_arg {
77462306a36Sopenharmony_ci	__u32 fb_id;
77562306a36Sopenharmony_ci	__u32 sid;
77662306a36Sopenharmony_ci	__s32 dest_x;
77762306a36Sopenharmony_ci	__s32 dest_y;
77862306a36Sopenharmony_ci	__u64 clips_ptr;
77962306a36Sopenharmony_ci	__u32 num_clips;
78062306a36Sopenharmony_ci	__u32 pad64;
78162306a36Sopenharmony_ci};
78262306a36Sopenharmony_ci
78362306a36Sopenharmony_ci
78462306a36Sopenharmony_ci/*************************************************************************/
78562306a36Sopenharmony_ci/**
78662306a36Sopenharmony_ci * DRM_VMW_PRESENT_READBACK
78762306a36Sopenharmony_ci *
78862306a36Sopenharmony_ci * Executes an SVGA present readback from a given fb to the dma buffer
78962306a36Sopenharmony_ci * currently bound as the fb. If there is no dma buffer bound to the fb,
79062306a36Sopenharmony_ci * an error will be returned.
79162306a36Sopenharmony_ci *
79262306a36Sopenharmony_ci */
79362306a36Sopenharmony_ci
79462306a36Sopenharmony_ci/**
79562306a36Sopenharmony_ci * struct drm_vmw_present_arg
79662306a36Sopenharmony_ci * @fb_id: fb_id to present / read back from.
79762306a36Sopenharmony_ci * @num_clips: Number of cliprects.
79862306a36Sopenharmony_ci * @clips_ptr: Pointer to an array of clip rects cast to an __u64.
79962306a36Sopenharmony_ci * @fence_rep: Pointer to a struct drm_vmw_fence_rep, cast to an __u64.
80062306a36Sopenharmony_ci * If this member is NULL, then the ioctl should not return a fence.
80162306a36Sopenharmony_ci */
80262306a36Sopenharmony_ci
80362306a36Sopenharmony_cistruct drm_vmw_present_readback_arg {
80462306a36Sopenharmony_ci	 __u32 fb_id;
80562306a36Sopenharmony_ci	 __u32 num_clips;
80662306a36Sopenharmony_ci	 __u64 clips_ptr;
80762306a36Sopenharmony_ci	 __u64 fence_rep;
80862306a36Sopenharmony_ci};
80962306a36Sopenharmony_ci
81062306a36Sopenharmony_ci/*************************************************************************/
81162306a36Sopenharmony_ci/**
81262306a36Sopenharmony_ci * DRM_VMW_UPDATE_LAYOUT - Update layout
81362306a36Sopenharmony_ci *
81462306a36Sopenharmony_ci * Updates the preferred modes and connection status for connectors. The
81562306a36Sopenharmony_ci * command consists of one drm_vmw_update_layout_arg pointing to an array
81662306a36Sopenharmony_ci * of num_outputs drm_vmw_rect's.
81762306a36Sopenharmony_ci */
81862306a36Sopenharmony_ci
81962306a36Sopenharmony_ci/**
82062306a36Sopenharmony_ci * struct drm_vmw_update_layout_arg
82162306a36Sopenharmony_ci *
82262306a36Sopenharmony_ci * @num_outputs: number of active connectors
82362306a36Sopenharmony_ci * @rects: pointer to array of drm_vmw_rect cast to an __u64
82462306a36Sopenharmony_ci *
82562306a36Sopenharmony_ci * Input argument to the DRM_VMW_UPDATE_LAYOUT Ioctl.
82662306a36Sopenharmony_ci */
82762306a36Sopenharmony_cistruct drm_vmw_update_layout_arg {
82862306a36Sopenharmony_ci	__u32 num_outputs;
82962306a36Sopenharmony_ci	__u32 pad64;
83062306a36Sopenharmony_ci	__u64 rects;
83162306a36Sopenharmony_ci};
83262306a36Sopenharmony_ci
83362306a36Sopenharmony_ci
83462306a36Sopenharmony_ci/*************************************************************************/
83562306a36Sopenharmony_ci/**
83662306a36Sopenharmony_ci * DRM_VMW_CREATE_SHADER - Create shader
83762306a36Sopenharmony_ci *
83862306a36Sopenharmony_ci * Creates a shader and optionally binds it to a dma buffer containing
83962306a36Sopenharmony_ci * the shader byte-code.
84062306a36Sopenharmony_ci */
84162306a36Sopenharmony_ci
84262306a36Sopenharmony_ci/**
84362306a36Sopenharmony_ci * enum drm_vmw_shader_type - Shader types
84462306a36Sopenharmony_ci */
84562306a36Sopenharmony_cienum drm_vmw_shader_type {
84662306a36Sopenharmony_ci	drm_vmw_shader_type_vs = 0,
84762306a36Sopenharmony_ci	drm_vmw_shader_type_ps,
84862306a36Sopenharmony_ci};
84962306a36Sopenharmony_ci
85062306a36Sopenharmony_ci
85162306a36Sopenharmony_ci/**
85262306a36Sopenharmony_ci * struct drm_vmw_shader_create_arg
85362306a36Sopenharmony_ci *
85462306a36Sopenharmony_ci * @shader_type: Shader type of the shader to create.
85562306a36Sopenharmony_ci * @size: Size of the byte-code in bytes.
85662306a36Sopenharmony_ci * where the shader byte-code starts
85762306a36Sopenharmony_ci * @buffer_handle: Buffer handle identifying the buffer containing the
85862306a36Sopenharmony_ci * shader byte-code
85962306a36Sopenharmony_ci * @shader_handle: On successful completion contains a handle that
86062306a36Sopenharmony_ci * can be used to subsequently identify the shader.
86162306a36Sopenharmony_ci * @offset: Offset in bytes into the buffer given by @buffer_handle,
86262306a36Sopenharmony_ci *
86362306a36Sopenharmony_ci * Input / Output argument to the DRM_VMW_CREATE_SHADER Ioctl.
86462306a36Sopenharmony_ci */
86562306a36Sopenharmony_cistruct drm_vmw_shader_create_arg {
86662306a36Sopenharmony_ci	enum drm_vmw_shader_type shader_type;
86762306a36Sopenharmony_ci	__u32 size;
86862306a36Sopenharmony_ci	__u32 buffer_handle;
86962306a36Sopenharmony_ci	__u32 shader_handle;
87062306a36Sopenharmony_ci	__u64 offset;
87162306a36Sopenharmony_ci};
87262306a36Sopenharmony_ci
87362306a36Sopenharmony_ci/*************************************************************************/
87462306a36Sopenharmony_ci/**
87562306a36Sopenharmony_ci * DRM_VMW_UNREF_SHADER - Unreferences a shader
87662306a36Sopenharmony_ci *
87762306a36Sopenharmony_ci * Destroys a user-space reference to a shader, optionally destroying
87862306a36Sopenharmony_ci * it.
87962306a36Sopenharmony_ci */
88062306a36Sopenharmony_ci
88162306a36Sopenharmony_ci/**
88262306a36Sopenharmony_ci * struct drm_vmw_shader_arg
88362306a36Sopenharmony_ci *
88462306a36Sopenharmony_ci * @handle: Handle identifying the shader to destroy.
88562306a36Sopenharmony_ci *
88662306a36Sopenharmony_ci * Input argument to the DRM_VMW_UNREF_SHADER ioctl.
88762306a36Sopenharmony_ci */
88862306a36Sopenharmony_cistruct drm_vmw_shader_arg {
88962306a36Sopenharmony_ci	__u32 handle;
89062306a36Sopenharmony_ci	__u32 pad64;
89162306a36Sopenharmony_ci};
89262306a36Sopenharmony_ci
89362306a36Sopenharmony_ci/*************************************************************************/
89462306a36Sopenharmony_ci/**
89562306a36Sopenharmony_ci * DRM_VMW_GB_SURFACE_CREATE - Create a host guest-backed surface.
89662306a36Sopenharmony_ci *
89762306a36Sopenharmony_ci * Allocates a surface handle and queues a create surface command
89862306a36Sopenharmony_ci * for the host on the first use of the surface. The surface ID can
89962306a36Sopenharmony_ci * be used as the surface ID in commands referencing the surface.
90062306a36Sopenharmony_ci */
90162306a36Sopenharmony_ci
90262306a36Sopenharmony_ci/**
90362306a36Sopenharmony_ci * enum drm_vmw_surface_flags
90462306a36Sopenharmony_ci *
90562306a36Sopenharmony_ci * @drm_vmw_surface_flag_shareable:     Whether the surface is shareable
90662306a36Sopenharmony_ci * @drm_vmw_surface_flag_scanout:       Whether the surface is a scanout
90762306a36Sopenharmony_ci *                                      surface.
90862306a36Sopenharmony_ci * @drm_vmw_surface_flag_create_buffer: Create a backup buffer if none is
90962306a36Sopenharmony_ci *                                      given.
91062306a36Sopenharmony_ci * @drm_vmw_surface_flag_coherent:      Back surface with coherent memory.
91162306a36Sopenharmony_ci */
91262306a36Sopenharmony_cienum drm_vmw_surface_flags {
91362306a36Sopenharmony_ci	drm_vmw_surface_flag_shareable = (1 << 0),
91462306a36Sopenharmony_ci	drm_vmw_surface_flag_scanout = (1 << 1),
91562306a36Sopenharmony_ci	drm_vmw_surface_flag_create_buffer = (1 << 2),
91662306a36Sopenharmony_ci	drm_vmw_surface_flag_coherent = (1 << 3),
91762306a36Sopenharmony_ci};
91862306a36Sopenharmony_ci
91962306a36Sopenharmony_ci/**
92062306a36Sopenharmony_ci * struct drm_vmw_gb_surface_create_req
92162306a36Sopenharmony_ci *
92262306a36Sopenharmony_ci * @svga3d_flags:     SVGA3d surface flags for the device.
92362306a36Sopenharmony_ci * @format:           SVGA3d format.
92462306a36Sopenharmony_ci * @mip_level:        Number of mip levels for all faces.
92562306a36Sopenharmony_ci * @drm_surface_flags Flags as described above.
92662306a36Sopenharmony_ci * @multisample_count Future use. Set to 0.
92762306a36Sopenharmony_ci * @autogen_filter    Future use. Set to 0.
92862306a36Sopenharmony_ci * @buffer_handle     Buffer handle of backup buffer. SVGA3D_INVALID_ID
92962306a36Sopenharmony_ci *                    if none.
93062306a36Sopenharmony_ci * @base_size         Size of the base mip level for all faces.
93162306a36Sopenharmony_ci * @array_size        Must be zero for non-DX hardware, and if non-zero
93262306a36Sopenharmony_ci *                    svga3d_flags must have proper bind flags setup.
93362306a36Sopenharmony_ci *
93462306a36Sopenharmony_ci * Input argument to the  DRM_VMW_GB_SURFACE_CREATE Ioctl.
93562306a36Sopenharmony_ci * Part of output argument for the DRM_VMW_GB_SURFACE_REF Ioctl.
93662306a36Sopenharmony_ci */
93762306a36Sopenharmony_cistruct drm_vmw_gb_surface_create_req {
93862306a36Sopenharmony_ci	__u32 svga3d_flags;
93962306a36Sopenharmony_ci	__u32 format;
94062306a36Sopenharmony_ci	__u32 mip_levels;
94162306a36Sopenharmony_ci	enum drm_vmw_surface_flags drm_surface_flags;
94262306a36Sopenharmony_ci	__u32 multisample_count;
94362306a36Sopenharmony_ci	__u32 autogen_filter;
94462306a36Sopenharmony_ci	__u32 buffer_handle;
94562306a36Sopenharmony_ci	__u32 array_size;
94662306a36Sopenharmony_ci	struct drm_vmw_size base_size;
94762306a36Sopenharmony_ci};
94862306a36Sopenharmony_ci
94962306a36Sopenharmony_ci/**
95062306a36Sopenharmony_ci * struct drm_vmw_gb_surface_create_rep
95162306a36Sopenharmony_ci *
95262306a36Sopenharmony_ci * @handle:            Surface handle.
95362306a36Sopenharmony_ci * @backup_size:       Size of backup buffers for this surface.
95462306a36Sopenharmony_ci * @buffer_handle:     Handle of backup buffer. SVGA3D_INVALID_ID if none.
95562306a36Sopenharmony_ci * @buffer_size:       Actual size of the buffer identified by
95662306a36Sopenharmony_ci *                     @buffer_handle
95762306a36Sopenharmony_ci * @buffer_map_handle: Offset into device address space for the buffer
95862306a36Sopenharmony_ci *                     identified by @buffer_handle.
95962306a36Sopenharmony_ci *
96062306a36Sopenharmony_ci * Part of output argument for the DRM_VMW_GB_SURFACE_REF ioctl.
96162306a36Sopenharmony_ci * Output argument for the DRM_VMW_GB_SURFACE_CREATE ioctl.
96262306a36Sopenharmony_ci */
96362306a36Sopenharmony_cistruct drm_vmw_gb_surface_create_rep {
96462306a36Sopenharmony_ci	__u32 handle;
96562306a36Sopenharmony_ci	__u32 backup_size;
96662306a36Sopenharmony_ci	__u32 buffer_handle;
96762306a36Sopenharmony_ci	__u32 buffer_size;
96862306a36Sopenharmony_ci	__u64 buffer_map_handle;
96962306a36Sopenharmony_ci};
97062306a36Sopenharmony_ci
97162306a36Sopenharmony_ci/**
97262306a36Sopenharmony_ci * union drm_vmw_gb_surface_create_arg
97362306a36Sopenharmony_ci *
97462306a36Sopenharmony_ci * @req: Input argument as described above.
97562306a36Sopenharmony_ci * @rep: Output argument as described above.
97662306a36Sopenharmony_ci *
97762306a36Sopenharmony_ci * Argument to the DRM_VMW_GB_SURFACE_CREATE ioctl.
97862306a36Sopenharmony_ci */
97962306a36Sopenharmony_ciunion drm_vmw_gb_surface_create_arg {
98062306a36Sopenharmony_ci	struct drm_vmw_gb_surface_create_rep rep;
98162306a36Sopenharmony_ci	struct drm_vmw_gb_surface_create_req req;
98262306a36Sopenharmony_ci};
98362306a36Sopenharmony_ci
98462306a36Sopenharmony_ci/*************************************************************************/
98562306a36Sopenharmony_ci/**
98662306a36Sopenharmony_ci * DRM_VMW_GB_SURFACE_REF - Reference a host surface.
98762306a36Sopenharmony_ci *
98862306a36Sopenharmony_ci * Puts a reference on a host surface with a given handle, as previously
98962306a36Sopenharmony_ci * returned by the DRM_VMW_GB_SURFACE_CREATE ioctl.
99062306a36Sopenharmony_ci * A reference will make sure the surface isn't destroyed while we hold
99162306a36Sopenharmony_ci * it and will allow the calling client to use the surface handle in
99262306a36Sopenharmony_ci * the command stream.
99362306a36Sopenharmony_ci *
99462306a36Sopenharmony_ci * On successful return, the Ioctl returns the surface information given
99562306a36Sopenharmony_ci * to and returned from the DRM_VMW_GB_SURFACE_CREATE ioctl.
99662306a36Sopenharmony_ci */
99762306a36Sopenharmony_ci
99862306a36Sopenharmony_ci/**
99962306a36Sopenharmony_ci * struct drm_vmw_gb_surface_reference_arg
100062306a36Sopenharmony_ci *
100162306a36Sopenharmony_ci * @creq: The data used as input when the surface was created, as described
100262306a36Sopenharmony_ci *        above at "struct drm_vmw_gb_surface_create_req"
100362306a36Sopenharmony_ci * @crep: Additional data output when the surface was created, as described
100462306a36Sopenharmony_ci *        above at "struct drm_vmw_gb_surface_create_rep"
100562306a36Sopenharmony_ci *
100662306a36Sopenharmony_ci * Output Argument to the DRM_VMW_GB_SURFACE_REF ioctl.
100762306a36Sopenharmony_ci */
100862306a36Sopenharmony_cistruct drm_vmw_gb_surface_ref_rep {
100962306a36Sopenharmony_ci	struct drm_vmw_gb_surface_create_req creq;
101062306a36Sopenharmony_ci	struct drm_vmw_gb_surface_create_rep crep;
101162306a36Sopenharmony_ci};
101262306a36Sopenharmony_ci
101362306a36Sopenharmony_ci/**
101462306a36Sopenharmony_ci * union drm_vmw_gb_surface_reference_arg
101562306a36Sopenharmony_ci *
101662306a36Sopenharmony_ci * @req: Input data as described above at "struct drm_vmw_surface_arg"
101762306a36Sopenharmony_ci * @rep: Output data as described above at "struct drm_vmw_gb_surface_ref_rep"
101862306a36Sopenharmony_ci *
101962306a36Sopenharmony_ci * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl.
102062306a36Sopenharmony_ci */
102162306a36Sopenharmony_ciunion drm_vmw_gb_surface_reference_arg {
102262306a36Sopenharmony_ci	struct drm_vmw_gb_surface_ref_rep rep;
102362306a36Sopenharmony_ci	struct drm_vmw_surface_arg req;
102462306a36Sopenharmony_ci};
102562306a36Sopenharmony_ci
102662306a36Sopenharmony_ci
102762306a36Sopenharmony_ci/*************************************************************************/
102862306a36Sopenharmony_ci/**
102962306a36Sopenharmony_ci * DRM_VMW_SYNCCPU - Sync a DMA buffer / MOB for CPU access.
103062306a36Sopenharmony_ci *
103162306a36Sopenharmony_ci * Idles any previously submitted GPU operations on the buffer and
103262306a36Sopenharmony_ci * by default blocks command submissions that reference the buffer.
103362306a36Sopenharmony_ci * If the file descriptor used to grab a blocking CPU sync is closed, the
103462306a36Sopenharmony_ci * cpu sync is released.
103562306a36Sopenharmony_ci * The flags argument indicates how the grab / release operation should be
103662306a36Sopenharmony_ci * performed:
103762306a36Sopenharmony_ci */
103862306a36Sopenharmony_ci
103962306a36Sopenharmony_ci/**
104062306a36Sopenharmony_ci * enum drm_vmw_synccpu_flags - Synccpu flags:
104162306a36Sopenharmony_ci *
104262306a36Sopenharmony_ci * @drm_vmw_synccpu_read: Sync for read. If sync is done for read only, it's a
104362306a36Sopenharmony_ci * hint to the kernel to allow command submissions that references the buffer
104462306a36Sopenharmony_ci * for read-only.
104562306a36Sopenharmony_ci * @drm_vmw_synccpu_write: Sync for write. Block all command submissions
104662306a36Sopenharmony_ci * referencing this buffer.
104762306a36Sopenharmony_ci * @drm_vmw_synccpu_dontblock: Dont wait for GPU idle, but rather return
104862306a36Sopenharmony_ci * -EBUSY should the buffer be busy.
104962306a36Sopenharmony_ci * @drm_vmw_synccpu_allow_cs: Allow command submission that touches the buffer
105062306a36Sopenharmony_ci * while the buffer is synced for CPU. This is similar to the GEM bo idle
105162306a36Sopenharmony_ci * behavior.
105262306a36Sopenharmony_ci */
105362306a36Sopenharmony_cienum drm_vmw_synccpu_flags {
105462306a36Sopenharmony_ci	drm_vmw_synccpu_read = (1 << 0),
105562306a36Sopenharmony_ci	drm_vmw_synccpu_write = (1 << 1),
105662306a36Sopenharmony_ci	drm_vmw_synccpu_dontblock = (1 << 2),
105762306a36Sopenharmony_ci	drm_vmw_synccpu_allow_cs = (1 << 3)
105862306a36Sopenharmony_ci};
105962306a36Sopenharmony_ci
106062306a36Sopenharmony_ci/**
106162306a36Sopenharmony_ci * enum drm_vmw_synccpu_op - Synccpu operations:
106262306a36Sopenharmony_ci *
106362306a36Sopenharmony_ci * @drm_vmw_synccpu_grab:    Grab the buffer for CPU operations
106462306a36Sopenharmony_ci * @drm_vmw_synccpu_release: Release a previous grab.
106562306a36Sopenharmony_ci */
106662306a36Sopenharmony_cienum drm_vmw_synccpu_op {
106762306a36Sopenharmony_ci	drm_vmw_synccpu_grab,
106862306a36Sopenharmony_ci	drm_vmw_synccpu_release
106962306a36Sopenharmony_ci};
107062306a36Sopenharmony_ci
107162306a36Sopenharmony_ci/**
107262306a36Sopenharmony_ci * struct drm_vmw_synccpu_arg
107362306a36Sopenharmony_ci *
107462306a36Sopenharmony_ci * @op:			     The synccpu operation as described above.
107562306a36Sopenharmony_ci * @handle:		     Handle identifying the buffer object.
107662306a36Sopenharmony_ci * @flags:		     Flags as described above.
107762306a36Sopenharmony_ci */
107862306a36Sopenharmony_cistruct drm_vmw_synccpu_arg {
107962306a36Sopenharmony_ci	enum drm_vmw_synccpu_op op;
108062306a36Sopenharmony_ci	enum drm_vmw_synccpu_flags flags;
108162306a36Sopenharmony_ci	__u32 handle;
108262306a36Sopenharmony_ci	__u32 pad64;
108362306a36Sopenharmony_ci};
108462306a36Sopenharmony_ci
108562306a36Sopenharmony_ci/*************************************************************************/
108662306a36Sopenharmony_ci/**
108762306a36Sopenharmony_ci * DRM_VMW_CREATE_EXTENDED_CONTEXT - Create a host context.
108862306a36Sopenharmony_ci *
108962306a36Sopenharmony_ci * Allocates a device unique context id, and queues a create context command
109062306a36Sopenharmony_ci * for the host. Does not wait for host completion.
109162306a36Sopenharmony_ci */
109262306a36Sopenharmony_cienum drm_vmw_extended_context {
109362306a36Sopenharmony_ci	drm_vmw_context_legacy,
109462306a36Sopenharmony_ci	drm_vmw_context_dx
109562306a36Sopenharmony_ci};
109662306a36Sopenharmony_ci
109762306a36Sopenharmony_ci/**
109862306a36Sopenharmony_ci * union drm_vmw_extended_context_arg
109962306a36Sopenharmony_ci *
110062306a36Sopenharmony_ci * @req: Context type.
110162306a36Sopenharmony_ci * @rep: Context identifier.
110262306a36Sopenharmony_ci *
110362306a36Sopenharmony_ci * Argument to the DRM_VMW_CREATE_EXTENDED_CONTEXT Ioctl.
110462306a36Sopenharmony_ci */
110562306a36Sopenharmony_ciunion drm_vmw_extended_context_arg {
110662306a36Sopenharmony_ci	enum drm_vmw_extended_context req;
110762306a36Sopenharmony_ci	struct drm_vmw_context_arg rep;
110862306a36Sopenharmony_ci};
110962306a36Sopenharmony_ci
111062306a36Sopenharmony_ci/*************************************************************************/
111162306a36Sopenharmony_ci/*
111262306a36Sopenharmony_ci * DRM_VMW_HANDLE_CLOSE - Close a user-space handle and release its
111362306a36Sopenharmony_ci * underlying resource.
111462306a36Sopenharmony_ci *
111562306a36Sopenharmony_ci * Note that this ioctl is overlaid on the deprecated DRM_VMW_UNREF_DMABUF
111662306a36Sopenharmony_ci * Ioctl.
111762306a36Sopenharmony_ci */
111862306a36Sopenharmony_ci
111962306a36Sopenharmony_ci/**
112062306a36Sopenharmony_ci * struct drm_vmw_handle_close_arg
112162306a36Sopenharmony_ci *
112262306a36Sopenharmony_ci * @handle: Handle to close.
112362306a36Sopenharmony_ci *
112462306a36Sopenharmony_ci * Argument to the DRM_VMW_HANDLE_CLOSE Ioctl.
112562306a36Sopenharmony_ci */
112662306a36Sopenharmony_cistruct drm_vmw_handle_close_arg {
112762306a36Sopenharmony_ci	__u32 handle;
112862306a36Sopenharmony_ci	__u32 pad64;
112962306a36Sopenharmony_ci};
113062306a36Sopenharmony_ci#define drm_vmw_unref_dmabuf_arg drm_vmw_handle_close_arg
113162306a36Sopenharmony_ci
113262306a36Sopenharmony_ci/*************************************************************************/
113362306a36Sopenharmony_ci/**
113462306a36Sopenharmony_ci * DRM_VMW_GB_SURFACE_CREATE_EXT - Create a host guest-backed surface.
113562306a36Sopenharmony_ci *
113662306a36Sopenharmony_ci * Allocates a surface handle and queues a create surface command
113762306a36Sopenharmony_ci * for the host on the first use of the surface. The surface ID can
113862306a36Sopenharmony_ci * be used as the surface ID in commands referencing the surface.
113962306a36Sopenharmony_ci *
114062306a36Sopenharmony_ci * This new command extends DRM_VMW_GB_SURFACE_CREATE by adding version
114162306a36Sopenharmony_ci * parameter and 64 bit svga flag.
114262306a36Sopenharmony_ci */
114362306a36Sopenharmony_ci
114462306a36Sopenharmony_ci/**
114562306a36Sopenharmony_ci * enum drm_vmw_surface_version
114662306a36Sopenharmony_ci *
114762306a36Sopenharmony_ci * @drm_vmw_surface_gb_v1: Corresponds to current gb surface format with
114862306a36Sopenharmony_ci * svga3d surface flags split into 2, upper half and lower half.
114962306a36Sopenharmony_ci */
115062306a36Sopenharmony_cienum drm_vmw_surface_version {
115162306a36Sopenharmony_ci	drm_vmw_gb_surface_v1,
115262306a36Sopenharmony_ci};
115362306a36Sopenharmony_ci
115462306a36Sopenharmony_ci/**
115562306a36Sopenharmony_ci * struct drm_vmw_gb_surface_create_ext_req
115662306a36Sopenharmony_ci *
115762306a36Sopenharmony_ci * @base: Surface create parameters.
115862306a36Sopenharmony_ci * @version: Version of surface create ioctl.
115962306a36Sopenharmony_ci * @svga3d_flags_upper_32_bits: Upper 32 bits of svga3d flags.
116062306a36Sopenharmony_ci * @multisample_pattern: Multisampling pattern when msaa is supported.
116162306a36Sopenharmony_ci * @quality_level: Precision settings for each sample.
116262306a36Sopenharmony_ci * @buffer_byte_stride: Buffer byte stride.
116362306a36Sopenharmony_ci * @must_be_zero: Reserved for future usage.
116462306a36Sopenharmony_ci *
116562306a36Sopenharmony_ci * Input argument to the  DRM_VMW_GB_SURFACE_CREATE_EXT Ioctl.
116662306a36Sopenharmony_ci * Part of output argument for the DRM_VMW_GB_SURFACE_REF_EXT Ioctl.
116762306a36Sopenharmony_ci */
116862306a36Sopenharmony_cistruct drm_vmw_gb_surface_create_ext_req {
116962306a36Sopenharmony_ci	struct drm_vmw_gb_surface_create_req base;
117062306a36Sopenharmony_ci	enum drm_vmw_surface_version version;
117162306a36Sopenharmony_ci	__u32 svga3d_flags_upper_32_bits;
117262306a36Sopenharmony_ci	__u32 multisample_pattern;
117362306a36Sopenharmony_ci	__u32 quality_level;
117462306a36Sopenharmony_ci	__u32 buffer_byte_stride;
117562306a36Sopenharmony_ci	__u32 must_be_zero;
117662306a36Sopenharmony_ci};
117762306a36Sopenharmony_ci
117862306a36Sopenharmony_ci/**
117962306a36Sopenharmony_ci * union drm_vmw_gb_surface_create_ext_arg
118062306a36Sopenharmony_ci *
118162306a36Sopenharmony_ci * @req: Input argument as described above.
118262306a36Sopenharmony_ci * @rep: Output argument as described above.
118362306a36Sopenharmony_ci *
118462306a36Sopenharmony_ci * Argument to the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl.
118562306a36Sopenharmony_ci */
118662306a36Sopenharmony_ciunion drm_vmw_gb_surface_create_ext_arg {
118762306a36Sopenharmony_ci	struct drm_vmw_gb_surface_create_rep rep;
118862306a36Sopenharmony_ci	struct drm_vmw_gb_surface_create_ext_req req;
118962306a36Sopenharmony_ci};
119062306a36Sopenharmony_ci
119162306a36Sopenharmony_ci/*************************************************************************/
119262306a36Sopenharmony_ci/**
119362306a36Sopenharmony_ci * DRM_VMW_GB_SURFACE_REF_EXT - Reference a host surface.
119462306a36Sopenharmony_ci *
119562306a36Sopenharmony_ci * Puts a reference on a host surface with a given handle, as previously
119662306a36Sopenharmony_ci * returned by the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl.
119762306a36Sopenharmony_ci * A reference will make sure the surface isn't destroyed while we hold
119862306a36Sopenharmony_ci * it and will allow the calling client to use the surface handle in
119962306a36Sopenharmony_ci * the command stream.
120062306a36Sopenharmony_ci *
120162306a36Sopenharmony_ci * On successful return, the Ioctl returns the surface information given
120262306a36Sopenharmony_ci * to and returned from the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl.
120362306a36Sopenharmony_ci */
120462306a36Sopenharmony_ci
120562306a36Sopenharmony_ci/**
120662306a36Sopenharmony_ci * struct drm_vmw_gb_surface_ref_ext_rep
120762306a36Sopenharmony_ci *
120862306a36Sopenharmony_ci * @creq: The data used as input when the surface was created, as described
120962306a36Sopenharmony_ci *        above at "struct drm_vmw_gb_surface_create_ext_req"
121062306a36Sopenharmony_ci * @crep: Additional data output when the surface was created, as described
121162306a36Sopenharmony_ci *        above at "struct drm_vmw_gb_surface_create_rep"
121262306a36Sopenharmony_ci *
121362306a36Sopenharmony_ci * Output Argument to the DRM_VMW_GB_SURFACE_REF_EXT ioctl.
121462306a36Sopenharmony_ci */
121562306a36Sopenharmony_cistruct drm_vmw_gb_surface_ref_ext_rep {
121662306a36Sopenharmony_ci	struct drm_vmw_gb_surface_create_ext_req creq;
121762306a36Sopenharmony_ci	struct drm_vmw_gb_surface_create_rep crep;
121862306a36Sopenharmony_ci};
121962306a36Sopenharmony_ci
122062306a36Sopenharmony_ci/**
122162306a36Sopenharmony_ci * union drm_vmw_gb_surface_reference_ext_arg
122262306a36Sopenharmony_ci *
122362306a36Sopenharmony_ci * @req: Input data as described above at "struct drm_vmw_surface_arg"
122462306a36Sopenharmony_ci * @rep: Output data as described above at
122562306a36Sopenharmony_ci *       "struct drm_vmw_gb_surface_ref_ext_rep"
122662306a36Sopenharmony_ci *
122762306a36Sopenharmony_ci * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl.
122862306a36Sopenharmony_ci */
122962306a36Sopenharmony_ciunion drm_vmw_gb_surface_reference_ext_arg {
123062306a36Sopenharmony_ci	struct drm_vmw_gb_surface_ref_ext_rep rep;
123162306a36Sopenharmony_ci	struct drm_vmw_surface_arg req;
123262306a36Sopenharmony_ci};
123362306a36Sopenharmony_ci
123462306a36Sopenharmony_ci/**
123562306a36Sopenharmony_ci * struct drm_vmw_msg_arg
123662306a36Sopenharmony_ci *
123762306a36Sopenharmony_ci * @send: Pointer to user-space msg string (null terminated).
123862306a36Sopenharmony_ci * @receive: Pointer to user-space receive buffer.
123962306a36Sopenharmony_ci * @send_only: Boolean whether this is only sending or receiving too.
124062306a36Sopenharmony_ci *
124162306a36Sopenharmony_ci * Argument to the DRM_VMW_MSG ioctl.
124262306a36Sopenharmony_ci */
124362306a36Sopenharmony_cistruct drm_vmw_msg_arg {
124462306a36Sopenharmony_ci	__u64 send;
124562306a36Sopenharmony_ci	__u64 receive;
124662306a36Sopenharmony_ci	__s32 send_only;
124762306a36Sopenharmony_ci	__u32 receive_len;
124862306a36Sopenharmony_ci};
124962306a36Sopenharmony_ci
125062306a36Sopenharmony_ci/**
125162306a36Sopenharmony_ci * struct drm_vmw_mksstat_add_arg
125262306a36Sopenharmony_ci *
125362306a36Sopenharmony_ci * @stat: Pointer to user-space stat-counters array, page-aligned.
125462306a36Sopenharmony_ci * @info: Pointer to user-space counter-infos array, page-aligned.
125562306a36Sopenharmony_ci * @strs: Pointer to user-space stat strings, page-aligned.
125662306a36Sopenharmony_ci * @stat_len: Length in bytes of stat-counters array.
125762306a36Sopenharmony_ci * @info_len: Length in bytes of counter-infos array.
125862306a36Sopenharmony_ci * @strs_len: Length in bytes of the stat strings, terminators included.
125962306a36Sopenharmony_ci * @description: Pointer to instance descriptor string; will be truncated
126062306a36Sopenharmony_ci *               to MKS_GUEST_STAT_INSTANCE_DESC_LENGTH chars.
126162306a36Sopenharmony_ci * @id: Output identifier of the produced record; -1 if error.
126262306a36Sopenharmony_ci *
126362306a36Sopenharmony_ci * Argument to the DRM_VMW_MKSSTAT_ADD ioctl.
126462306a36Sopenharmony_ci */
126562306a36Sopenharmony_cistruct drm_vmw_mksstat_add_arg {
126662306a36Sopenharmony_ci	__u64 stat;
126762306a36Sopenharmony_ci	__u64 info;
126862306a36Sopenharmony_ci	__u64 strs;
126962306a36Sopenharmony_ci	__u64 stat_len;
127062306a36Sopenharmony_ci	__u64 info_len;
127162306a36Sopenharmony_ci	__u64 strs_len;
127262306a36Sopenharmony_ci	__u64 description;
127362306a36Sopenharmony_ci	__u64 id;
127462306a36Sopenharmony_ci};
127562306a36Sopenharmony_ci
127662306a36Sopenharmony_ci/**
127762306a36Sopenharmony_ci * struct drm_vmw_mksstat_remove_arg
127862306a36Sopenharmony_ci *
127962306a36Sopenharmony_ci * @id: Identifier of the record being disposed, originally obtained through
128062306a36Sopenharmony_ci *      DRM_VMW_MKSSTAT_ADD ioctl.
128162306a36Sopenharmony_ci *
128262306a36Sopenharmony_ci * Argument to the DRM_VMW_MKSSTAT_REMOVE ioctl.
128362306a36Sopenharmony_ci */
128462306a36Sopenharmony_cistruct drm_vmw_mksstat_remove_arg {
128562306a36Sopenharmony_ci	__u64 id;
128662306a36Sopenharmony_ci};
128762306a36Sopenharmony_ci
128862306a36Sopenharmony_ci#if defined(__cplusplus)
128962306a36Sopenharmony_ci}
129062306a36Sopenharmony_ci#endif
129162306a36Sopenharmony_ci
129262306a36Sopenharmony_ci#endif
1293