18c2ecf20Sopenharmony_ci/**************************************************************************
28c2ecf20Sopenharmony_ci *
38c2ecf20Sopenharmony_ci * Copyright © 2009-2015 VMware, Inc., Palo Alto, CA., USA
48c2ecf20Sopenharmony_ci * All Rights Reserved.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
78c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the
88c2ecf20Sopenharmony_ci * "Software"), to deal in the Software without restriction, including
98c2ecf20Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish,
108c2ecf20Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to
118c2ecf20Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to
128c2ecf20Sopenharmony_ci * the following conditions:
138c2ecf20Sopenharmony_ci *
148c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice (including the
158c2ecf20Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions
168c2ecf20Sopenharmony_ci * of the Software.
178c2ecf20Sopenharmony_ci *
188c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
198c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
208c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
218c2ecf20Sopenharmony_ci * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
228c2ecf20Sopenharmony_ci * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
238c2ecf20Sopenharmony_ci * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
248c2ecf20Sopenharmony_ci * USE OR OTHER DEALINGS IN THE SOFTWARE.
258c2ecf20Sopenharmony_ci *
268c2ecf20Sopenharmony_ci **************************************************************************/
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#ifndef __VMWGFX_DRM_H__
298c2ecf20Sopenharmony_ci#define __VMWGFX_DRM_H__
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#include "drm.h"
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#if defined(__cplusplus)
348c2ecf20Sopenharmony_ciextern "C" {
358c2ecf20Sopenharmony_ci#endif
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#define DRM_VMW_MAX_SURFACE_FACES 6
388c2ecf20Sopenharmony_ci#define DRM_VMW_MAX_MIP_LEVELS 24
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#define DRM_VMW_GET_PARAM            0
428c2ecf20Sopenharmony_ci#define DRM_VMW_ALLOC_DMABUF         1
438c2ecf20Sopenharmony_ci#define DRM_VMW_ALLOC_BO             1
448c2ecf20Sopenharmony_ci#define DRM_VMW_UNREF_DMABUF         2
458c2ecf20Sopenharmony_ci#define DRM_VMW_HANDLE_CLOSE         2
468c2ecf20Sopenharmony_ci#define DRM_VMW_CURSOR_BYPASS        3
478c2ecf20Sopenharmony_ci/* guarded by DRM_VMW_PARAM_NUM_STREAMS != 0*/
488c2ecf20Sopenharmony_ci#define DRM_VMW_CONTROL_STREAM       4
498c2ecf20Sopenharmony_ci#define DRM_VMW_CLAIM_STREAM         5
508c2ecf20Sopenharmony_ci#define DRM_VMW_UNREF_STREAM         6
518c2ecf20Sopenharmony_ci/* guarded by DRM_VMW_PARAM_3D == 1 */
528c2ecf20Sopenharmony_ci#define DRM_VMW_CREATE_CONTEXT       7
538c2ecf20Sopenharmony_ci#define DRM_VMW_UNREF_CONTEXT        8
548c2ecf20Sopenharmony_ci#define DRM_VMW_CREATE_SURFACE       9
558c2ecf20Sopenharmony_ci#define DRM_VMW_UNREF_SURFACE        10
568c2ecf20Sopenharmony_ci#define DRM_VMW_REF_SURFACE          11
578c2ecf20Sopenharmony_ci#define DRM_VMW_EXECBUF              12
588c2ecf20Sopenharmony_ci#define DRM_VMW_GET_3D_CAP           13
598c2ecf20Sopenharmony_ci#define DRM_VMW_FENCE_WAIT           14
608c2ecf20Sopenharmony_ci#define DRM_VMW_FENCE_SIGNALED       15
618c2ecf20Sopenharmony_ci#define DRM_VMW_FENCE_UNREF          16
628c2ecf20Sopenharmony_ci#define DRM_VMW_FENCE_EVENT          17
638c2ecf20Sopenharmony_ci#define DRM_VMW_PRESENT              18
648c2ecf20Sopenharmony_ci#define DRM_VMW_PRESENT_READBACK     19
658c2ecf20Sopenharmony_ci#define DRM_VMW_UPDATE_LAYOUT        20
668c2ecf20Sopenharmony_ci#define DRM_VMW_CREATE_SHADER        21
678c2ecf20Sopenharmony_ci#define DRM_VMW_UNREF_SHADER         22
688c2ecf20Sopenharmony_ci#define DRM_VMW_GB_SURFACE_CREATE    23
698c2ecf20Sopenharmony_ci#define DRM_VMW_GB_SURFACE_REF       24
708c2ecf20Sopenharmony_ci#define DRM_VMW_SYNCCPU              25
718c2ecf20Sopenharmony_ci#define DRM_VMW_CREATE_EXTENDED_CONTEXT 26
728c2ecf20Sopenharmony_ci#define DRM_VMW_GB_SURFACE_CREATE_EXT   27
738c2ecf20Sopenharmony_ci#define DRM_VMW_GB_SURFACE_REF_EXT      28
748c2ecf20Sopenharmony_ci#define DRM_VMW_MSG                     29
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci/*************************************************************************/
778c2ecf20Sopenharmony_ci/**
788c2ecf20Sopenharmony_ci * DRM_VMW_GET_PARAM - get device information.
798c2ecf20Sopenharmony_ci *
808c2ecf20Sopenharmony_ci * DRM_VMW_PARAM_FIFO_OFFSET:
818c2ecf20Sopenharmony_ci * Offset to use to map the first page of the FIFO read-only.
828c2ecf20Sopenharmony_ci * The fifo is mapped using the mmap() system call on the drm device.
838c2ecf20Sopenharmony_ci *
848c2ecf20Sopenharmony_ci * DRM_VMW_PARAM_OVERLAY_IOCTL:
858c2ecf20Sopenharmony_ci * Does the driver support the overlay ioctl.
868c2ecf20Sopenharmony_ci *
878c2ecf20Sopenharmony_ci * DRM_VMW_PARAM_SM4_1
888c2ecf20Sopenharmony_ci * SM4_1 support is enabled.
898c2ecf20Sopenharmony_ci *
908c2ecf20Sopenharmony_ci * DRM_VMW_PARAM_SM5
918c2ecf20Sopenharmony_ci * SM5 support is enabled.
928c2ecf20Sopenharmony_ci */
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci#define DRM_VMW_PARAM_NUM_STREAMS      0
958c2ecf20Sopenharmony_ci#define DRM_VMW_PARAM_NUM_FREE_STREAMS 1
968c2ecf20Sopenharmony_ci#define DRM_VMW_PARAM_3D               2
978c2ecf20Sopenharmony_ci#define DRM_VMW_PARAM_HW_CAPS          3
988c2ecf20Sopenharmony_ci#define DRM_VMW_PARAM_FIFO_CAPS        4
998c2ecf20Sopenharmony_ci#define DRM_VMW_PARAM_MAX_FB_SIZE      5
1008c2ecf20Sopenharmony_ci#define DRM_VMW_PARAM_FIFO_HW_VERSION  6
1018c2ecf20Sopenharmony_ci#define DRM_VMW_PARAM_MAX_SURF_MEMORY  7
1028c2ecf20Sopenharmony_ci#define DRM_VMW_PARAM_3D_CAPS_SIZE     8
1038c2ecf20Sopenharmony_ci#define DRM_VMW_PARAM_MAX_MOB_MEMORY   9
1048c2ecf20Sopenharmony_ci#define DRM_VMW_PARAM_MAX_MOB_SIZE     10
1058c2ecf20Sopenharmony_ci#define DRM_VMW_PARAM_SCREEN_TARGET    11
1068c2ecf20Sopenharmony_ci#define DRM_VMW_PARAM_DX               12
1078c2ecf20Sopenharmony_ci#define DRM_VMW_PARAM_HW_CAPS2         13
1088c2ecf20Sopenharmony_ci#define DRM_VMW_PARAM_SM4_1            14
1098c2ecf20Sopenharmony_ci#define DRM_VMW_PARAM_SM5              15
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci/**
1128c2ecf20Sopenharmony_ci * enum drm_vmw_handle_type - handle type for ref ioctls
1138c2ecf20Sopenharmony_ci *
1148c2ecf20Sopenharmony_ci */
1158c2ecf20Sopenharmony_cienum drm_vmw_handle_type {
1168c2ecf20Sopenharmony_ci	DRM_VMW_HANDLE_LEGACY = 0,
1178c2ecf20Sopenharmony_ci	DRM_VMW_HANDLE_PRIME = 1
1188c2ecf20Sopenharmony_ci};
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci/**
1218c2ecf20Sopenharmony_ci * struct drm_vmw_getparam_arg
1228c2ecf20Sopenharmony_ci *
1238c2ecf20Sopenharmony_ci * @value: Returned value. //Out
1248c2ecf20Sopenharmony_ci * @param: Parameter to query. //In.
1258c2ecf20Sopenharmony_ci *
1268c2ecf20Sopenharmony_ci * Argument to the DRM_VMW_GET_PARAM Ioctl.
1278c2ecf20Sopenharmony_ci */
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_cistruct drm_vmw_getparam_arg {
1308c2ecf20Sopenharmony_ci	__u64 value;
1318c2ecf20Sopenharmony_ci	__u32 param;
1328c2ecf20Sopenharmony_ci	__u32 pad64;
1338c2ecf20Sopenharmony_ci};
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_ci/*************************************************************************/
1368c2ecf20Sopenharmony_ci/**
1378c2ecf20Sopenharmony_ci * DRM_VMW_CREATE_CONTEXT - Create a host context.
1388c2ecf20Sopenharmony_ci *
1398c2ecf20Sopenharmony_ci * Allocates a device unique context id, and queues a create context command
1408c2ecf20Sopenharmony_ci * for the host. Does not wait for host completion.
1418c2ecf20Sopenharmony_ci */
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_ci/**
1448c2ecf20Sopenharmony_ci * struct drm_vmw_context_arg
1458c2ecf20Sopenharmony_ci *
1468c2ecf20Sopenharmony_ci * @cid: Device unique context ID.
1478c2ecf20Sopenharmony_ci *
1488c2ecf20Sopenharmony_ci * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
1498c2ecf20Sopenharmony_ci * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
1508c2ecf20Sopenharmony_ci */
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_cistruct drm_vmw_context_arg {
1538c2ecf20Sopenharmony_ci	__s32 cid;
1548c2ecf20Sopenharmony_ci	__u32 pad64;
1558c2ecf20Sopenharmony_ci};
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci/*************************************************************************/
1588c2ecf20Sopenharmony_ci/**
1598c2ecf20Sopenharmony_ci * DRM_VMW_UNREF_CONTEXT - Create a host context.
1608c2ecf20Sopenharmony_ci *
1618c2ecf20Sopenharmony_ci * Frees a global context id, and queues a destroy host command for the host.
1628c2ecf20Sopenharmony_ci * Does not wait for host completion. The context ID can be used directly
1638c2ecf20Sopenharmony_ci * in the command stream and shows up as the same context ID on the host.
1648c2ecf20Sopenharmony_ci */
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_ci/*************************************************************************/
1678c2ecf20Sopenharmony_ci/**
1688c2ecf20Sopenharmony_ci * DRM_VMW_CREATE_SURFACE - Create a host suface.
1698c2ecf20Sopenharmony_ci *
1708c2ecf20Sopenharmony_ci * Allocates a device unique surface id, and queues a create surface command
1718c2ecf20Sopenharmony_ci * for the host. Does not wait for host completion. The surface ID can be
1728c2ecf20Sopenharmony_ci * used directly in the command stream and shows up as the same surface
1738c2ecf20Sopenharmony_ci * ID on the host.
1748c2ecf20Sopenharmony_ci */
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_ci/**
1778c2ecf20Sopenharmony_ci * struct drm_wmv_surface_create_req
1788c2ecf20Sopenharmony_ci *
1798c2ecf20Sopenharmony_ci * @flags: Surface flags as understood by the host.
1808c2ecf20Sopenharmony_ci * @format: Surface format as understood by the host.
1818c2ecf20Sopenharmony_ci * @mip_levels: Number of mip levels for each face.
1828c2ecf20Sopenharmony_ci * An unused face should have 0 encoded.
1838c2ecf20Sopenharmony_ci * @size_addr: Address of a user-space array of sruct drm_vmw_size
1848c2ecf20Sopenharmony_ci * cast to an __u64 for 32-64 bit compatibility.
1858c2ecf20Sopenharmony_ci * The size of the array should equal the total number of mipmap levels.
1868c2ecf20Sopenharmony_ci * @shareable: Boolean whether other clients (as identified by file descriptors)
1878c2ecf20Sopenharmony_ci * may reference this surface.
1888c2ecf20Sopenharmony_ci * @scanout: Boolean whether the surface is intended to be used as a
1898c2ecf20Sopenharmony_ci * scanout.
1908c2ecf20Sopenharmony_ci *
1918c2ecf20Sopenharmony_ci * Input data to the DRM_VMW_CREATE_SURFACE Ioctl.
1928c2ecf20Sopenharmony_ci * Output data from the DRM_VMW_REF_SURFACE Ioctl.
1938c2ecf20Sopenharmony_ci */
1948c2ecf20Sopenharmony_ci
1958c2ecf20Sopenharmony_cistruct drm_vmw_surface_create_req {
1968c2ecf20Sopenharmony_ci	__u32 flags;
1978c2ecf20Sopenharmony_ci	__u32 format;
1988c2ecf20Sopenharmony_ci	__u32 mip_levels[DRM_VMW_MAX_SURFACE_FACES];
1998c2ecf20Sopenharmony_ci	__u64 size_addr;
2008c2ecf20Sopenharmony_ci	__s32 shareable;
2018c2ecf20Sopenharmony_ci	__s32 scanout;
2028c2ecf20Sopenharmony_ci};
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci/**
2058c2ecf20Sopenharmony_ci * struct drm_wmv_surface_arg
2068c2ecf20Sopenharmony_ci *
2078c2ecf20Sopenharmony_ci * @sid: Surface id of created surface or surface to destroy or reference.
2088c2ecf20Sopenharmony_ci * @handle_type: Handle type for DRM_VMW_REF_SURFACE Ioctl.
2098c2ecf20Sopenharmony_ci *
2108c2ecf20Sopenharmony_ci * Output data from the DRM_VMW_CREATE_SURFACE Ioctl.
2118c2ecf20Sopenharmony_ci * Input argument to the DRM_VMW_UNREF_SURFACE Ioctl.
2128c2ecf20Sopenharmony_ci * Input argument to the DRM_VMW_REF_SURFACE Ioctl.
2138c2ecf20Sopenharmony_ci */
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_cistruct drm_vmw_surface_arg {
2168c2ecf20Sopenharmony_ci	__s32 sid;
2178c2ecf20Sopenharmony_ci	enum drm_vmw_handle_type handle_type;
2188c2ecf20Sopenharmony_ci};
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_ci/**
2218c2ecf20Sopenharmony_ci * struct drm_vmw_size ioctl.
2228c2ecf20Sopenharmony_ci *
2238c2ecf20Sopenharmony_ci * @width - mip level width
2248c2ecf20Sopenharmony_ci * @height - mip level height
2258c2ecf20Sopenharmony_ci * @depth - mip level depth
2268c2ecf20Sopenharmony_ci *
2278c2ecf20Sopenharmony_ci * Description of a mip level.
2288c2ecf20Sopenharmony_ci * Input data to the DRM_WMW_CREATE_SURFACE Ioctl.
2298c2ecf20Sopenharmony_ci */
2308c2ecf20Sopenharmony_ci
2318c2ecf20Sopenharmony_cistruct drm_vmw_size {
2328c2ecf20Sopenharmony_ci	__u32 width;
2338c2ecf20Sopenharmony_ci	__u32 height;
2348c2ecf20Sopenharmony_ci	__u32 depth;
2358c2ecf20Sopenharmony_ci	__u32 pad64;
2368c2ecf20Sopenharmony_ci};
2378c2ecf20Sopenharmony_ci
2388c2ecf20Sopenharmony_ci/**
2398c2ecf20Sopenharmony_ci * union drm_vmw_surface_create_arg
2408c2ecf20Sopenharmony_ci *
2418c2ecf20Sopenharmony_ci * @rep: Output data as described above.
2428c2ecf20Sopenharmony_ci * @req: Input data as described above.
2438c2ecf20Sopenharmony_ci *
2448c2ecf20Sopenharmony_ci * Argument to the DRM_VMW_CREATE_SURFACE Ioctl.
2458c2ecf20Sopenharmony_ci */
2468c2ecf20Sopenharmony_ci
2478c2ecf20Sopenharmony_ciunion drm_vmw_surface_create_arg {
2488c2ecf20Sopenharmony_ci	struct drm_vmw_surface_arg rep;
2498c2ecf20Sopenharmony_ci	struct drm_vmw_surface_create_req req;
2508c2ecf20Sopenharmony_ci};
2518c2ecf20Sopenharmony_ci
2528c2ecf20Sopenharmony_ci/*************************************************************************/
2538c2ecf20Sopenharmony_ci/**
2548c2ecf20Sopenharmony_ci * DRM_VMW_REF_SURFACE - Reference a host surface.
2558c2ecf20Sopenharmony_ci *
2568c2ecf20Sopenharmony_ci * Puts a reference on a host surface with a give sid, as previously
2578c2ecf20Sopenharmony_ci * returned by the DRM_VMW_CREATE_SURFACE ioctl.
2588c2ecf20Sopenharmony_ci * A reference will make sure the surface isn't destroyed while we hold
2598c2ecf20Sopenharmony_ci * it and will allow the calling client to use the surface ID in the command
2608c2ecf20Sopenharmony_ci * stream.
2618c2ecf20Sopenharmony_ci *
2628c2ecf20Sopenharmony_ci * On successful return, the Ioctl returns the surface information given
2638c2ecf20Sopenharmony_ci * in the DRM_VMW_CREATE_SURFACE ioctl.
2648c2ecf20Sopenharmony_ci */
2658c2ecf20Sopenharmony_ci
2668c2ecf20Sopenharmony_ci/**
2678c2ecf20Sopenharmony_ci * union drm_vmw_surface_reference_arg
2688c2ecf20Sopenharmony_ci *
2698c2ecf20Sopenharmony_ci * @rep: Output data as described above.
2708c2ecf20Sopenharmony_ci * @req: Input data as described above.
2718c2ecf20Sopenharmony_ci *
2728c2ecf20Sopenharmony_ci * Argument to the DRM_VMW_REF_SURFACE Ioctl.
2738c2ecf20Sopenharmony_ci */
2748c2ecf20Sopenharmony_ci
2758c2ecf20Sopenharmony_ciunion drm_vmw_surface_reference_arg {
2768c2ecf20Sopenharmony_ci	struct drm_vmw_surface_create_req rep;
2778c2ecf20Sopenharmony_ci	struct drm_vmw_surface_arg req;
2788c2ecf20Sopenharmony_ci};
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_ci/*************************************************************************/
2818c2ecf20Sopenharmony_ci/**
2828c2ecf20Sopenharmony_ci * DRM_VMW_UNREF_SURFACE - Unreference a host surface.
2838c2ecf20Sopenharmony_ci *
2848c2ecf20Sopenharmony_ci * Clear a reference previously put on a host surface.
2858c2ecf20Sopenharmony_ci * When all references are gone, including the one implicitly placed
2868c2ecf20Sopenharmony_ci * on creation,
2878c2ecf20Sopenharmony_ci * a destroy surface command will be queued for the host.
2888c2ecf20Sopenharmony_ci * Does not wait for completion.
2898c2ecf20Sopenharmony_ci */
2908c2ecf20Sopenharmony_ci
2918c2ecf20Sopenharmony_ci/*************************************************************************/
2928c2ecf20Sopenharmony_ci/**
2938c2ecf20Sopenharmony_ci * DRM_VMW_EXECBUF
2948c2ecf20Sopenharmony_ci *
2958c2ecf20Sopenharmony_ci * Submit a command buffer for execution on the host, and return a
2968c2ecf20Sopenharmony_ci * fence seqno that when signaled, indicates that the command buffer has
2978c2ecf20Sopenharmony_ci * executed.
2988c2ecf20Sopenharmony_ci */
2998c2ecf20Sopenharmony_ci
3008c2ecf20Sopenharmony_ci/**
3018c2ecf20Sopenharmony_ci * struct drm_vmw_execbuf_arg
3028c2ecf20Sopenharmony_ci *
3038c2ecf20Sopenharmony_ci * @commands: User-space address of a command buffer cast to an __u64.
3048c2ecf20Sopenharmony_ci * @command-size: Size in bytes of the command buffer.
3058c2ecf20Sopenharmony_ci * @throttle-us: Sleep until software is less than @throttle_us
3068c2ecf20Sopenharmony_ci * microseconds ahead of hardware. The driver may round this value
3078c2ecf20Sopenharmony_ci * to the nearest kernel tick.
3088c2ecf20Sopenharmony_ci * @fence_rep: User-space address of a struct drm_vmw_fence_rep cast to an
3098c2ecf20Sopenharmony_ci * __u64.
3108c2ecf20Sopenharmony_ci * @version: Allows expanding the execbuf ioctl parameters without breaking
3118c2ecf20Sopenharmony_ci * backwards compatibility, since user-space will always tell the kernel
3128c2ecf20Sopenharmony_ci * which version it uses.
3138c2ecf20Sopenharmony_ci * @flags: Execbuf flags.
3148c2ecf20Sopenharmony_ci * @imported_fence_fd:  FD for a fence imported from another device
3158c2ecf20Sopenharmony_ci *
3168c2ecf20Sopenharmony_ci * Argument to the DRM_VMW_EXECBUF Ioctl.
3178c2ecf20Sopenharmony_ci */
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ci#define DRM_VMW_EXECBUF_VERSION 2
3208c2ecf20Sopenharmony_ci
3218c2ecf20Sopenharmony_ci#define DRM_VMW_EXECBUF_FLAG_IMPORT_FENCE_FD (1 << 0)
3228c2ecf20Sopenharmony_ci#define DRM_VMW_EXECBUF_FLAG_EXPORT_FENCE_FD (1 << 1)
3238c2ecf20Sopenharmony_ci
3248c2ecf20Sopenharmony_cistruct drm_vmw_execbuf_arg {
3258c2ecf20Sopenharmony_ci	__u64 commands;
3268c2ecf20Sopenharmony_ci	__u32 command_size;
3278c2ecf20Sopenharmony_ci	__u32 throttle_us;
3288c2ecf20Sopenharmony_ci	__u64 fence_rep;
3298c2ecf20Sopenharmony_ci	__u32 version;
3308c2ecf20Sopenharmony_ci	__u32 flags;
3318c2ecf20Sopenharmony_ci	__u32 context_handle;
3328c2ecf20Sopenharmony_ci	__s32 imported_fence_fd;
3338c2ecf20Sopenharmony_ci};
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ci/**
3368c2ecf20Sopenharmony_ci * struct drm_vmw_fence_rep
3378c2ecf20Sopenharmony_ci *
3388c2ecf20Sopenharmony_ci * @handle: Fence object handle for fence associated with a command submission.
3398c2ecf20Sopenharmony_ci * @mask: Fence flags relevant for this fence object.
3408c2ecf20Sopenharmony_ci * @seqno: Fence sequence number in fifo. A fence object with a lower
3418c2ecf20Sopenharmony_ci * seqno will signal the EXEC flag before a fence object with a higher
3428c2ecf20Sopenharmony_ci * seqno. This can be used by user-space to avoid kernel calls to determine
3438c2ecf20Sopenharmony_ci * whether a fence has signaled the EXEC flag. Note that @seqno will
3448c2ecf20Sopenharmony_ci * wrap at 32-bit.
3458c2ecf20Sopenharmony_ci * @passed_seqno: The highest seqno number processed by the hardware
3468c2ecf20Sopenharmony_ci * so far. This can be used to mark user-space fence objects as signaled, and
3478c2ecf20Sopenharmony_ci * to determine whether a fence seqno might be stale.
3488c2ecf20Sopenharmony_ci * @fd: FD associated with the fence, -1 if not exported
3498c2ecf20Sopenharmony_ci * @error: This member should've been set to -EFAULT on submission.
3508c2ecf20Sopenharmony_ci * The following actions should be take on completion:
3518c2ecf20Sopenharmony_ci * error == -EFAULT: Fence communication failed. The host is synchronized.
3528c2ecf20Sopenharmony_ci * Use the last fence id read from the FIFO fence register.
3538c2ecf20Sopenharmony_ci * error != 0 && error != -EFAULT:
3548c2ecf20Sopenharmony_ci * Fence submission failed. The host is synchronized. Use the fence_seq member.
3558c2ecf20Sopenharmony_ci * error == 0: All is OK, The host may not be synchronized.
3568c2ecf20Sopenharmony_ci * Use the fence_seq member.
3578c2ecf20Sopenharmony_ci *
3588c2ecf20Sopenharmony_ci * Input / Output data to the DRM_VMW_EXECBUF Ioctl.
3598c2ecf20Sopenharmony_ci */
3608c2ecf20Sopenharmony_ci
3618c2ecf20Sopenharmony_cistruct drm_vmw_fence_rep {
3628c2ecf20Sopenharmony_ci	__u32 handle;
3638c2ecf20Sopenharmony_ci	__u32 mask;
3648c2ecf20Sopenharmony_ci	__u32 seqno;
3658c2ecf20Sopenharmony_ci	__u32 passed_seqno;
3668c2ecf20Sopenharmony_ci	__s32 fd;
3678c2ecf20Sopenharmony_ci	__s32 error;
3688c2ecf20Sopenharmony_ci};
3698c2ecf20Sopenharmony_ci
3708c2ecf20Sopenharmony_ci/*************************************************************************/
3718c2ecf20Sopenharmony_ci/**
3728c2ecf20Sopenharmony_ci * DRM_VMW_ALLOC_BO
3738c2ecf20Sopenharmony_ci *
3748c2ecf20Sopenharmony_ci * Allocate a buffer object that is visible also to the host.
3758c2ecf20Sopenharmony_ci * NOTE: The buffer is
3768c2ecf20Sopenharmony_ci * identified by a handle and an offset, which are private to the guest, but
3778c2ecf20Sopenharmony_ci * useable in the command stream. The guest kernel may translate these
3788c2ecf20Sopenharmony_ci * and patch up the command stream accordingly. In the future, the offset may
3798c2ecf20Sopenharmony_ci * be zero at all times, or it may disappear from the interface before it is
3808c2ecf20Sopenharmony_ci * fixed.
3818c2ecf20Sopenharmony_ci *
3828c2ecf20Sopenharmony_ci * The buffer object may stay user-space mapped in the guest at all times,
3838c2ecf20Sopenharmony_ci * and is thus suitable for sub-allocation.
3848c2ecf20Sopenharmony_ci *
3858c2ecf20Sopenharmony_ci * Buffer objects are mapped using the mmap() syscall on the drm device.
3868c2ecf20Sopenharmony_ci */
3878c2ecf20Sopenharmony_ci
3888c2ecf20Sopenharmony_ci/**
3898c2ecf20Sopenharmony_ci * struct drm_vmw_alloc_bo_req
3908c2ecf20Sopenharmony_ci *
3918c2ecf20Sopenharmony_ci * @size: Required minimum size of the buffer.
3928c2ecf20Sopenharmony_ci *
3938c2ecf20Sopenharmony_ci * Input data to the DRM_VMW_ALLOC_BO Ioctl.
3948c2ecf20Sopenharmony_ci */
3958c2ecf20Sopenharmony_ci
3968c2ecf20Sopenharmony_cistruct drm_vmw_alloc_bo_req {
3978c2ecf20Sopenharmony_ci	__u32 size;
3988c2ecf20Sopenharmony_ci	__u32 pad64;
3998c2ecf20Sopenharmony_ci};
4008c2ecf20Sopenharmony_ci#define drm_vmw_alloc_dmabuf_req drm_vmw_alloc_bo_req
4018c2ecf20Sopenharmony_ci
4028c2ecf20Sopenharmony_ci/**
4038c2ecf20Sopenharmony_ci * struct drm_vmw_bo_rep
4048c2ecf20Sopenharmony_ci *
4058c2ecf20Sopenharmony_ci * @map_handle: Offset to use in the mmap() call used to map the buffer.
4068c2ecf20Sopenharmony_ci * @handle: Handle unique to this buffer. Used for unreferencing.
4078c2ecf20Sopenharmony_ci * @cur_gmr_id: GMR id to use in the command stream when this buffer is
4088c2ecf20Sopenharmony_ci * referenced. See not above.
4098c2ecf20Sopenharmony_ci * @cur_gmr_offset: Offset to use in the command stream when this buffer is
4108c2ecf20Sopenharmony_ci * referenced. See note above.
4118c2ecf20Sopenharmony_ci *
4128c2ecf20Sopenharmony_ci * Output data from the DRM_VMW_ALLOC_BO Ioctl.
4138c2ecf20Sopenharmony_ci */
4148c2ecf20Sopenharmony_ci
4158c2ecf20Sopenharmony_cistruct drm_vmw_bo_rep {
4168c2ecf20Sopenharmony_ci	__u64 map_handle;
4178c2ecf20Sopenharmony_ci	__u32 handle;
4188c2ecf20Sopenharmony_ci	__u32 cur_gmr_id;
4198c2ecf20Sopenharmony_ci	__u32 cur_gmr_offset;
4208c2ecf20Sopenharmony_ci	__u32 pad64;
4218c2ecf20Sopenharmony_ci};
4228c2ecf20Sopenharmony_ci#define drm_vmw_dmabuf_rep drm_vmw_bo_rep
4238c2ecf20Sopenharmony_ci
4248c2ecf20Sopenharmony_ci/**
4258c2ecf20Sopenharmony_ci * union drm_vmw_alloc_bo_arg
4268c2ecf20Sopenharmony_ci *
4278c2ecf20Sopenharmony_ci * @req: Input data as described above.
4288c2ecf20Sopenharmony_ci * @rep: Output data as described above.
4298c2ecf20Sopenharmony_ci *
4308c2ecf20Sopenharmony_ci * Argument to the DRM_VMW_ALLOC_BO Ioctl.
4318c2ecf20Sopenharmony_ci */
4328c2ecf20Sopenharmony_ci
4338c2ecf20Sopenharmony_ciunion drm_vmw_alloc_bo_arg {
4348c2ecf20Sopenharmony_ci	struct drm_vmw_alloc_bo_req req;
4358c2ecf20Sopenharmony_ci	struct drm_vmw_bo_rep rep;
4368c2ecf20Sopenharmony_ci};
4378c2ecf20Sopenharmony_ci#define drm_vmw_alloc_dmabuf_arg drm_vmw_alloc_bo_arg
4388c2ecf20Sopenharmony_ci
4398c2ecf20Sopenharmony_ci/*************************************************************************/
4408c2ecf20Sopenharmony_ci/**
4418c2ecf20Sopenharmony_ci * DRM_VMW_CONTROL_STREAM - Control overlays, aka streams.
4428c2ecf20Sopenharmony_ci *
4438c2ecf20Sopenharmony_ci * This IOCTL controls the overlay units of the svga device.
4448c2ecf20Sopenharmony_ci * The SVGA overlay units does not work like regular hardware units in
4458c2ecf20Sopenharmony_ci * that they do not automaticaly read back the contents of the given dma
4468c2ecf20Sopenharmony_ci * buffer. But instead only read back for each call to this ioctl, and
4478c2ecf20Sopenharmony_ci * at any point between this call being made and a following call that
4488c2ecf20Sopenharmony_ci * either changes the buffer or disables the stream.
4498c2ecf20Sopenharmony_ci */
4508c2ecf20Sopenharmony_ci
4518c2ecf20Sopenharmony_ci/**
4528c2ecf20Sopenharmony_ci * struct drm_vmw_rect
4538c2ecf20Sopenharmony_ci *
4548c2ecf20Sopenharmony_ci * Defines a rectangle. Used in the overlay ioctl to define
4558c2ecf20Sopenharmony_ci * source and destination rectangle.
4568c2ecf20Sopenharmony_ci */
4578c2ecf20Sopenharmony_ci
4588c2ecf20Sopenharmony_cistruct drm_vmw_rect {
4598c2ecf20Sopenharmony_ci	__s32 x;
4608c2ecf20Sopenharmony_ci	__s32 y;
4618c2ecf20Sopenharmony_ci	__u32 w;
4628c2ecf20Sopenharmony_ci	__u32 h;
4638c2ecf20Sopenharmony_ci};
4648c2ecf20Sopenharmony_ci
4658c2ecf20Sopenharmony_ci/**
4668c2ecf20Sopenharmony_ci * struct drm_vmw_control_stream_arg
4678c2ecf20Sopenharmony_ci *
4688c2ecf20Sopenharmony_ci * @stream_id: Stearm to control
4698c2ecf20Sopenharmony_ci * @enabled: If false all following arguments are ignored.
4708c2ecf20Sopenharmony_ci * @handle: Handle to buffer for getting data from.
4718c2ecf20Sopenharmony_ci * @format: Format of the overlay as understood by the host.
4728c2ecf20Sopenharmony_ci * @width: Width of the overlay.
4738c2ecf20Sopenharmony_ci * @height: Height of the overlay.
4748c2ecf20Sopenharmony_ci * @size: Size of the overlay in bytes.
4758c2ecf20Sopenharmony_ci * @pitch: Array of pitches, the two last are only used for YUV12 formats.
4768c2ecf20Sopenharmony_ci * @offset: Offset from start of dma buffer to overlay.
4778c2ecf20Sopenharmony_ci * @src: Source rect, must be within the defined area above.
4788c2ecf20Sopenharmony_ci * @dst: Destination rect, x and y may be negative.
4798c2ecf20Sopenharmony_ci *
4808c2ecf20Sopenharmony_ci * Argument to the DRM_VMW_CONTROL_STREAM Ioctl.
4818c2ecf20Sopenharmony_ci */
4828c2ecf20Sopenharmony_ci
4838c2ecf20Sopenharmony_cistruct drm_vmw_control_stream_arg {
4848c2ecf20Sopenharmony_ci	__u32 stream_id;
4858c2ecf20Sopenharmony_ci	__u32 enabled;
4868c2ecf20Sopenharmony_ci
4878c2ecf20Sopenharmony_ci	__u32 flags;
4888c2ecf20Sopenharmony_ci	__u32 color_key;
4898c2ecf20Sopenharmony_ci
4908c2ecf20Sopenharmony_ci	__u32 handle;
4918c2ecf20Sopenharmony_ci	__u32 offset;
4928c2ecf20Sopenharmony_ci	__s32 format;
4938c2ecf20Sopenharmony_ci	__u32 size;
4948c2ecf20Sopenharmony_ci	__u32 width;
4958c2ecf20Sopenharmony_ci	__u32 height;
4968c2ecf20Sopenharmony_ci	__u32 pitch[3];
4978c2ecf20Sopenharmony_ci
4988c2ecf20Sopenharmony_ci	__u32 pad64;
4998c2ecf20Sopenharmony_ci	struct drm_vmw_rect src;
5008c2ecf20Sopenharmony_ci	struct drm_vmw_rect dst;
5018c2ecf20Sopenharmony_ci};
5028c2ecf20Sopenharmony_ci
5038c2ecf20Sopenharmony_ci/*************************************************************************/
5048c2ecf20Sopenharmony_ci/**
5058c2ecf20Sopenharmony_ci * DRM_VMW_CURSOR_BYPASS - Give extra information about cursor bypass.
5068c2ecf20Sopenharmony_ci *
5078c2ecf20Sopenharmony_ci */
5088c2ecf20Sopenharmony_ci
5098c2ecf20Sopenharmony_ci#define DRM_VMW_CURSOR_BYPASS_ALL    (1 << 0)
5108c2ecf20Sopenharmony_ci#define DRM_VMW_CURSOR_BYPASS_FLAGS       (1)
5118c2ecf20Sopenharmony_ci
5128c2ecf20Sopenharmony_ci/**
5138c2ecf20Sopenharmony_ci * struct drm_vmw_cursor_bypass_arg
5148c2ecf20Sopenharmony_ci *
5158c2ecf20Sopenharmony_ci * @flags: Flags.
5168c2ecf20Sopenharmony_ci * @crtc_id: Crtc id, only used if DMR_CURSOR_BYPASS_ALL isn't passed.
5178c2ecf20Sopenharmony_ci * @xpos: X position of cursor.
5188c2ecf20Sopenharmony_ci * @ypos: Y position of cursor.
5198c2ecf20Sopenharmony_ci * @xhot: X hotspot.
5208c2ecf20Sopenharmony_ci * @yhot: Y hotspot.
5218c2ecf20Sopenharmony_ci *
5228c2ecf20Sopenharmony_ci * Argument to the DRM_VMW_CURSOR_BYPASS Ioctl.
5238c2ecf20Sopenharmony_ci */
5248c2ecf20Sopenharmony_ci
5258c2ecf20Sopenharmony_cistruct drm_vmw_cursor_bypass_arg {
5268c2ecf20Sopenharmony_ci	__u32 flags;
5278c2ecf20Sopenharmony_ci	__u32 crtc_id;
5288c2ecf20Sopenharmony_ci	__s32 xpos;
5298c2ecf20Sopenharmony_ci	__s32 ypos;
5308c2ecf20Sopenharmony_ci	__s32 xhot;
5318c2ecf20Sopenharmony_ci	__s32 yhot;
5328c2ecf20Sopenharmony_ci};
5338c2ecf20Sopenharmony_ci
5348c2ecf20Sopenharmony_ci/*************************************************************************/
5358c2ecf20Sopenharmony_ci/**
5368c2ecf20Sopenharmony_ci * DRM_VMW_CLAIM_STREAM - Claim a single stream.
5378c2ecf20Sopenharmony_ci */
5388c2ecf20Sopenharmony_ci
5398c2ecf20Sopenharmony_ci/**
5408c2ecf20Sopenharmony_ci * struct drm_vmw_context_arg
5418c2ecf20Sopenharmony_ci *
5428c2ecf20Sopenharmony_ci * @stream_id: Device unique context ID.
5438c2ecf20Sopenharmony_ci *
5448c2ecf20Sopenharmony_ci * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
5458c2ecf20Sopenharmony_ci * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
5468c2ecf20Sopenharmony_ci */
5478c2ecf20Sopenharmony_ci
5488c2ecf20Sopenharmony_cistruct drm_vmw_stream_arg {
5498c2ecf20Sopenharmony_ci	__u32 stream_id;
5508c2ecf20Sopenharmony_ci	__u32 pad64;
5518c2ecf20Sopenharmony_ci};
5528c2ecf20Sopenharmony_ci
5538c2ecf20Sopenharmony_ci/*************************************************************************/
5548c2ecf20Sopenharmony_ci/**
5558c2ecf20Sopenharmony_ci * DRM_VMW_UNREF_STREAM - Unclaim a stream.
5568c2ecf20Sopenharmony_ci *
5578c2ecf20Sopenharmony_ci * Return a single stream that was claimed by this process. Also makes
5588c2ecf20Sopenharmony_ci * sure that the stream has been stopped.
5598c2ecf20Sopenharmony_ci */
5608c2ecf20Sopenharmony_ci
5618c2ecf20Sopenharmony_ci/*************************************************************************/
5628c2ecf20Sopenharmony_ci/**
5638c2ecf20Sopenharmony_ci * DRM_VMW_GET_3D_CAP
5648c2ecf20Sopenharmony_ci *
5658c2ecf20Sopenharmony_ci * Read 3D capabilities from the FIFO
5668c2ecf20Sopenharmony_ci *
5678c2ecf20Sopenharmony_ci */
5688c2ecf20Sopenharmony_ci
5698c2ecf20Sopenharmony_ci/**
5708c2ecf20Sopenharmony_ci * struct drm_vmw_get_3d_cap_arg
5718c2ecf20Sopenharmony_ci *
5728c2ecf20Sopenharmony_ci * @buffer: Pointer to a buffer for capability data, cast to an __u64
5738c2ecf20Sopenharmony_ci * @size: Max size to copy
5748c2ecf20Sopenharmony_ci *
5758c2ecf20Sopenharmony_ci * Input argument to the DRM_VMW_GET_3D_CAP_IOCTL
5768c2ecf20Sopenharmony_ci * ioctls.
5778c2ecf20Sopenharmony_ci */
5788c2ecf20Sopenharmony_ci
5798c2ecf20Sopenharmony_cistruct drm_vmw_get_3d_cap_arg {
5808c2ecf20Sopenharmony_ci	__u64 buffer;
5818c2ecf20Sopenharmony_ci	__u32 max_size;
5828c2ecf20Sopenharmony_ci	__u32 pad64;
5838c2ecf20Sopenharmony_ci};
5848c2ecf20Sopenharmony_ci
5858c2ecf20Sopenharmony_ci/*************************************************************************/
5868c2ecf20Sopenharmony_ci/**
5878c2ecf20Sopenharmony_ci * DRM_VMW_FENCE_WAIT
5888c2ecf20Sopenharmony_ci *
5898c2ecf20Sopenharmony_ci * Waits for a fence object to signal. The wait is interruptible, so that
5908c2ecf20Sopenharmony_ci * signals may be delivered during the interrupt. The wait may timeout,
5918c2ecf20Sopenharmony_ci * in which case the calls returns -EBUSY. If the wait is restarted,
5928c2ecf20Sopenharmony_ci * that is restarting without resetting @cookie_valid to zero,
5938c2ecf20Sopenharmony_ci * the timeout is computed from the first call.
5948c2ecf20Sopenharmony_ci *
5958c2ecf20Sopenharmony_ci * The flags argument to the DRM_VMW_FENCE_WAIT ioctl indicates what to wait
5968c2ecf20Sopenharmony_ci * on:
5978c2ecf20Sopenharmony_ci * DRM_VMW_FENCE_FLAG_EXEC: All commands ahead of the fence in the command
5988c2ecf20Sopenharmony_ci * stream
5998c2ecf20Sopenharmony_ci * have executed.
6008c2ecf20Sopenharmony_ci * DRM_VMW_FENCE_FLAG_QUERY: All query results resulting from query finish
6018c2ecf20Sopenharmony_ci * commands
6028c2ecf20Sopenharmony_ci * in the buffer given to the EXECBUF ioctl returning the fence object handle
6038c2ecf20Sopenharmony_ci * are available to user-space.
6048c2ecf20Sopenharmony_ci *
6058c2ecf20Sopenharmony_ci * DRM_VMW_WAIT_OPTION_UNREF: If this wait option is given, and the
6068c2ecf20Sopenharmony_ci * fenc wait ioctl returns 0, the fence object has been unreferenced after
6078c2ecf20Sopenharmony_ci * the wait.
6088c2ecf20Sopenharmony_ci */
6098c2ecf20Sopenharmony_ci
6108c2ecf20Sopenharmony_ci#define DRM_VMW_FENCE_FLAG_EXEC   (1 << 0)
6118c2ecf20Sopenharmony_ci#define DRM_VMW_FENCE_FLAG_QUERY  (1 << 1)
6128c2ecf20Sopenharmony_ci
6138c2ecf20Sopenharmony_ci#define DRM_VMW_WAIT_OPTION_UNREF (1 << 0)
6148c2ecf20Sopenharmony_ci
6158c2ecf20Sopenharmony_ci/**
6168c2ecf20Sopenharmony_ci * struct drm_vmw_fence_wait_arg
6178c2ecf20Sopenharmony_ci *
6188c2ecf20Sopenharmony_ci * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
6198c2ecf20Sopenharmony_ci * @cookie_valid: Must be reset to 0 on first call. Left alone on restart.
6208c2ecf20Sopenharmony_ci * @kernel_cookie: Set to 0 on first call. Left alone on restart.
6218c2ecf20Sopenharmony_ci * @timeout_us: Wait timeout in microseconds. 0 for indefinite timeout.
6228c2ecf20Sopenharmony_ci * @lazy: Set to 1 if timing is not critical. Allow more than a kernel tick
6238c2ecf20Sopenharmony_ci * before returning.
6248c2ecf20Sopenharmony_ci * @flags: Fence flags to wait on.
6258c2ecf20Sopenharmony_ci * @wait_options: Options that control the behaviour of the wait ioctl.
6268c2ecf20Sopenharmony_ci *
6278c2ecf20Sopenharmony_ci * Input argument to the DRM_VMW_FENCE_WAIT ioctl.
6288c2ecf20Sopenharmony_ci */
6298c2ecf20Sopenharmony_ci
6308c2ecf20Sopenharmony_cistruct drm_vmw_fence_wait_arg {
6318c2ecf20Sopenharmony_ci	__u32 handle;
6328c2ecf20Sopenharmony_ci	__s32  cookie_valid;
6338c2ecf20Sopenharmony_ci	__u64 kernel_cookie;
6348c2ecf20Sopenharmony_ci	__u64 timeout_us;
6358c2ecf20Sopenharmony_ci	__s32 lazy;
6368c2ecf20Sopenharmony_ci	__s32 flags;
6378c2ecf20Sopenharmony_ci	__s32 wait_options;
6388c2ecf20Sopenharmony_ci	__s32 pad64;
6398c2ecf20Sopenharmony_ci};
6408c2ecf20Sopenharmony_ci
6418c2ecf20Sopenharmony_ci/*************************************************************************/
6428c2ecf20Sopenharmony_ci/**
6438c2ecf20Sopenharmony_ci * DRM_VMW_FENCE_SIGNALED
6448c2ecf20Sopenharmony_ci *
6458c2ecf20Sopenharmony_ci * Checks if a fence object is signaled..
6468c2ecf20Sopenharmony_ci */
6478c2ecf20Sopenharmony_ci
6488c2ecf20Sopenharmony_ci/**
6498c2ecf20Sopenharmony_ci * struct drm_vmw_fence_signaled_arg
6508c2ecf20Sopenharmony_ci *
6518c2ecf20Sopenharmony_ci * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
6528c2ecf20Sopenharmony_ci * @flags: Fence object flags input to DRM_VMW_FENCE_SIGNALED ioctl
6538c2ecf20Sopenharmony_ci * @signaled: Out: Flags signaled.
6548c2ecf20Sopenharmony_ci * @sequence: Out: Highest sequence passed so far. Can be used to signal the
6558c2ecf20Sopenharmony_ci * EXEC flag of user-space fence objects.
6568c2ecf20Sopenharmony_ci *
6578c2ecf20Sopenharmony_ci * Input/Output argument to the DRM_VMW_FENCE_SIGNALED and DRM_VMW_FENCE_UNREF
6588c2ecf20Sopenharmony_ci * ioctls.
6598c2ecf20Sopenharmony_ci */
6608c2ecf20Sopenharmony_ci
6618c2ecf20Sopenharmony_cistruct drm_vmw_fence_signaled_arg {
6628c2ecf20Sopenharmony_ci	 __u32 handle;
6638c2ecf20Sopenharmony_ci	 __u32 flags;
6648c2ecf20Sopenharmony_ci	 __s32 signaled;
6658c2ecf20Sopenharmony_ci	 __u32 passed_seqno;
6668c2ecf20Sopenharmony_ci	 __u32 signaled_flags;
6678c2ecf20Sopenharmony_ci	 __u32 pad64;
6688c2ecf20Sopenharmony_ci};
6698c2ecf20Sopenharmony_ci
6708c2ecf20Sopenharmony_ci/*************************************************************************/
6718c2ecf20Sopenharmony_ci/**
6728c2ecf20Sopenharmony_ci * DRM_VMW_FENCE_UNREF
6738c2ecf20Sopenharmony_ci *
6748c2ecf20Sopenharmony_ci * Unreferences a fence object, and causes it to be destroyed if there are no
6758c2ecf20Sopenharmony_ci * other references to it.
6768c2ecf20Sopenharmony_ci *
6778c2ecf20Sopenharmony_ci */
6788c2ecf20Sopenharmony_ci
6798c2ecf20Sopenharmony_ci/**
6808c2ecf20Sopenharmony_ci * struct drm_vmw_fence_arg
6818c2ecf20Sopenharmony_ci *
6828c2ecf20Sopenharmony_ci * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
6838c2ecf20Sopenharmony_ci *
6848c2ecf20Sopenharmony_ci * Input/Output argument to the DRM_VMW_FENCE_UNREF ioctl..
6858c2ecf20Sopenharmony_ci */
6868c2ecf20Sopenharmony_ci
6878c2ecf20Sopenharmony_cistruct drm_vmw_fence_arg {
6888c2ecf20Sopenharmony_ci	 __u32 handle;
6898c2ecf20Sopenharmony_ci	 __u32 pad64;
6908c2ecf20Sopenharmony_ci};
6918c2ecf20Sopenharmony_ci
6928c2ecf20Sopenharmony_ci
6938c2ecf20Sopenharmony_ci/*************************************************************************/
6948c2ecf20Sopenharmony_ci/**
6958c2ecf20Sopenharmony_ci * DRM_VMW_FENCE_EVENT
6968c2ecf20Sopenharmony_ci *
6978c2ecf20Sopenharmony_ci * Queues an event on a fence to be delivered on the drm character device
6988c2ecf20Sopenharmony_ci * when the fence has signaled the DRM_VMW_FENCE_FLAG_EXEC flag.
6998c2ecf20Sopenharmony_ci * Optionally the approximate time when the fence signaled is
7008c2ecf20Sopenharmony_ci * given by the event.
7018c2ecf20Sopenharmony_ci */
7028c2ecf20Sopenharmony_ci
7038c2ecf20Sopenharmony_ci/*
7048c2ecf20Sopenharmony_ci * The event type
7058c2ecf20Sopenharmony_ci */
7068c2ecf20Sopenharmony_ci#define DRM_VMW_EVENT_FENCE_SIGNALED 0x80000000
7078c2ecf20Sopenharmony_ci
7088c2ecf20Sopenharmony_cistruct drm_vmw_event_fence {
7098c2ecf20Sopenharmony_ci	struct drm_event base;
7108c2ecf20Sopenharmony_ci	__u64 user_data;
7118c2ecf20Sopenharmony_ci	__u32 tv_sec;
7128c2ecf20Sopenharmony_ci	__u32 tv_usec;
7138c2ecf20Sopenharmony_ci};
7148c2ecf20Sopenharmony_ci
7158c2ecf20Sopenharmony_ci/*
7168c2ecf20Sopenharmony_ci * Flags that may be given to the command.
7178c2ecf20Sopenharmony_ci */
7188c2ecf20Sopenharmony_ci/* Request fence signaled time on the event. */
7198c2ecf20Sopenharmony_ci#define DRM_VMW_FE_FLAG_REQ_TIME (1 << 0)
7208c2ecf20Sopenharmony_ci
7218c2ecf20Sopenharmony_ci/**
7228c2ecf20Sopenharmony_ci * struct drm_vmw_fence_event_arg
7238c2ecf20Sopenharmony_ci *
7248c2ecf20Sopenharmony_ci * @fence_rep: Pointer to fence_rep structure cast to __u64 or 0 if
7258c2ecf20Sopenharmony_ci * the fence is not supposed to be referenced by user-space.
7268c2ecf20Sopenharmony_ci * @user_info: Info to be delivered with the event.
7278c2ecf20Sopenharmony_ci * @handle: Attach the event to this fence only.
7288c2ecf20Sopenharmony_ci * @flags: A set of flags as defined above.
7298c2ecf20Sopenharmony_ci */
7308c2ecf20Sopenharmony_cistruct drm_vmw_fence_event_arg {
7318c2ecf20Sopenharmony_ci	__u64 fence_rep;
7328c2ecf20Sopenharmony_ci	__u64 user_data;
7338c2ecf20Sopenharmony_ci	__u32 handle;
7348c2ecf20Sopenharmony_ci	__u32 flags;
7358c2ecf20Sopenharmony_ci};
7368c2ecf20Sopenharmony_ci
7378c2ecf20Sopenharmony_ci
7388c2ecf20Sopenharmony_ci/*************************************************************************/
7398c2ecf20Sopenharmony_ci/**
7408c2ecf20Sopenharmony_ci * DRM_VMW_PRESENT
7418c2ecf20Sopenharmony_ci *
7428c2ecf20Sopenharmony_ci * Executes an SVGA present on a given fb for a given surface. The surface
7438c2ecf20Sopenharmony_ci * is placed on the framebuffer. Cliprects are given relative to the given
7448c2ecf20Sopenharmony_ci * point (the point disignated by dest_{x|y}).
7458c2ecf20Sopenharmony_ci *
7468c2ecf20Sopenharmony_ci */
7478c2ecf20Sopenharmony_ci
7488c2ecf20Sopenharmony_ci/**
7498c2ecf20Sopenharmony_ci * struct drm_vmw_present_arg
7508c2ecf20Sopenharmony_ci * @fb_id: framebuffer id to present / read back from.
7518c2ecf20Sopenharmony_ci * @sid: Surface id to present from.
7528c2ecf20Sopenharmony_ci * @dest_x: X placement coordinate for surface.
7538c2ecf20Sopenharmony_ci * @dest_y: Y placement coordinate for surface.
7548c2ecf20Sopenharmony_ci * @clips_ptr: Pointer to an array of clip rects cast to an __u64.
7558c2ecf20Sopenharmony_ci * @num_clips: Number of cliprects given relative to the framebuffer origin,
7568c2ecf20Sopenharmony_ci * in the same coordinate space as the frame buffer.
7578c2ecf20Sopenharmony_ci * @pad64: Unused 64-bit padding.
7588c2ecf20Sopenharmony_ci *
7598c2ecf20Sopenharmony_ci * Input argument to the DRM_VMW_PRESENT ioctl.
7608c2ecf20Sopenharmony_ci */
7618c2ecf20Sopenharmony_ci
7628c2ecf20Sopenharmony_cistruct drm_vmw_present_arg {
7638c2ecf20Sopenharmony_ci	__u32 fb_id;
7648c2ecf20Sopenharmony_ci	__u32 sid;
7658c2ecf20Sopenharmony_ci	__s32 dest_x;
7668c2ecf20Sopenharmony_ci	__s32 dest_y;
7678c2ecf20Sopenharmony_ci	__u64 clips_ptr;
7688c2ecf20Sopenharmony_ci	__u32 num_clips;
7698c2ecf20Sopenharmony_ci	__u32 pad64;
7708c2ecf20Sopenharmony_ci};
7718c2ecf20Sopenharmony_ci
7728c2ecf20Sopenharmony_ci
7738c2ecf20Sopenharmony_ci/*************************************************************************/
7748c2ecf20Sopenharmony_ci/**
7758c2ecf20Sopenharmony_ci * DRM_VMW_PRESENT_READBACK
7768c2ecf20Sopenharmony_ci *
7778c2ecf20Sopenharmony_ci * Executes an SVGA present readback from a given fb to the dma buffer
7788c2ecf20Sopenharmony_ci * currently bound as the fb. If there is no dma buffer bound to the fb,
7798c2ecf20Sopenharmony_ci * an error will be returned.
7808c2ecf20Sopenharmony_ci *
7818c2ecf20Sopenharmony_ci */
7828c2ecf20Sopenharmony_ci
7838c2ecf20Sopenharmony_ci/**
7848c2ecf20Sopenharmony_ci * struct drm_vmw_present_arg
7858c2ecf20Sopenharmony_ci * @fb_id: fb_id to present / read back from.
7868c2ecf20Sopenharmony_ci * @num_clips: Number of cliprects.
7878c2ecf20Sopenharmony_ci * @clips_ptr: Pointer to an array of clip rects cast to an __u64.
7888c2ecf20Sopenharmony_ci * @fence_rep: Pointer to a struct drm_vmw_fence_rep, cast to an __u64.
7898c2ecf20Sopenharmony_ci * If this member is NULL, then the ioctl should not return a fence.
7908c2ecf20Sopenharmony_ci */
7918c2ecf20Sopenharmony_ci
7928c2ecf20Sopenharmony_cistruct drm_vmw_present_readback_arg {
7938c2ecf20Sopenharmony_ci	 __u32 fb_id;
7948c2ecf20Sopenharmony_ci	 __u32 num_clips;
7958c2ecf20Sopenharmony_ci	 __u64 clips_ptr;
7968c2ecf20Sopenharmony_ci	 __u64 fence_rep;
7978c2ecf20Sopenharmony_ci};
7988c2ecf20Sopenharmony_ci
7998c2ecf20Sopenharmony_ci/*************************************************************************/
8008c2ecf20Sopenharmony_ci/**
8018c2ecf20Sopenharmony_ci * DRM_VMW_UPDATE_LAYOUT - Update layout
8028c2ecf20Sopenharmony_ci *
8038c2ecf20Sopenharmony_ci * Updates the preferred modes and connection status for connectors. The
8048c2ecf20Sopenharmony_ci * command consists of one drm_vmw_update_layout_arg pointing to an array
8058c2ecf20Sopenharmony_ci * of num_outputs drm_vmw_rect's.
8068c2ecf20Sopenharmony_ci */
8078c2ecf20Sopenharmony_ci
8088c2ecf20Sopenharmony_ci/**
8098c2ecf20Sopenharmony_ci * struct drm_vmw_update_layout_arg
8108c2ecf20Sopenharmony_ci *
8118c2ecf20Sopenharmony_ci * @num_outputs: number of active connectors
8128c2ecf20Sopenharmony_ci * @rects: pointer to array of drm_vmw_rect cast to an __u64
8138c2ecf20Sopenharmony_ci *
8148c2ecf20Sopenharmony_ci * Input argument to the DRM_VMW_UPDATE_LAYOUT Ioctl.
8158c2ecf20Sopenharmony_ci */
8168c2ecf20Sopenharmony_cistruct drm_vmw_update_layout_arg {
8178c2ecf20Sopenharmony_ci	__u32 num_outputs;
8188c2ecf20Sopenharmony_ci	__u32 pad64;
8198c2ecf20Sopenharmony_ci	__u64 rects;
8208c2ecf20Sopenharmony_ci};
8218c2ecf20Sopenharmony_ci
8228c2ecf20Sopenharmony_ci
8238c2ecf20Sopenharmony_ci/*************************************************************************/
8248c2ecf20Sopenharmony_ci/**
8258c2ecf20Sopenharmony_ci * DRM_VMW_CREATE_SHADER - Create shader
8268c2ecf20Sopenharmony_ci *
8278c2ecf20Sopenharmony_ci * Creates a shader and optionally binds it to a dma buffer containing
8288c2ecf20Sopenharmony_ci * the shader byte-code.
8298c2ecf20Sopenharmony_ci */
8308c2ecf20Sopenharmony_ci
8318c2ecf20Sopenharmony_ci/**
8328c2ecf20Sopenharmony_ci * enum drm_vmw_shader_type - Shader types
8338c2ecf20Sopenharmony_ci */
8348c2ecf20Sopenharmony_cienum drm_vmw_shader_type {
8358c2ecf20Sopenharmony_ci	drm_vmw_shader_type_vs = 0,
8368c2ecf20Sopenharmony_ci	drm_vmw_shader_type_ps,
8378c2ecf20Sopenharmony_ci};
8388c2ecf20Sopenharmony_ci
8398c2ecf20Sopenharmony_ci
8408c2ecf20Sopenharmony_ci/**
8418c2ecf20Sopenharmony_ci * struct drm_vmw_shader_create_arg
8428c2ecf20Sopenharmony_ci *
8438c2ecf20Sopenharmony_ci * @shader_type: Shader type of the shader to create.
8448c2ecf20Sopenharmony_ci * @size: Size of the byte-code in bytes.
8458c2ecf20Sopenharmony_ci * where the shader byte-code starts
8468c2ecf20Sopenharmony_ci * @buffer_handle: Buffer handle identifying the buffer containing the
8478c2ecf20Sopenharmony_ci * shader byte-code
8488c2ecf20Sopenharmony_ci * @shader_handle: On successful completion contains a handle that
8498c2ecf20Sopenharmony_ci * can be used to subsequently identify the shader.
8508c2ecf20Sopenharmony_ci * @offset: Offset in bytes into the buffer given by @buffer_handle,
8518c2ecf20Sopenharmony_ci *
8528c2ecf20Sopenharmony_ci * Input / Output argument to the DRM_VMW_CREATE_SHADER Ioctl.
8538c2ecf20Sopenharmony_ci */
8548c2ecf20Sopenharmony_cistruct drm_vmw_shader_create_arg {
8558c2ecf20Sopenharmony_ci	enum drm_vmw_shader_type shader_type;
8568c2ecf20Sopenharmony_ci	__u32 size;
8578c2ecf20Sopenharmony_ci	__u32 buffer_handle;
8588c2ecf20Sopenharmony_ci	__u32 shader_handle;
8598c2ecf20Sopenharmony_ci	__u64 offset;
8608c2ecf20Sopenharmony_ci};
8618c2ecf20Sopenharmony_ci
8628c2ecf20Sopenharmony_ci/*************************************************************************/
8638c2ecf20Sopenharmony_ci/**
8648c2ecf20Sopenharmony_ci * DRM_VMW_UNREF_SHADER - Unreferences a shader
8658c2ecf20Sopenharmony_ci *
8668c2ecf20Sopenharmony_ci * Destroys a user-space reference to a shader, optionally destroying
8678c2ecf20Sopenharmony_ci * it.
8688c2ecf20Sopenharmony_ci */
8698c2ecf20Sopenharmony_ci
8708c2ecf20Sopenharmony_ci/**
8718c2ecf20Sopenharmony_ci * struct drm_vmw_shader_arg
8728c2ecf20Sopenharmony_ci *
8738c2ecf20Sopenharmony_ci * @handle: Handle identifying the shader to destroy.
8748c2ecf20Sopenharmony_ci *
8758c2ecf20Sopenharmony_ci * Input argument to the DRM_VMW_UNREF_SHADER ioctl.
8768c2ecf20Sopenharmony_ci */
8778c2ecf20Sopenharmony_cistruct drm_vmw_shader_arg {
8788c2ecf20Sopenharmony_ci	__u32 handle;
8798c2ecf20Sopenharmony_ci	__u32 pad64;
8808c2ecf20Sopenharmony_ci};
8818c2ecf20Sopenharmony_ci
8828c2ecf20Sopenharmony_ci/*************************************************************************/
8838c2ecf20Sopenharmony_ci/**
8848c2ecf20Sopenharmony_ci * DRM_VMW_GB_SURFACE_CREATE - Create a host guest-backed surface.
8858c2ecf20Sopenharmony_ci *
8868c2ecf20Sopenharmony_ci * Allocates a surface handle and queues a create surface command
8878c2ecf20Sopenharmony_ci * for the host on the first use of the surface. The surface ID can
8888c2ecf20Sopenharmony_ci * be used as the surface ID in commands referencing the surface.
8898c2ecf20Sopenharmony_ci */
8908c2ecf20Sopenharmony_ci
8918c2ecf20Sopenharmony_ci/**
8928c2ecf20Sopenharmony_ci * enum drm_vmw_surface_flags
8938c2ecf20Sopenharmony_ci *
8948c2ecf20Sopenharmony_ci * @drm_vmw_surface_flag_shareable:     Whether the surface is shareable
8958c2ecf20Sopenharmony_ci * @drm_vmw_surface_flag_scanout:       Whether the surface is a scanout
8968c2ecf20Sopenharmony_ci *                                      surface.
8978c2ecf20Sopenharmony_ci * @drm_vmw_surface_flag_create_buffer: Create a backup buffer if none is
8988c2ecf20Sopenharmony_ci *                                      given.
8998c2ecf20Sopenharmony_ci * @drm_vmw_surface_flag_coherent:      Back surface with coherent memory.
9008c2ecf20Sopenharmony_ci */
9018c2ecf20Sopenharmony_cienum drm_vmw_surface_flags {
9028c2ecf20Sopenharmony_ci	drm_vmw_surface_flag_shareable = (1 << 0),
9038c2ecf20Sopenharmony_ci	drm_vmw_surface_flag_scanout = (1 << 1),
9048c2ecf20Sopenharmony_ci	drm_vmw_surface_flag_create_buffer = (1 << 2),
9058c2ecf20Sopenharmony_ci	drm_vmw_surface_flag_coherent = (1 << 3),
9068c2ecf20Sopenharmony_ci};
9078c2ecf20Sopenharmony_ci
9088c2ecf20Sopenharmony_ci/**
9098c2ecf20Sopenharmony_ci * struct drm_vmw_gb_surface_create_req
9108c2ecf20Sopenharmony_ci *
9118c2ecf20Sopenharmony_ci * @svga3d_flags:     SVGA3d surface flags for the device.
9128c2ecf20Sopenharmony_ci * @format:           SVGA3d format.
9138c2ecf20Sopenharmony_ci * @mip_level:        Number of mip levels for all faces.
9148c2ecf20Sopenharmony_ci * @drm_surface_flags Flags as described above.
9158c2ecf20Sopenharmony_ci * @multisample_count Future use. Set to 0.
9168c2ecf20Sopenharmony_ci * @autogen_filter    Future use. Set to 0.
9178c2ecf20Sopenharmony_ci * @buffer_handle     Buffer handle of backup buffer. SVGA3D_INVALID_ID
9188c2ecf20Sopenharmony_ci *                    if none.
9198c2ecf20Sopenharmony_ci * @base_size         Size of the base mip level for all faces.
9208c2ecf20Sopenharmony_ci * @array_size        Must be zero for non-DX hardware, and if non-zero
9218c2ecf20Sopenharmony_ci *                    svga3d_flags must have proper bind flags setup.
9228c2ecf20Sopenharmony_ci *
9238c2ecf20Sopenharmony_ci * Input argument to the  DRM_VMW_GB_SURFACE_CREATE Ioctl.
9248c2ecf20Sopenharmony_ci * Part of output argument for the DRM_VMW_GB_SURFACE_REF Ioctl.
9258c2ecf20Sopenharmony_ci */
9268c2ecf20Sopenharmony_cistruct drm_vmw_gb_surface_create_req {
9278c2ecf20Sopenharmony_ci	__u32 svga3d_flags;
9288c2ecf20Sopenharmony_ci	__u32 format;
9298c2ecf20Sopenharmony_ci	__u32 mip_levels;
9308c2ecf20Sopenharmony_ci	enum drm_vmw_surface_flags drm_surface_flags;
9318c2ecf20Sopenharmony_ci	__u32 multisample_count;
9328c2ecf20Sopenharmony_ci	__u32 autogen_filter;
9338c2ecf20Sopenharmony_ci	__u32 buffer_handle;
9348c2ecf20Sopenharmony_ci	__u32 array_size;
9358c2ecf20Sopenharmony_ci	struct drm_vmw_size base_size;
9368c2ecf20Sopenharmony_ci};
9378c2ecf20Sopenharmony_ci
9388c2ecf20Sopenharmony_ci/**
9398c2ecf20Sopenharmony_ci * struct drm_vmw_gb_surface_create_rep
9408c2ecf20Sopenharmony_ci *
9418c2ecf20Sopenharmony_ci * @handle:            Surface handle.
9428c2ecf20Sopenharmony_ci * @backup_size:       Size of backup buffers for this surface.
9438c2ecf20Sopenharmony_ci * @buffer_handle:     Handle of backup buffer. SVGA3D_INVALID_ID if none.
9448c2ecf20Sopenharmony_ci * @buffer_size:       Actual size of the buffer identified by
9458c2ecf20Sopenharmony_ci *                     @buffer_handle
9468c2ecf20Sopenharmony_ci * @buffer_map_handle: Offset into device address space for the buffer
9478c2ecf20Sopenharmony_ci *                     identified by @buffer_handle.
9488c2ecf20Sopenharmony_ci *
9498c2ecf20Sopenharmony_ci * Part of output argument for the DRM_VMW_GB_SURFACE_REF ioctl.
9508c2ecf20Sopenharmony_ci * Output argument for the DRM_VMW_GB_SURFACE_CREATE ioctl.
9518c2ecf20Sopenharmony_ci */
9528c2ecf20Sopenharmony_cistruct drm_vmw_gb_surface_create_rep {
9538c2ecf20Sopenharmony_ci	__u32 handle;
9548c2ecf20Sopenharmony_ci	__u32 backup_size;
9558c2ecf20Sopenharmony_ci	__u32 buffer_handle;
9568c2ecf20Sopenharmony_ci	__u32 buffer_size;
9578c2ecf20Sopenharmony_ci	__u64 buffer_map_handle;
9588c2ecf20Sopenharmony_ci};
9598c2ecf20Sopenharmony_ci
9608c2ecf20Sopenharmony_ci/**
9618c2ecf20Sopenharmony_ci * union drm_vmw_gb_surface_create_arg
9628c2ecf20Sopenharmony_ci *
9638c2ecf20Sopenharmony_ci * @req: Input argument as described above.
9648c2ecf20Sopenharmony_ci * @rep: Output argument as described above.
9658c2ecf20Sopenharmony_ci *
9668c2ecf20Sopenharmony_ci * Argument to the DRM_VMW_GB_SURFACE_CREATE ioctl.
9678c2ecf20Sopenharmony_ci */
9688c2ecf20Sopenharmony_ciunion drm_vmw_gb_surface_create_arg {
9698c2ecf20Sopenharmony_ci	struct drm_vmw_gb_surface_create_rep rep;
9708c2ecf20Sopenharmony_ci	struct drm_vmw_gb_surface_create_req req;
9718c2ecf20Sopenharmony_ci};
9728c2ecf20Sopenharmony_ci
9738c2ecf20Sopenharmony_ci/*************************************************************************/
9748c2ecf20Sopenharmony_ci/**
9758c2ecf20Sopenharmony_ci * DRM_VMW_GB_SURFACE_REF - Reference a host surface.
9768c2ecf20Sopenharmony_ci *
9778c2ecf20Sopenharmony_ci * Puts a reference on a host surface with a given handle, as previously
9788c2ecf20Sopenharmony_ci * returned by the DRM_VMW_GB_SURFACE_CREATE ioctl.
9798c2ecf20Sopenharmony_ci * A reference will make sure the surface isn't destroyed while we hold
9808c2ecf20Sopenharmony_ci * it and will allow the calling client to use the surface handle in
9818c2ecf20Sopenharmony_ci * the command stream.
9828c2ecf20Sopenharmony_ci *
9838c2ecf20Sopenharmony_ci * On successful return, the Ioctl returns the surface information given
9848c2ecf20Sopenharmony_ci * to and returned from the DRM_VMW_GB_SURFACE_CREATE ioctl.
9858c2ecf20Sopenharmony_ci */
9868c2ecf20Sopenharmony_ci
9878c2ecf20Sopenharmony_ci/**
9888c2ecf20Sopenharmony_ci * struct drm_vmw_gb_surface_reference_arg
9898c2ecf20Sopenharmony_ci *
9908c2ecf20Sopenharmony_ci * @creq: The data used as input when the surface was created, as described
9918c2ecf20Sopenharmony_ci *        above at "struct drm_vmw_gb_surface_create_req"
9928c2ecf20Sopenharmony_ci * @crep: Additional data output when the surface was created, as described
9938c2ecf20Sopenharmony_ci *        above at "struct drm_vmw_gb_surface_create_rep"
9948c2ecf20Sopenharmony_ci *
9958c2ecf20Sopenharmony_ci * Output Argument to the DRM_VMW_GB_SURFACE_REF ioctl.
9968c2ecf20Sopenharmony_ci */
9978c2ecf20Sopenharmony_cistruct drm_vmw_gb_surface_ref_rep {
9988c2ecf20Sopenharmony_ci	struct drm_vmw_gb_surface_create_req creq;
9998c2ecf20Sopenharmony_ci	struct drm_vmw_gb_surface_create_rep crep;
10008c2ecf20Sopenharmony_ci};
10018c2ecf20Sopenharmony_ci
10028c2ecf20Sopenharmony_ci/**
10038c2ecf20Sopenharmony_ci * union drm_vmw_gb_surface_reference_arg
10048c2ecf20Sopenharmony_ci *
10058c2ecf20Sopenharmony_ci * @req: Input data as described above at "struct drm_vmw_surface_arg"
10068c2ecf20Sopenharmony_ci * @rep: Output data as described above at "struct drm_vmw_gb_surface_ref_rep"
10078c2ecf20Sopenharmony_ci *
10088c2ecf20Sopenharmony_ci * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl.
10098c2ecf20Sopenharmony_ci */
10108c2ecf20Sopenharmony_ciunion drm_vmw_gb_surface_reference_arg {
10118c2ecf20Sopenharmony_ci	struct drm_vmw_gb_surface_ref_rep rep;
10128c2ecf20Sopenharmony_ci	struct drm_vmw_surface_arg req;
10138c2ecf20Sopenharmony_ci};
10148c2ecf20Sopenharmony_ci
10158c2ecf20Sopenharmony_ci
10168c2ecf20Sopenharmony_ci/*************************************************************************/
10178c2ecf20Sopenharmony_ci/**
10188c2ecf20Sopenharmony_ci * DRM_VMW_SYNCCPU - Sync a DMA buffer / MOB for CPU access.
10198c2ecf20Sopenharmony_ci *
10208c2ecf20Sopenharmony_ci * Idles any previously submitted GPU operations on the buffer and
10218c2ecf20Sopenharmony_ci * by default blocks command submissions that reference the buffer.
10228c2ecf20Sopenharmony_ci * If the file descriptor used to grab a blocking CPU sync is closed, the
10238c2ecf20Sopenharmony_ci * cpu sync is released.
10248c2ecf20Sopenharmony_ci * The flags argument indicates how the grab / release operation should be
10258c2ecf20Sopenharmony_ci * performed:
10268c2ecf20Sopenharmony_ci */
10278c2ecf20Sopenharmony_ci
10288c2ecf20Sopenharmony_ci/**
10298c2ecf20Sopenharmony_ci * enum drm_vmw_synccpu_flags - Synccpu flags:
10308c2ecf20Sopenharmony_ci *
10318c2ecf20Sopenharmony_ci * @drm_vmw_synccpu_read: Sync for read. If sync is done for read only, it's a
10328c2ecf20Sopenharmony_ci * hint to the kernel to allow command submissions that references the buffer
10338c2ecf20Sopenharmony_ci * for read-only.
10348c2ecf20Sopenharmony_ci * @drm_vmw_synccpu_write: Sync for write. Block all command submissions
10358c2ecf20Sopenharmony_ci * referencing this buffer.
10368c2ecf20Sopenharmony_ci * @drm_vmw_synccpu_dontblock: Dont wait for GPU idle, but rather return
10378c2ecf20Sopenharmony_ci * -EBUSY should the buffer be busy.
10388c2ecf20Sopenharmony_ci * @drm_vmw_synccpu_allow_cs: Allow command submission that touches the buffer
10398c2ecf20Sopenharmony_ci * while the buffer is synced for CPU. This is similar to the GEM bo idle
10408c2ecf20Sopenharmony_ci * behavior.
10418c2ecf20Sopenharmony_ci */
10428c2ecf20Sopenharmony_cienum drm_vmw_synccpu_flags {
10438c2ecf20Sopenharmony_ci	drm_vmw_synccpu_read = (1 << 0),
10448c2ecf20Sopenharmony_ci	drm_vmw_synccpu_write = (1 << 1),
10458c2ecf20Sopenharmony_ci	drm_vmw_synccpu_dontblock = (1 << 2),
10468c2ecf20Sopenharmony_ci	drm_vmw_synccpu_allow_cs = (1 << 3)
10478c2ecf20Sopenharmony_ci};
10488c2ecf20Sopenharmony_ci
10498c2ecf20Sopenharmony_ci/**
10508c2ecf20Sopenharmony_ci * enum drm_vmw_synccpu_op - Synccpu operations:
10518c2ecf20Sopenharmony_ci *
10528c2ecf20Sopenharmony_ci * @drm_vmw_synccpu_grab:    Grab the buffer for CPU operations
10538c2ecf20Sopenharmony_ci * @drm_vmw_synccpu_release: Release a previous grab.
10548c2ecf20Sopenharmony_ci */
10558c2ecf20Sopenharmony_cienum drm_vmw_synccpu_op {
10568c2ecf20Sopenharmony_ci	drm_vmw_synccpu_grab,
10578c2ecf20Sopenharmony_ci	drm_vmw_synccpu_release
10588c2ecf20Sopenharmony_ci};
10598c2ecf20Sopenharmony_ci
10608c2ecf20Sopenharmony_ci/**
10618c2ecf20Sopenharmony_ci * struct drm_vmw_synccpu_arg
10628c2ecf20Sopenharmony_ci *
10638c2ecf20Sopenharmony_ci * @op:			     The synccpu operation as described above.
10648c2ecf20Sopenharmony_ci * @handle:		     Handle identifying the buffer object.
10658c2ecf20Sopenharmony_ci * @flags:		     Flags as described above.
10668c2ecf20Sopenharmony_ci */
10678c2ecf20Sopenharmony_cistruct drm_vmw_synccpu_arg {
10688c2ecf20Sopenharmony_ci	enum drm_vmw_synccpu_op op;
10698c2ecf20Sopenharmony_ci	enum drm_vmw_synccpu_flags flags;
10708c2ecf20Sopenharmony_ci	__u32 handle;
10718c2ecf20Sopenharmony_ci	__u32 pad64;
10728c2ecf20Sopenharmony_ci};
10738c2ecf20Sopenharmony_ci
10748c2ecf20Sopenharmony_ci/*************************************************************************/
10758c2ecf20Sopenharmony_ci/**
10768c2ecf20Sopenharmony_ci * DRM_VMW_CREATE_EXTENDED_CONTEXT - Create a host context.
10778c2ecf20Sopenharmony_ci *
10788c2ecf20Sopenharmony_ci * Allocates a device unique context id, and queues a create context command
10798c2ecf20Sopenharmony_ci * for the host. Does not wait for host completion.
10808c2ecf20Sopenharmony_ci */
10818c2ecf20Sopenharmony_cienum drm_vmw_extended_context {
10828c2ecf20Sopenharmony_ci	drm_vmw_context_legacy,
10838c2ecf20Sopenharmony_ci	drm_vmw_context_dx
10848c2ecf20Sopenharmony_ci};
10858c2ecf20Sopenharmony_ci
10868c2ecf20Sopenharmony_ci/**
10878c2ecf20Sopenharmony_ci * union drm_vmw_extended_context_arg
10888c2ecf20Sopenharmony_ci *
10898c2ecf20Sopenharmony_ci * @req: Context type.
10908c2ecf20Sopenharmony_ci * @rep: Context identifier.
10918c2ecf20Sopenharmony_ci *
10928c2ecf20Sopenharmony_ci * Argument to the DRM_VMW_CREATE_EXTENDED_CONTEXT Ioctl.
10938c2ecf20Sopenharmony_ci */
10948c2ecf20Sopenharmony_ciunion drm_vmw_extended_context_arg {
10958c2ecf20Sopenharmony_ci	enum drm_vmw_extended_context req;
10968c2ecf20Sopenharmony_ci	struct drm_vmw_context_arg rep;
10978c2ecf20Sopenharmony_ci};
10988c2ecf20Sopenharmony_ci
10998c2ecf20Sopenharmony_ci/*************************************************************************/
11008c2ecf20Sopenharmony_ci/*
11018c2ecf20Sopenharmony_ci * DRM_VMW_HANDLE_CLOSE - Close a user-space handle and release its
11028c2ecf20Sopenharmony_ci * underlying resource.
11038c2ecf20Sopenharmony_ci *
11048c2ecf20Sopenharmony_ci * Note that this ioctl is overlaid on the deprecated DRM_VMW_UNREF_DMABUF
11058c2ecf20Sopenharmony_ci * Ioctl.
11068c2ecf20Sopenharmony_ci */
11078c2ecf20Sopenharmony_ci
11088c2ecf20Sopenharmony_ci/**
11098c2ecf20Sopenharmony_ci * struct drm_vmw_handle_close_arg
11108c2ecf20Sopenharmony_ci *
11118c2ecf20Sopenharmony_ci * @handle: Handle to close.
11128c2ecf20Sopenharmony_ci *
11138c2ecf20Sopenharmony_ci * Argument to the DRM_VMW_HANDLE_CLOSE Ioctl.
11148c2ecf20Sopenharmony_ci */
11158c2ecf20Sopenharmony_cistruct drm_vmw_handle_close_arg {
11168c2ecf20Sopenharmony_ci	__u32 handle;
11178c2ecf20Sopenharmony_ci	__u32 pad64;
11188c2ecf20Sopenharmony_ci};
11198c2ecf20Sopenharmony_ci#define drm_vmw_unref_dmabuf_arg drm_vmw_handle_close_arg
11208c2ecf20Sopenharmony_ci
11218c2ecf20Sopenharmony_ci/*************************************************************************/
11228c2ecf20Sopenharmony_ci/**
11238c2ecf20Sopenharmony_ci * DRM_VMW_GB_SURFACE_CREATE_EXT - Create a host guest-backed surface.
11248c2ecf20Sopenharmony_ci *
11258c2ecf20Sopenharmony_ci * Allocates a surface handle and queues a create surface command
11268c2ecf20Sopenharmony_ci * for the host on the first use of the surface. The surface ID can
11278c2ecf20Sopenharmony_ci * be used as the surface ID in commands referencing the surface.
11288c2ecf20Sopenharmony_ci *
11298c2ecf20Sopenharmony_ci * This new command extends DRM_VMW_GB_SURFACE_CREATE by adding version
11308c2ecf20Sopenharmony_ci * parameter and 64 bit svga flag.
11318c2ecf20Sopenharmony_ci */
11328c2ecf20Sopenharmony_ci
11338c2ecf20Sopenharmony_ci/**
11348c2ecf20Sopenharmony_ci * enum drm_vmw_surface_version
11358c2ecf20Sopenharmony_ci *
11368c2ecf20Sopenharmony_ci * @drm_vmw_surface_gb_v1: Corresponds to current gb surface format with
11378c2ecf20Sopenharmony_ci * svga3d surface flags split into 2, upper half and lower half.
11388c2ecf20Sopenharmony_ci */
11398c2ecf20Sopenharmony_cienum drm_vmw_surface_version {
11408c2ecf20Sopenharmony_ci	drm_vmw_gb_surface_v1,
11418c2ecf20Sopenharmony_ci};
11428c2ecf20Sopenharmony_ci
11438c2ecf20Sopenharmony_ci/**
11448c2ecf20Sopenharmony_ci * struct drm_vmw_gb_surface_create_ext_req
11458c2ecf20Sopenharmony_ci *
11468c2ecf20Sopenharmony_ci * @base: Surface create parameters.
11478c2ecf20Sopenharmony_ci * @version: Version of surface create ioctl.
11488c2ecf20Sopenharmony_ci * @svga3d_flags_upper_32_bits: Upper 32 bits of svga3d flags.
11498c2ecf20Sopenharmony_ci * @multisample_pattern: Multisampling pattern when msaa is supported.
11508c2ecf20Sopenharmony_ci * @quality_level: Precision settings for each sample.
11518c2ecf20Sopenharmony_ci * @buffer_byte_stride: Buffer byte stride.
11528c2ecf20Sopenharmony_ci * @must_be_zero: Reserved for future usage.
11538c2ecf20Sopenharmony_ci *
11548c2ecf20Sopenharmony_ci * Input argument to the  DRM_VMW_GB_SURFACE_CREATE_EXT Ioctl.
11558c2ecf20Sopenharmony_ci * Part of output argument for the DRM_VMW_GB_SURFACE_REF_EXT Ioctl.
11568c2ecf20Sopenharmony_ci */
11578c2ecf20Sopenharmony_cistruct drm_vmw_gb_surface_create_ext_req {
11588c2ecf20Sopenharmony_ci	struct drm_vmw_gb_surface_create_req base;
11598c2ecf20Sopenharmony_ci	enum drm_vmw_surface_version version;
11608c2ecf20Sopenharmony_ci	__u32 svga3d_flags_upper_32_bits;
11618c2ecf20Sopenharmony_ci	__u32 multisample_pattern;
11628c2ecf20Sopenharmony_ci	__u32 quality_level;
11638c2ecf20Sopenharmony_ci	__u32 buffer_byte_stride;
11648c2ecf20Sopenharmony_ci	__u32 must_be_zero;
11658c2ecf20Sopenharmony_ci};
11668c2ecf20Sopenharmony_ci
11678c2ecf20Sopenharmony_ci/**
11688c2ecf20Sopenharmony_ci * union drm_vmw_gb_surface_create_ext_arg
11698c2ecf20Sopenharmony_ci *
11708c2ecf20Sopenharmony_ci * @req: Input argument as described above.
11718c2ecf20Sopenharmony_ci * @rep: Output argument as described above.
11728c2ecf20Sopenharmony_ci *
11738c2ecf20Sopenharmony_ci * Argument to the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl.
11748c2ecf20Sopenharmony_ci */
11758c2ecf20Sopenharmony_ciunion drm_vmw_gb_surface_create_ext_arg {
11768c2ecf20Sopenharmony_ci	struct drm_vmw_gb_surface_create_rep rep;
11778c2ecf20Sopenharmony_ci	struct drm_vmw_gb_surface_create_ext_req req;
11788c2ecf20Sopenharmony_ci};
11798c2ecf20Sopenharmony_ci
11808c2ecf20Sopenharmony_ci/*************************************************************************/
11818c2ecf20Sopenharmony_ci/**
11828c2ecf20Sopenharmony_ci * DRM_VMW_GB_SURFACE_REF_EXT - Reference a host surface.
11838c2ecf20Sopenharmony_ci *
11848c2ecf20Sopenharmony_ci * Puts a reference on a host surface with a given handle, as previously
11858c2ecf20Sopenharmony_ci * returned by the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl.
11868c2ecf20Sopenharmony_ci * A reference will make sure the surface isn't destroyed while we hold
11878c2ecf20Sopenharmony_ci * it and will allow the calling client to use the surface handle in
11888c2ecf20Sopenharmony_ci * the command stream.
11898c2ecf20Sopenharmony_ci *
11908c2ecf20Sopenharmony_ci * On successful return, the Ioctl returns the surface information given
11918c2ecf20Sopenharmony_ci * to and returned from the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl.
11928c2ecf20Sopenharmony_ci */
11938c2ecf20Sopenharmony_ci
11948c2ecf20Sopenharmony_ci/**
11958c2ecf20Sopenharmony_ci * struct drm_vmw_gb_surface_ref_ext_rep
11968c2ecf20Sopenharmony_ci *
11978c2ecf20Sopenharmony_ci * @creq: The data used as input when the surface was created, as described
11988c2ecf20Sopenharmony_ci *        above at "struct drm_vmw_gb_surface_create_ext_req"
11998c2ecf20Sopenharmony_ci * @crep: Additional data output when the surface was created, as described
12008c2ecf20Sopenharmony_ci *        above at "struct drm_vmw_gb_surface_create_rep"
12018c2ecf20Sopenharmony_ci *
12028c2ecf20Sopenharmony_ci * Output Argument to the DRM_VMW_GB_SURFACE_REF_EXT ioctl.
12038c2ecf20Sopenharmony_ci */
12048c2ecf20Sopenharmony_cistruct drm_vmw_gb_surface_ref_ext_rep {
12058c2ecf20Sopenharmony_ci	struct drm_vmw_gb_surface_create_ext_req creq;
12068c2ecf20Sopenharmony_ci	struct drm_vmw_gb_surface_create_rep crep;
12078c2ecf20Sopenharmony_ci};
12088c2ecf20Sopenharmony_ci
12098c2ecf20Sopenharmony_ci/**
12108c2ecf20Sopenharmony_ci * union drm_vmw_gb_surface_reference_ext_arg
12118c2ecf20Sopenharmony_ci *
12128c2ecf20Sopenharmony_ci * @req: Input data as described above at "struct drm_vmw_surface_arg"
12138c2ecf20Sopenharmony_ci * @rep: Output data as described above at
12148c2ecf20Sopenharmony_ci *       "struct drm_vmw_gb_surface_ref_ext_rep"
12158c2ecf20Sopenharmony_ci *
12168c2ecf20Sopenharmony_ci * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl.
12178c2ecf20Sopenharmony_ci */
12188c2ecf20Sopenharmony_ciunion drm_vmw_gb_surface_reference_ext_arg {
12198c2ecf20Sopenharmony_ci	struct drm_vmw_gb_surface_ref_ext_rep rep;
12208c2ecf20Sopenharmony_ci	struct drm_vmw_surface_arg req;
12218c2ecf20Sopenharmony_ci};
12228c2ecf20Sopenharmony_ci
12238c2ecf20Sopenharmony_ci/**
12248c2ecf20Sopenharmony_ci * struct drm_vmw_msg_arg
12258c2ecf20Sopenharmony_ci *
12268c2ecf20Sopenharmony_ci * @send: Pointer to user-space msg string (null terminated).
12278c2ecf20Sopenharmony_ci * @receive: Pointer to user-space receive buffer.
12288c2ecf20Sopenharmony_ci * @send_only: Boolean whether this is only sending or receiving too.
12298c2ecf20Sopenharmony_ci *
12308c2ecf20Sopenharmony_ci * Argument to the DRM_VMW_MSG ioctl.
12318c2ecf20Sopenharmony_ci */
12328c2ecf20Sopenharmony_cistruct drm_vmw_msg_arg {
12338c2ecf20Sopenharmony_ci	__u64 send;
12348c2ecf20Sopenharmony_ci	__u64 receive;
12358c2ecf20Sopenharmony_ci	__s32 send_only;
12368c2ecf20Sopenharmony_ci	__u32 receive_len;
12378c2ecf20Sopenharmony_ci};
12388c2ecf20Sopenharmony_ci
12398c2ecf20Sopenharmony_ci#if defined(__cplusplus)
12408c2ecf20Sopenharmony_ci}
12418c2ecf20Sopenharmony_ci#endif
12428c2ecf20Sopenharmony_ci
12438c2ecf20Sopenharmony_ci#endif
1244