1718dceddSDavid Howells /************************************************************************** 2718dceddSDavid Howells * 354fbde8aSSinclair Yeh * Copyright © 2009-2015 VMware, Inc., Palo Alto, CA., USA 4718dceddSDavid Howells * All Rights Reserved. 5718dceddSDavid Howells * 6718dceddSDavid Howells * Permission is hereby granted, free of charge, to any person obtaining a 7718dceddSDavid Howells * copy of this software and associated documentation files (the 8718dceddSDavid Howells * "Software"), to deal in the Software without restriction, including 9718dceddSDavid Howells * without limitation the rights to use, copy, modify, merge, publish, 10718dceddSDavid Howells * distribute, sub license, and/or sell copies of the Software, and to 11718dceddSDavid Howells * permit persons to whom the Software is furnished to do so, subject to 12718dceddSDavid Howells * the following conditions: 13718dceddSDavid Howells * 14718dceddSDavid Howells * The above copyright notice and this permission notice (including the 15718dceddSDavid Howells * next paragraph) shall be included in all copies or substantial portions 16718dceddSDavid Howells * of the Software. 17718dceddSDavid Howells * 18718dceddSDavid Howells * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19718dceddSDavid Howells * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20718dceddSDavid Howells * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 21718dceddSDavid Howells * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, 22718dceddSDavid Howells * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 23718dceddSDavid Howells * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 24718dceddSDavid Howells * USE OR OTHER DEALINGS IN THE SOFTWARE. 25718dceddSDavid Howells * 26718dceddSDavid Howells **************************************************************************/ 27718dceddSDavid Howells 28718dceddSDavid Howells #ifndef __VMWGFX_DRM_H__ 29718dceddSDavid Howells #define __VMWGFX_DRM_H__ 30718dceddSDavid Howells 313a4197afSGabriel Laskar #include "drm.h" 321d7a5cbfSThomas Hellstrom 33d3450e00SEmil Velikov #if defined(__cplusplus) 34d3450e00SEmil Velikov extern "C" { 35d3450e00SEmil Velikov #endif 36d3450e00SEmil Velikov 37718dceddSDavid Howells #define DRM_VMW_MAX_SURFACE_FACES 6 38718dceddSDavid Howells #define DRM_VMW_MAX_MIP_LEVELS 24 39718dceddSDavid Howells 40718dceddSDavid Howells 41718dceddSDavid Howells #define DRM_VMW_GET_PARAM 0 42718dceddSDavid Howells #define DRM_VMW_ALLOC_DMABUF 1 43f1d34bfdSThomas Hellstrom #define DRM_VMW_ALLOC_BO 1 44718dceddSDavid Howells #define DRM_VMW_UNREF_DMABUF 2 452f9545ceSThomas Hellstrom #define DRM_VMW_HANDLE_CLOSE 2 46718dceddSDavid Howells #define DRM_VMW_CURSOR_BYPASS 3 47718dceddSDavid Howells /* guarded by DRM_VMW_PARAM_NUM_STREAMS != 0*/ 48718dceddSDavid Howells #define DRM_VMW_CONTROL_STREAM 4 49718dceddSDavid Howells #define DRM_VMW_CLAIM_STREAM 5 50718dceddSDavid Howells #define DRM_VMW_UNREF_STREAM 6 51718dceddSDavid Howells /* guarded by DRM_VMW_PARAM_3D == 1 */ 52718dceddSDavid Howells #define DRM_VMW_CREATE_CONTEXT 7 53718dceddSDavid Howells #define DRM_VMW_UNREF_CONTEXT 8 54718dceddSDavid Howells #define DRM_VMW_CREATE_SURFACE 9 55718dceddSDavid Howells #define DRM_VMW_UNREF_SURFACE 10 56718dceddSDavid Howells #define DRM_VMW_REF_SURFACE 11 57718dceddSDavid Howells #define DRM_VMW_EXECBUF 12 58718dceddSDavid Howells #define DRM_VMW_GET_3D_CAP 13 59718dceddSDavid Howells #define DRM_VMW_FENCE_WAIT 14 60718dceddSDavid Howells #define DRM_VMW_FENCE_SIGNALED 15 61718dceddSDavid Howells #define DRM_VMW_FENCE_UNREF 16 62718dceddSDavid Howells #define DRM_VMW_FENCE_EVENT 17 63718dceddSDavid Howells #define DRM_VMW_PRESENT 18 64718dceddSDavid Howells #define DRM_VMW_PRESENT_READBACK 19 65718dceddSDavid Howells #define DRM_VMW_UPDATE_LAYOUT 20 66cfe4d53eSThomas Hellstrom #define DRM_VMW_CREATE_SHADER 21 67cfe4d53eSThomas Hellstrom #define DRM_VMW_UNREF_SHADER 22 68cfe4d53eSThomas Hellstrom #define DRM_VMW_GB_SURFACE_CREATE 23 69cfe4d53eSThomas Hellstrom #define DRM_VMW_GB_SURFACE_REF 24 701d7a5cbfSThomas Hellstrom #define DRM_VMW_SYNCCPU 25 71d80efd5cSThomas Hellstrom #define DRM_VMW_CREATE_EXTENDED_CONTEXT 26 72718dceddSDavid Howells 73718dceddSDavid Howells /*************************************************************************/ 74718dceddSDavid Howells /** 75718dceddSDavid Howells * DRM_VMW_GET_PARAM - get device information. 76718dceddSDavid Howells * 77718dceddSDavid Howells * DRM_VMW_PARAM_FIFO_OFFSET: 78718dceddSDavid Howells * Offset to use to map the first page of the FIFO read-only. 79718dceddSDavid Howells * The fifo is mapped using the mmap() system call on the drm device. 80718dceddSDavid Howells * 81718dceddSDavid Howells * DRM_VMW_PARAM_OVERLAY_IOCTL: 82718dceddSDavid Howells * Does the driver support the overlay ioctl. 83718dceddSDavid Howells */ 84718dceddSDavid Howells 85718dceddSDavid Howells #define DRM_VMW_PARAM_NUM_STREAMS 0 86718dceddSDavid Howells #define DRM_VMW_PARAM_NUM_FREE_STREAMS 1 87718dceddSDavid Howells #define DRM_VMW_PARAM_3D 2 88718dceddSDavid Howells #define DRM_VMW_PARAM_HW_CAPS 3 89718dceddSDavid Howells #define DRM_VMW_PARAM_FIFO_CAPS 4 90718dceddSDavid Howells #define DRM_VMW_PARAM_MAX_FB_SIZE 5 91718dceddSDavid Howells #define DRM_VMW_PARAM_FIFO_HW_VERSION 6 92cfe4d53eSThomas Hellstrom #define DRM_VMW_PARAM_MAX_SURF_MEMORY 7 93cfe4d53eSThomas Hellstrom #define DRM_VMW_PARAM_3D_CAPS_SIZE 8 94311474dbSThomas Hellstrom #define DRM_VMW_PARAM_MAX_MOB_MEMORY 9 95857aea1cSCharmaine Lee #define DRM_VMW_PARAM_MAX_MOB_SIZE 10 9635c05125SSinclair Yeh #define DRM_VMW_PARAM_SCREEN_TARGET 11 97d80efd5cSThomas Hellstrom #define DRM_VMW_PARAM_DX 12 98718dceddSDavid Howells 99718dceddSDavid Howells /** 100adebcb20SThomas Hellstrom * enum drm_vmw_handle_type - handle type for ref ioctls 101adebcb20SThomas Hellstrom * 102adebcb20SThomas Hellstrom */ 103adebcb20SThomas Hellstrom enum drm_vmw_handle_type { 104adebcb20SThomas Hellstrom DRM_VMW_HANDLE_LEGACY = 0, 105adebcb20SThomas Hellstrom DRM_VMW_HANDLE_PRIME = 1 106adebcb20SThomas Hellstrom }; 107adebcb20SThomas Hellstrom 108adebcb20SThomas Hellstrom /** 109718dceddSDavid Howells * struct drm_vmw_getparam_arg 110718dceddSDavid Howells * 111718dceddSDavid Howells * @value: Returned value. //Out 112718dceddSDavid Howells * @param: Parameter to query. //In. 113718dceddSDavid Howells * 114718dceddSDavid Howells * Argument to the DRM_VMW_GET_PARAM Ioctl. 115718dceddSDavid Howells */ 116718dceddSDavid Howells 117718dceddSDavid Howells struct drm_vmw_getparam_arg { 11821de2fdaSMikko Rapeli __u64 value; 11921de2fdaSMikko Rapeli __u32 param; 12021de2fdaSMikko Rapeli __u32 pad64; 121718dceddSDavid Howells }; 122718dceddSDavid Howells 123718dceddSDavid Howells /*************************************************************************/ 124718dceddSDavid Howells /** 125718dceddSDavid Howells * DRM_VMW_CREATE_CONTEXT - Create a host context. 126718dceddSDavid Howells * 127718dceddSDavid Howells * Allocates a device unique context id, and queues a create context command 128718dceddSDavid Howells * for the host. Does not wait for host completion. 129718dceddSDavid Howells */ 130718dceddSDavid Howells 131718dceddSDavid Howells /** 132718dceddSDavid Howells * struct drm_vmw_context_arg 133718dceddSDavid Howells * 134718dceddSDavid Howells * @cid: Device unique context ID. 135718dceddSDavid Howells * 136718dceddSDavid Howells * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl. 137718dceddSDavid Howells * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl. 138718dceddSDavid Howells */ 139718dceddSDavid Howells 140718dceddSDavid Howells struct drm_vmw_context_arg { 14121de2fdaSMikko Rapeli __s32 cid; 14221de2fdaSMikko Rapeli __u32 pad64; 143718dceddSDavid Howells }; 144718dceddSDavid Howells 145718dceddSDavid Howells /*************************************************************************/ 146718dceddSDavid Howells /** 147718dceddSDavid Howells * DRM_VMW_UNREF_CONTEXT - Create a host context. 148718dceddSDavid Howells * 149718dceddSDavid Howells * Frees a global context id, and queues a destroy host command for the host. 150718dceddSDavid Howells * Does not wait for host completion. The context ID can be used directly 151718dceddSDavid Howells * in the command stream and shows up as the same context ID on the host. 152718dceddSDavid Howells */ 153718dceddSDavid Howells 154718dceddSDavid Howells /*************************************************************************/ 155718dceddSDavid Howells /** 156718dceddSDavid Howells * DRM_VMW_CREATE_SURFACE - Create a host suface. 157718dceddSDavid Howells * 158718dceddSDavid Howells * Allocates a device unique surface id, and queues a create surface command 159718dceddSDavid Howells * for the host. Does not wait for host completion. The surface ID can be 160718dceddSDavid Howells * used directly in the command stream and shows up as the same surface 161718dceddSDavid Howells * ID on the host. 162718dceddSDavid Howells */ 163718dceddSDavid Howells 164718dceddSDavid Howells /** 165718dceddSDavid Howells * struct drm_wmv_surface_create_req 166718dceddSDavid Howells * 167718dceddSDavid Howells * @flags: Surface flags as understood by the host. 168718dceddSDavid Howells * @format: Surface format as understood by the host. 169718dceddSDavid Howells * @mip_levels: Number of mip levels for each face. 170718dceddSDavid Howells * An unused face should have 0 encoded. 171718dceddSDavid Howells * @size_addr: Address of a user-space array of sruct drm_vmw_size 17221de2fdaSMikko Rapeli * cast to an __u64 for 32-64 bit compatibility. 173718dceddSDavid Howells * The size of the array should equal the total number of mipmap levels. 174718dceddSDavid Howells * @shareable: Boolean whether other clients (as identified by file descriptors) 175718dceddSDavid Howells * may reference this surface. 176718dceddSDavid Howells * @scanout: Boolean whether the surface is intended to be used as a 177718dceddSDavid Howells * scanout. 178718dceddSDavid Howells * 179718dceddSDavid Howells * Input data to the DRM_VMW_CREATE_SURFACE Ioctl. 180718dceddSDavid Howells * Output data from the DRM_VMW_REF_SURFACE Ioctl. 181718dceddSDavid Howells */ 182718dceddSDavid Howells 183718dceddSDavid Howells struct drm_vmw_surface_create_req { 18421de2fdaSMikko Rapeli __u32 flags; 18521de2fdaSMikko Rapeli __u32 format; 18621de2fdaSMikko Rapeli __u32 mip_levels[DRM_VMW_MAX_SURFACE_FACES]; 18721de2fdaSMikko Rapeli __u64 size_addr; 18821de2fdaSMikko Rapeli __s32 shareable; 18921de2fdaSMikko Rapeli __s32 scanout; 190718dceddSDavid Howells }; 191718dceddSDavid Howells 192718dceddSDavid Howells /** 193718dceddSDavid Howells * struct drm_wmv_surface_arg 194718dceddSDavid Howells * 195718dceddSDavid Howells * @sid: Surface id of created surface or surface to destroy or reference. 196adebcb20SThomas Hellstrom * @handle_type: Handle type for DRM_VMW_REF_SURFACE Ioctl. 197718dceddSDavid Howells * 198718dceddSDavid Howells * Output data from the DRM_VMW_CREATE_SURFACE Ioctl. 199718dceddSDavid Howells * Input argument to the DRM_VMW_UNREF_SURFACE Ioctl. 200718dceddSDavid Howells * Input argument to the DRM_VMW_REF_SURFACE Ioctl. 201718dceddSDavid Howells */ 202718dceddSDavid Howells 203718dceddSDavid Howells struct drm_vmw_surface_arg { 20421de2fdaSMikko Rapeli __s32 sid; 205adebcb20SThomas Hellstrom enum drm_vmw_handle_type handle_type; 206718dceddSDavid Howells }; 207718dceddSDavid Howells 208718dceddSDavid Howells /** 209718dceddSDavid Howells * struct drm_vmw_size ioctl. 210718dceddSDavid Howells * 211718dceddSDavid Howells * @width - mip level width 212718dceddSDavid Howells * @height - mip level height 213718dceddSDavid Howells * @depth - mip level depth 214718dceddSDavid Howells * 215718dceddSDavid Howells * Description of a mip level. 216718dceddSDavid Howells * Input data to the DRM_WMW_CREATE_SURFACE Ioctl. 217718dceddSDavid Howells */ 218718dceddSDavid Howells 219718dceddSDavid Howells struct drm_vmw_size { 22021de2fdaSMikko Rapeli __u32 width; 22121de2fdaSMikko Rapeli __u32 height; 22221de2fdaSMikko Rapeli __u32 depth; 22321de2fdaSMikko Rapeli __u32 pad64; 224718dceddSDavid Howells }; 225718dceddSDavid Howells 226718dceddSDavid Howells /** 227718dceddSDavid Howells * union drm_vmw_surface_create_arg 228718dceddSDavid Howells * 229718dceddSDavid Howells * @rep: Output data as described above. 230718dceddSDavid Howells * @req: Input data as described above. 231718dceddSDavid Howells * 232718dceddSDavid Howells * Argument to the DRM_VMW_CREATE_SURFACE Ioctl. 233718dceddSDavid Howells */ 234718dceddSDavid Howells 235718dceddSDavid Howells union drm_vmw_surface_create_arg { 236718dceddSDavid Howells struct drm_vmw_surface_arg rep; 237718dceddSDavid Howells struct drm_vmw_surface_create_req req; 238718dceddSDavid Howells }; 239718dceddSDavid Howells 240718dceddSDavid Howells /*************************************************************************/ 241718dceddSDavid Howells /** 242718dceddSDavid Howells * DRM_VMW_REF_SURFACE - Reference a host surface. 243718dceddSDavid Howells * 244718dceddSDavid Howells * Puts a reference on a host surface with a give sid, as previously 245718dceddSDavid Howells * returned by the DRM_VMW_CREATE_SURFACE ioctl. 246718dceddSDavid Howells * A reference will make sure the surface isn't destroyed while we hold 247718dceddSDavid Howells * it and will allow the calling client to use the surface ID in the command 248718dceddSDavid Howells * stream. 249718dceddSDavid Howells * 250718dceddSDavid Howells * On successful return, the Ioctl returns the surface information given 251718dceddSDavid Howells * in the DRM_VMW_CREATE_SURFACE ioctl. 252718dceddSDavid Howells */ 253718dceddSDavid Howells 254718dceddSDavid Howells /** 255718dceddSDavid Howells * union drm_vmw_surface_reference_arg 256718dceddSDavid Howells * 257718dceddSDavid Howells * @rep: Output data as described above. 258718dceddSDavid Howells * @req: Input data as described above. 259718dceddSDavid Howells * 260718dceddSDavid Howells * Argument to the DRM_VMW_REF_SURFACE Ioctl. 261718dceddSDavid Howells */ 262718dceddSDavid Howells 263718dceddSDavid Howells union drm_vmw_surface_reference_arg { 264718dceddSDavid Howells struct drm_vmw_surface_create_req rep; 265718dceddSDavid Howells struct drm_vmw_surface_arg req; 266718dceddSDavid Howells }; 267718dceddSDavid Howells 268718dceddSDavid Howells /*************************************************************************/ 269718dceddSDavid Howells /** 270718dceddSDavid Howells * DRM_VMW_UNREF_SURFACE - Unreference a host surface. 271718dceddSDavid Howells * 272718dceddSDavid Howells * Clear a reference previously put on a host surface. 273718dceddSDavid Howells * When all references are gone, including the one implicitly placed 274718dceddSDavid Howells * on creation, 275718dceddSDavid Howells * a destroy surface command will be queued for the host. 276718dceddSDavid Howells * Does not wait for completion. 277718dceddSDavid Howells */ 278718dceddSDavid Howells 279718dceddSDavid Howells /*************************************************************************/ 280718dceddSDavid Howells /** 281718dceddSDavid Howells * DRM_VMW_EXECBUF 282718dceddSDavid Howells * 283718dceddSDavid Howells * Submit a command buffer for execution on the host, and return a 284718dceddSDavid Howells * fence seqno that when signaled, indicates that the command buffer has 285718dceddSDavid Howells * executed. 286718dceddSDavid Howells */ 287718dceddSDavid Howells 288718dceddSDavid Howells /** 289718dceddSDavid Howells * struct drm_vmw_execbuf_arg 290718dceddSDavid Howells * 29121de2fdaSMikko Rapeli * @commands: User-space address of a command buffer cast to an __u64. 292718dceddSDavid Howells * @command-size: Size in bytes of the command buffer. 293718dceddSDavid Howells * @throttle-us: Sleep until software is less than @throttle_us 294718dceddSDavid Howells * microseconds ahead of hardware. The driver may round this value 295718dceddSDavid Howells * to the nearest kernel tick. 296718dceddSDavid Howells * @fence_rep: User-space address of a struct drm_vmw_fence_rep cast to an 29721de2fdaSMikko Rapeli * __u64. 298718dceddSDavid Howells * @version: Allows expanding the execbuf ioctl parameters without breaking 299718dceddSDavid Howells * backwards compatibility, since user-space will always tell the kernel 300718dceddSDavid Howells * which version it uses. 3012cfa0bb2SSinclair Yeh * @flags: Execbuf flags. 3022cfa0bb2SSinclair Yeh * @imported_fence_fd: FD for a fence imported from another device 303718dceddSDavid Howells * 304718dceddSDavid Howells * Argument to the DRM_VMW_EXECBUF Ioctl. 305718dceddSDavid Howells */ 306718dceddSDavid Howells 307d80efd5cSThomas Hellstrom #define DRM_VMW_EXECBUF_VERSION 2 308718dceddSDavid Howells 3092cfa0bb2SSinclair Yeh #define DRM_VMW_EXECBUF_FLAG_IMPORT_FENCE_FD (1 << 0) 3102cfa0bb2SSinclair Yeh #define DRM_VMW_EXECBUF_FLAG_EXPORT_FENCE_FD (1 << 1) 3112cfa0bb2SSinclair Yeh 312718dceddSDavid Howells struct drm_vmw_execbuf_arg { 31321de2fdaSMikko Rapeli __u64 commands; 31421de2fdaSMikko Rapeli __u32 command_size; 31521de2fdaSMikko Rapeli __u32 throttle_us; 31621de2fdaSMikko Rapeli __u64 fence_rep; 31721de2fdaSMikko Rapeli __u32 version; 31821de2fdaSMikko Rapeli __u32 flags; 31921de2fdaSMikko Rapeli __u32 context_handle; 3202cfa0bb2SSinclair Yeh __s32 imported_fence_fd; 321718dceddSDavid Howells }; 322718dceddSDavid Howells 323718dceddSDavid Howells /** 324718dceddSDavid Howells * struct drm_vmw_fence_rep 325718dceddSDavid Howells * 326718dceddSDavid Howells * @handle: Fence object handle for fence associated with a command submission. 327718dceddSDavid Howells * @mask: Fence flags relevant for this fence object. 328718dceddSDavid Howells * @seqno: Fence sequence number in fifo. A fence object with a lower 329718dceddSDavid Howells * seqno will signal the EXEC flag before a fence object with a higher 330718dceddSDavid Howells * seqno. This can be used by user-space to avoid kernel calls to determine 331718dceddSDavid Howells * whether a fence has signaled the EXEC flag. Note that @seqno will 332718dceddSDavid Howells * wrap at 32-bit. 333718dceddSDavid Howells * @passed_seqno: The highest seqno number processed by the hardware 334718dceddSDavid Howells * so far. This can be used to mark user-space fence objects as signaled, and 335718dceddSDavid Howells * to determine whether a fence seqno might be stale. 3362cfa0bb2SSinclair Yeh * @fd: FD associated with the fence, -1 if not exported 337718dceddSDavid Howells * @error: This member should've been set to -EFAULT on submission. 338718dceddSDavid Howells * The following actions should be take on completion: 339718dceddSDavid Howells * error == -EFAULT: Fence communication failed. The host is synchronized. 340718dceddSDavid Howells * Use the last fence id read from the FIFO fence register. 341718dceddSDavid Howells * error != 0 && error != -EFAULT: 342718dceddSDavid Howells * Fence submission failed. The host is synchronized. Use the fence_seq member. 343718dceddSDavid Howells * error == 0: All is OK, The host may not be synchronized. 344718dceddSDavid Howells * Use the fence_seq member. 345718dceddSDavid Howells * 346718dceddSDavid Howells * Input / Output data to the DRM_VMW_EXECBUF Ioctl. 347718dceddSDavid Howells */ 348718dceddSDavid Howells 349718dceddSDavid Howells struct drm_vmw_fence_rep { 35021de2fdaSMikko Rapeli __u32 handle; 35121de2fdaSMikko Rapeli __u32 mask; 35221de2fdaSMikko Rapeli __u32 seqno; 35321de2fdaSMikko Rapeli __u32 passed_seqno; 3542cfa0bb2SSinclair Yeh __s32 fd; 35521de2fdaSMikko Rapeli __s32 error; 356718dceddSDavid Howells }; 357718dceddSDavid Howells 358718dceddSDavid Howells /*************************************************************************/ 359718dceddSDavid Howells /** 360f1d34bfdSThomas Hellstrom * DRM_VMW_ALLOC_BO 361718dceddSDavid Howells * 362f1d34bfdSThomas Hellstrom * Allocate a buffer object that is visible also to the host. 363718dceddSDavid Howells * NOTE: The buffer is 364718dceddSDavid Howells * identified by a handle and an offset, which are private to the guest, but 365718dceddSDavid Howells * useable in the command stream. The guest kernel may translate these 366718dceddSDavid Howells * and patch up the command stream accordingly. In the future, the offset may 367718dceddSDavid Howells * be zero at all times, or it may disappear from the interface before it is 368718dceddSDavid Howells * fixed. 369718dceddSDavid Howells * 370f1d34bfdSThomas Hellstrom * The buffer object may stay user-space mapped in the guest at all times, 371718dceddSDavid Howells * and is thus suitable for sub-allocation. 372718dceddSDavid Howells * 373f1d34bfdSThomas Hellstrom * Buffer objects are mapped using the mmap() syscall on the drm device. 374718dceddSDavid Howells */ 375718dceddSDavid Howells 376718dceddSDavid Howells /** 377f1d34bfdSThomas Hellstrom * struct drm_vmw_alloc_bo_req 378718dceddSDavid Howells * 379718dceddSDavid Howells * @size: Required minimum size of the buffer. 380718dceddSDavid Howells * 381f1d34bfdSThomas Hellstrom * Input data to the DRM_VMW_ALLOC_BO Ioctl. 382718dceddSDavid Howells */ 383718dceddSDavid Howells 384f1d34bfdSThomas Hellstrom struct drm_vmw_alloc_bo_req { 38521de2fdaSMikko Rapeli __u32 size; 38621de2fdaSMikko Rapeli __u32 pad64; 387718dceddSDavid Howells }; 388f1d34bfdSThomas Hellstrom #define drm_vmw_alloc_dmabuf_req drm_vmw_alloc_bo_req 389718dceddSDavid Howells 390718dceddSDavid Howells /** 391f1d34bfdSThomas Hellstrom * struct drm_vmw_bo_rep 392718dceddSDavid Howells * 393718dceddSDavid Howells * @map_handle: Offset to use in the mmap() call used to map the buffer. 394718dceddSDavid Howells * @handle: Handle unique to this buffer. Used for unreferencing. 395718dceddSDavid Howells * @cur_gmr_id: GMR id to use in the command stream when this buffer is 396718dceddSDavid Howells * referenced. See not above. 397718dceddSDavid Howells * @cur_gmr_offset: Offset to use in the command stream when this buffer is 398718dceddSDavid Howells * referenced. See note above. 399718dceddSDavid Howells * 400f1d34bfdSThomas Hellstrom * Output data from the DRM_VMW_ALLOC_BO Ioctl. 401718dceddSDavid Howells */ 402718dceddSDavid Howells 403f1d34bfdSThomas Hellstrom struct drm_vmw_bo_rep { 40421de2fdaSMikko Rapeli __u64 map_handle; 40521de2fdaSMikko Rapeli __u32 handle; 40621de2fdaSMikko Rapeli __u32 cur_gmr_id; 40721de2fdaSMikko Rapeli __u32 cur_gmr_offset; 40821de2fdaSMikko Rapeli __u32 pad64; 409718dceddSDavid Howells }; 410f1d34bfdSThomas Hellstrom #define drm_vmw_dmabuf_rep drm_vmw_bo_rep 411718dceddSDavid Howells 412718dceddSDavid Howells /** 413f1d34bfdSThomas Hellstrom * union drm_vmw_alloc_bo_arg 414718dceddSDavid Howells * 415718dceddSDavid Howells * @req: Input data as described above. 416718dceddSDavid Howells * @rep: Output data as described above. 417718dceddSDavid Howells * 418f1d34bfdSThomas Hellstrom * Argument to the DRM_VMW_ALLOC_BO Ioctl. 419718dceddSDavid Howells */ 420718dceddSDavid Howells 421f1d34bfdSThomas Hellstrom union drm_vmw_alloc_bo_arg { 422f1d34bfdSThomas Hellstrom struct drm_vmw_alloc_bo_req req; 423f1d34bfdSThomas Hellstrom struct drm_vmw_bo_rep rep; 424718dceddSDavid Howells }; 425f1d34bfdSThomas Hellstrom #define drm_vmw_alloc_dmabuf_arg drm_vmw_alloc_bo_arg 426718dceddSDavid Howells 427718dceddSDavid Howells /*************************************************************************/ 428718dceddSDavid Howells /** 429718dceddSDavid Howells * DRM_VMW_CONTROL_STREAM - Control overlays, aka streams. 430718dceddSDavid Howells * 431718dceddSDavid Howells * This IOCTL controls the overlay units of the svga device. 432718dceddSDavid Howells * The SVGA overlay units does not work like regular hardware units in 433718dceddSDavid Howells * that they do not automaticaly read back the contents of the given dma 434718dceddSDavid Howells * buffer. But instead only read back for each call to this ioctl, and 435718dceddSDavid Howells * at any point between this call being made and a following call that 436718dceddSDavid Howells * either changes the buffer or disables the stream. 437718dceddSDavid Howells */ 438718dceddSDavid Howells 439718dceddSDavid Howells /** 440718dceddSDavid Howells * struct drm_vmw_rect 441718dceddSDavid Howells * 442718dceddSDavid Howells * Defines a rectangle. Used in the overlay ioctl to define 443718dceddSDavid Howells * source and destination rectangle. 444718dceddSDavid Howells */ 445718dceddSDavid Howells 446718dceddSDavid Howells struct drm_vmw_rect { 44721de2fdaSMikko Rapeli __s32 x; 44821de2fdaSMikko Rapeli __s32 y; 44921de2fdaSMikko Rapeli __u32 w; 45021de2fdaSMikko Rapeli __u32 h; 451718dceddSDavid Howells }; 452718dceddSDavid Howells 453718dceddSDavid Howells /** 454718dceddSDavid Howells * struct drm_vmw_control_stream_arg 455718dceddSDavid Howells * 456718dceddSDavid Howells * @stream_id: Stearm to control 457718dceddSDavid Howells * @enabled: If false all following arguments are ignored. 458718dceddSDavid Howells * @handle: Handle to buffer for getting data from. 459718dceddSDavid Howells * @format: Format of the overlay as understood by the host. 460718dceddSDavid Howells * @width: Width of the overlay. 461718dceddSDavid Howells * @height: Height of the overlay. 462718dceddSDavid Howells * @size: Size of the overlay in bytes. 463718dceddSDavid Howells * @pitch: Array of pitches, the two last are only used for YUV12 formats. 464718dceddSDavid Howells * @offset: Offset from start of dma buffer to overlay. 465718dceddSDavid Howells * @src: Source rect, must be within the defined area above. 466718dceddSDavid Howells * @dst: Destination rect, x and y may be negative. 467718dceddSDavid Howells * 468718dceddSDavid Howells * Argument to the DRM_VMW_CONTROL_STREAM Ioctl. 469718dceddSDavid Howells */ 470718dceddSDavid Howells 471718dceddSDavid Howells struct drm_vmw_control_stream_arg { 47221de2fdaSMikko Rapeli __u32 stream_id; 47321de2fdaSMikko Rapeli __u32 enabled; 474718dceddSDavid Howells 47521de2fdaSMikko Rapeli __u32 flags; 47621de2fdaSMikko Rapeli __u32 color_key; 477718dceddSDavid Howells 47821de2fdaSMikko Rapeli __u32 handle; 47921de2fdaSMikko Rapeli __u32 offset; 48021de2fdaSMikko Rapeli __s32 format; 48121de2fdaSMikko Rapeli __u32 size; 48221de2fdaSMikko Rapeli __u32 width; 48321de2fdaSMikko Rapeli __u32 height; 48421de2fdaSMikko Rapeli __u32 pitch[3]; 485718dceddSDavid Howells 48621de2fdaSMikko Rapeli __u32 pad64; 487718dceddSDavid Howells struct drm_vmw_rect src; 488718dceddSDavid Howells struct drm_vmw_rect dst; 489718dceddSDavid Howells }; 490718dceddSDavid Howells 491718dceddSDavid Howells /*************************************************************************/ 492718dceddSDavid Howells /** 493718dceddSDavid Howells * DRM_VMW_CURSOR_BYPASS - Give extra information about cursor bypass. 494718dceddSDavid Howells * 495718dceddSDavid Howells */ 496718dceddSDavid Howells 497718dceddSDavid Howells #define DRM_VMW_CURSOR_BYPASS_ALL (1 << 0) 498718dceddSDavid Howells #define DRM_VMW_CURSOR_BYPASS_FLAGS (1) 499718dceddSDavid Howells 500718dceddSDavid Howells /** 501718dceddSDavid Howells * struct drm_vmw_cursor_bypass_arg 502718dceddSDavid Howells * 503718dceddSDavid Howells * @flags: Flags. 504718dceddSDavid Howells * @crtc_id: Crtc id, only used if DMR_CURSOR_BYPASS_ALL isn't passed. 505718dceddSDavid Howells * @xpos: X position of cursor. 506718dceddSDavid Howells * @ypos: Y position of cursor. 507718dceddSDavid Howells * @xhot: X hotspot. 508718dceddSDavid Howells * @yhot: Y hotspot. 509718dceddSDavid Howells * 510718dceddSDavid Howells * Argument to the DRM_VMW_CURSOR_BYPASS Ioctl. 511718dceddSDavid Howells */ 512718dceddSDavid Howells 513718dceddSDavid Howells struct drm_vmw_cursor_bypass_arg { 51421de2fdaSMikko Rapeli __u32 flags; 51521de2fdaSMikko Rapeli __u32 crtc_id; 51621de2fdaSMikko Rapeli __s32 xpos; 51721de2fdaSMikko Rapeli __s32 ypos; 51821de2fdaSMikko Rapeli __s32 xhot; 51921de2fdaSMikko Rapeli __s32 yhot; 520718dceddSDavid Howells }; 521718dceddSDavid Howells 522718dceddSDavid Howells /*************************************************************************/ 523718dceddSDavid Howells /** 524718dceddSDavid Howells * DRM_VMW_CLAIM_STREAM - Claim a single stream. 525718dceddSDavid Howells */ 526718dceddSDavid Howells 527718dceddSDavid Howells /** 528718dceddSDavid Howells * struct drm_vmw_context_arg 529718dceddSDavid Howells * 530718dceddSDavid Howells * @stream_id: Device unique context ID. 531718dceddSDavid Howells * 532718dceddSDavid Howells * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl. 533718dceddSDavid Howells * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl. 534718dceddSDavid Howells */ 535718dceddSDavid Howells 536718dceddSDavid Howells struct drm_vmw_stream_arg { 53721de2fdaSMikko Rapeli __u32 stream_id; 53821de2fdaSMikko Rapeli __u32 pad64; 539718dceddSDavid Howells }; 540718dceddSDavid Howells 541718dceddSDavid Howells /*************************************************************************/ 542718dceddSDavid Howells /** 543718dceddSDavid Howells * DRM_VMW_UNREF_STREAM - Unclaim a stream. 544718dceddSDavid Howells * 545718dceddSDavid Howells * Return a single stream that was claimed by this process. Also makes 546718dceddSDavid Howells * sure that the stream has been stopped. 547718dceddSDavid Howells */ 548718dceddSDavid Howells 549718dceddSDavid Howells /*************************************************************************/ 550718dceddSDavid Howells /** 551718dceddSDavid Howells * DRM_VMW_GET_3D_CAP 552718dceddSDavid Howells * 553718dceddSDavid Howells * Read 3D capabilities from the FIFO 554718dceddSDavid Howells * 555718dceddSDavid Howells */ 556718dceddSDavid Howells 557718dceddSDavid Howells /** 558718dceddSDavid Howells * struct drm_vmw_get_3d_cap_arg 559718dceddSDavid Howells * 56021de2fdaSMikko Rapeli * @buffer: Pointer to a buffer for capability data, cast to an __u64 561718dceddSDavid Howells * @size: Max size to copy 562718dceddSDavid Howells * 563718dceddSDavid Howells * Input argument to the DRM_VMW_GET_3D_CAP_IOCTL 564718dceddSDavid Howells * ioctls. 565718dceddSDavid Howells */ 566718dceddSDavid Howells 567718dceddSDavid Howells struct drm_vmw_get_3d_cap_arg { 56821de2fdaSMikko Rapeli __u64 buffer; 56921de2fdaSMikko Rapeli __u32 max_size; 57021de2fdaSMikko Rapeli __u32 pad64; 571718dceddSDavid Howells }; 572718dceddSDavid Howells 573718dceddSDavid Howells /*************************************************************************/ 574718dceddSDavid Howells /** 575718dceddSDavid Howells * DRM_VMW_FENCE_WAIT 576718dceddSDavid Howells * 577718dceddSDavid Howells * Waits for a fence object to signal. The wait is interruptible, so that 578718dceddSDavid Howells * signals may be delivered during the interrupt. The wait may timeout, 579718dceddSDavid Howells * in which case the calls returns -EBUSY. If the wait is restarted, 580718dceddSDavid Howells * that is restarting without resetting @cookie_valid to zero, 581718dceddSDavid Howells * the timeout is computed from the first call. 582718dceddSDavid Howells * 583718dceddSDavid Howells * The flags argument to the DRM_VMW_FENCE_WAIT ioctl indicates what to wait 584718dceddSDavid Howells * on: 585718dceddSDavid Howells * DRM_VMW_FENCE_FLAG_EXEC: All commands ahead of the fence in the command 586718dceddSDavid Howells * stream 587718dceddSDavid Howells * have executed. 588718dceddSDavid Howells * DRM_VMW_FENCE_FLAG_QUERY: All query results resulting from query finish 589718dceddSDavid Howells * commands 590718dceddSDavid Howells * in the buffer given to the EXECBUF ioctl returning the fence object handle 591718dceddSDavid Howells * are available to user-space. 592718dceddSDavid Howells * 593718dceddSDavid Howells * DRM_VMW_WAIT_OPTION_UNREF: If this wait option is given, and the 594718dceddSDavid Howells * fenc wait ioctl returns 0, the fence object has been unreferenced after 595718dceddSDavid Howells * the wait. 596718dceddSDavid Howells */ 597718dceddSDavid Howells 598718dceddSDavid Howells #define DRM_VMW_FENCE_FLAG_EXEC (1 << 0) 599718dceddSDavid Howells #define DRM_VMW_FENCE_FLAG_QUERY (1 << 1) 600718dceddSDavid Howells 601718dceddSDavid Howells #define DRM_VMW_WAIT_OPTION_UNREF (1 << 0) 602718dceddSDavid Howells 603718dceddSDavid Howells /** 604718dceddSDavid Howells * struct drm_vmw_fence_wait_arg 605718dceddSDavid Howells * 606718dceddSDavid Howells * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl. 607718dceddSDavid Howells * @cookie_valid: Must be reset to 0 on first call. Left alone on restart. 608718dceddSDavid Howells * @kernel_cookie: Set to 0 on first call. Left alone on restart. 609718dceddSDavid Howells * @timeout_us: Wait timeout in microseconds. 0 for indefinite timeout. 610718dceddSDavid Howells * @lazy: Set to 1 if timing is not critical. Allow more than a kernel tick 611718dceddSDavid Howells * before returning. 612718dceddSDavid Howells * @flags: Fence flags to wait on. 613718dceddSDavid Howells * @wait_options: Options that control the behaviour of the wait ioctl. 614718dceddSDavid Howells * 615718dceddSDavid Howells * Input argument to the DRM_VMW_FENCE_WAIT ioctl. 616718dceddSDavid Howells */ 617718dceddSDavid Howells 618718dceddSDavid Howells struct drm_vmw_fence_wait_arg { 61921de2fdaSMikko Rapeli __u32 handle; 62021de2fdaSMikko Rapeli __s32 cookie_valid; 62121de2fdaSMikko Rapeli __u64 kernel_cookie; 62221de2fdaSMikko Rapeli __u64 timeout_us; 62321de2fdaSMikko Rapeli __s32 lazy; 62421de2fdaSMikko Rapeli __s32 flags; 62521de2fdaSMikko Rapeli __s32 wait_options; 62621de2fdaSMikko Rapeli __s32 pad64; 627718dceddSDavid Howells }; 628718dceddSDavid Howells 629718dceddSDavid Howells /*************************************************************************/ 630718dceddSDavid Howells /** 631718dceddSDavid Howells * DRM_VMW_FENCE_SIGNALED 632718dceddSDavid Howells * 633718dceddSDavid Howells * Checks if a fence object is signaled.. 634718dceddSDavid Howells */ 635718dceddSDavid Howells 636718dceddSDavid Howells /** 637718dceddSDavid Howells * struct drm_vmw_fence_signaled_arg 638718dceddSDavid Howells * 639718dceddSDavid Howells * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl. 640718dceddSDavid Howells * @flags: Fence object flags input to DRM_VMW_FENCE_SIGNALED ioctl 641718dceddSDavid Howells * @signaled: Out: Flags signaled. 642718dceddSDavid Howells * @sequence: Out: Highest sequence passed so far. Can be used to signal the 643718dceddSDavid Howells * EXEC flag of user-space fence objects. 644718dceddSDavid Howells * 645718dceddSDavid Howells * Input/Output argument to the DRM_VMW_FENCE_SIGNALED and DRM_VMW_FENCE_UNREF 646718dceddSDavid Howells * ioctls. 647718dceddSDavid Howells */ 648718dceddSDavid Howells 649718dceddSDavid Howells struct drm_vmw_fence_signaled_arg { 65021de2fdaSMikko Rapeli __u32 handle; 65121de2fdaSMikko Rapeli __u32 flags; 65221de2fdaSMikko Rapeli __s32 signaled; 65321de2fdaSMikko Rapeli __u32 passed_seqno; 65421de2fdaSMikko Rapeli __u32 signaled_flags; 65521de2fdaSMikko Rapeli __u32 pad64; 656718dceddSDavid Howells }; 657718dceddSDavid Howells 658718dceddSDavid Howells /*************************************************************************/ 659718dceddSDavid Howells /** 660718dceddSDavid Howells * DRM_VMW_FENCE_UNREF 661718dceddSDavid Howells * 662718dceddSDavid Howells * Unreferences a fence object, and causes it to be destroyed if there are no 663718dceddSDavid Howells * other references to it. 664718dceddSDavid Howells * 665718dceddSDavid Howells */ 666718dceddSDavid Howells 667718dceddSDavid Howells /** 668718dceddSDavid Howells * struct drm_vmw_fence_arg 669718dceddSDavid Howells * 670718dceddSDavid Howells * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl. 671718dceddSDavid Howells * 672718dceddSDavid Howells * Input/Output argument to the DRM_VMW_FENCE_UNREF ioctl.. 673718dceddSDavid Howells */ 674718dceddSDavid Howells 675718dceddSDavid Howells struct drm_vmw_fence_arg { 67621de2fdaSMikko Rapeli __u32 handle; 67721de2fdaSMikko Rapeli __u32 pad64; 678718dceddSDavid Howells }; 679718dceddSDavid Howells 680718dceddSDavid Howells 681718dceddSDavid Howells /*************************************************************************/ 682718dceddSDavid Howells /** 683718dceddSDavid Howells * DRM_VMW_FENCE_EVENT 684718dceddSDavid Howells * 685718dceddSDavid Howells * Queues an event on a fence to be delivered on the drm character device 686718dceddSDavid Howells * when the fence has signaled the DRM_VMW_FENCE_FLAG_EXEC flag. 687718dceddSDavid Howells * Optionally the approximate time when the fence signaled is 688718dceddSDavid Howells * given by the event. 689718dceddSDavid Howells */ 690718dceddSDavid Howells 691718dceddSDavid Howells /* 692718dceddSDavid Howells * The event type 693718dceddSDavid Howells */ 694718dceddSDavid Howells #define DRM_VMW_EVENT_FENCE_SIGNALED 0x80000000 695718dceddSDavid Howells 696718dceddSDavid Howells struct drm_vmw_event_fence { 697718dceddSDavid Howells struct drm_event base; 69821de2fdaSMikko Rapeli __u64 user_data; 69921de2fdaSMikko Rapeli __u32 tv_sec; 70021de2fdaSMikko Rapeli __u32 tv_usec; 701718dceddSDavid Howells }; 702718dceddSDavid Howells 703718dceddSDavid Howells /* 704718dceddSDavid Howells * Flags that may be given to the command. 705718dceddSDavid Howells */ 706718dceddSDavid Howells /* Request fence signaled time on the event. */ 707718dceddSDavid Howells #define DRM_VMW_FE_FLAG_REQ_TIME (1 << 0) 708718dceddSDavid Howells 709718dceddSDavid Howells /** 710718dceddSDavid Howells * struct drm_vmw_fence_event_arg 711718dceddSDavid Howells * 71221de2fdaSMikko Rapeli * @fence_rep: Pointer to fence_rep structure cast to __u64 or 0 if 713718dceddSDavid Howells * the fence is not supposed to be referenced by user-space. 714718dceddSDavid Howells * @user_info: Info to be delivered with the event. 715718dceddSDavid Howells * @handle: Attach the event to this fence only. 716718dceddSDavid Howells * @flags: A set of flags as defined above. 717718dceddSDavid Howells */ 718718dceddSDavid Howells struct drm_vmw_fence_event_arg { 71921de2fdaSMikko Rapeli __u64 fence_rep; 72021de2fdaSMikko Rapeli __u64 user_data; 72121de2fdaSMikko Rapeli __u32 handle; 72221de2fdaSMikko Rapeli __u32 flags; 723718dceddSDavid Howells }; 724718dceddSDavid Howells 725718dceddSDavid Howells 726718dceddSDavid Howells /*************************************************************************/ 727718dceddSDavid Howells /** 728718dceddSDavid Howells * DRM_VMW_PRESENT 729718dceddSDavid Howells * 730718dceddSDavid Howells * Executes an SVGA present on a given fb for a given surface. The surface 731718dceddSDavid Howells * is placed on the framebuffer. Cliprects are given relative to the given 732718dceddSDavid Howells * point (the point disignated by dest_{x|y}). 733718dceddSDavid Howells * 734718dceddSDavid Howells */ 735718dceddSDavid Howells 736718dceddSDavid Howells /** 737718dceddSDavid Howells * struct drm_vmw_present_arg 738718dceddSDavid Howells * @fb_id: framebuffer id to present / read back from. 739718dceddSDavid Howells * @sid: Surface id to present from. 740718dceddSDavid Howells * @dest_x: X placement coordinate for surface. 741718dceddSDavid Howells * @dest_y: Y placement coordinate for surface. 74221de2fdaSMikko Rapeli * @clips_ptr: Pointer to an array of clip rects cast to an __u64. 743718dceddSDavid Howells * @num_clips: Number of cliprects given relative to the framebuffer origin, 744718dceddSDavid Howells * in the same coordinate space as the frame buffer. 745718dceddSDavid Howells * @pad64: Unused 64-bit padding. 746718dceddSDavid Howells * 747718dceddSDavid Howells * Input argument to the DRM_VMW_PRESENT ioctl. 748718dceddSDavid Howells */ 749718dceddSDavid Howells 750718dceddSDavid Howells struct drm_vmw_present_arg { 75121de2fdaSMikko Rapeli __u32 fb_id; 75221de2fdaSMikko Rapeli __u32 sid; 75321de2fdaSMikko Rapeli __s32 dest_x; 75421de2fdaSMikko Rapeli __s32 dest_y; 75521de2fdaSMikko Rapeli __u64 clips_ptr; 75621de2fdaSMikko Rapeli __u32 num_clips; 75721de2fdaSMikko Rapeli __u32 pad64; 758718dceddSDavid Howells }; 759718dceddSDavid Howells 760718dceddSDavid Howells 761718dceddSDavid Howells /*************************************************************************/ 762718dceddSDavid Howells /** 763718dceddSDavid Howells * DRM_VMW_PRESENT_READBACK 764718dceddSDavid Howells * 765718dceddSDavid Howells * Executes an SVGA present readback from a given fb to the dma buffer 766718dceddSDavid Howells * currently bound as the fb. If there is no dma buffer bound to the fb, 767718dceddSDavid Howells * an error will be returned. 768718dceddSDavid Howells * 769718dceddSDavid Howells */ 770718dceddSDavid Howells 771718dceddSDavid Howells /** 772718dceddSDavid Howells * struct drm_vmw_present_arg 773718dceddSDavid Howells * @fb_id: fb_id to present / read back from. 774718dceddSDavid Howells * @num_clips: Number of cliprects. 77521de2fdaSMikko Rapeli * @clips_ptr: Pointer to an array of clip rects cast to an __u64. 77621de2fdaSMikko Rapeli * @fence_rep: Pointer to a struct drm_vmw_fence_rep, cast to an __u64. 777718dceddSDavid Howells * If this member is NULL, then the ioctl should not return a fence. 778718dceddSDavid Howells */ 779718dceddSDavid Howells 780718dceddSDavid Howells struct drm_vmw_present_readback_arg { 78121de2fdaSMikko Rapeli __u32 fb_id; 78221de2fdaSMikko Rapeli __u32 num_clips; 78321de2fdaSMikko Rapeli __u64 clips_ptr; 78421de2fdaSMikko Rapeli __u64 fence_rep; 785718dceddSDavid Howells }; 786718dceddSDavid Howells 787718dceddSDavid Howells /*************************************************************************/ 788718dceddSDavid Howells /** 789718dceddSDavid Howells * DRM_VMW_UPDATE_LAYOUT - Update layout 790718dceddSDavid Howells * 791718dceddSDavid Howells * Updates the preferred modes and connection status for connectors. The 792718dceddSDavid Howells * command consists of one drm_vmw_update_layout_arg pointing to an array 793718dceddSDavid Howells * of num_outputs drm_vmw_rect's. 794718dceddSDavid Howells */ 795718dceddSDavid Howells 796718dceddSDavid Howells /** 797718dceddSDavid Howells * struct drm_vmw_update_layout_arg 798718dceddSDavid Howells * 799718dceddSDavid Howells * @num_outputs: number of active connectors 80021de2fdaSMikko Rapeli * @rects: pointer to array of drm_vmw_rect cast to an __u64 801718dceddSDavid Howells * 802718dceddSDavid Howells * Input argument to the DRM_VMW_UPDATE_LAYOUT Ioctl. 803718dceddSDavid Howells */ 804718dceddSDavid Howells struct drm_vmw_update_layout_arg { 80521de2fdaSMikko Rapeli __u32 num_outputs; 80621de2fdaSMikko Rapeli __u32 pad64; 80721de2fdaSMikko Rapeli __u64 rects; 808718dceddSDavid Howells }; 809718dceddSDavid Howells 810cfe4d53eSThomas Hellstrom 811cfe4d53eSThomas Hellstrom /*************************************************************************/ 812cfe4d53eSThomas Hellstrom /** 813cfe4d53eSThomas Hellstrom * DRM_VMW_CREATE_SHADER - Create shader 814cfe4d53eSThomas Hellstrom * 815cfe4d53eSThomas Hellstrom * Creates a shader and optionally binds it to a dma buffer containing 816cfe4d53eSThomas Hellstrom * the shader byte-code. 817cfe4d53eSThomas Hellstrom */ 818cfe4d53eSThomas Hellstrom 819cfe4d53eSThomas Hellstrom /** 820cfe4d53eSThomas Hellstrom * enum drm_vmw_shader_type - Shader types 821cfe4d53eSThomas Hellstrom */ 822cfe4d53eSThomas Hellstrom enum drm_vmw_shader_type { 823cfe4d53eSThomas Hellstrom drm_vmw_shader_type_vs = 0, 824cfe4d53eSThomas Hellstrom drm_vmw_shader_type_ps, 825cfe4d53eSThomas Hellstrom }; 826cfe4d53eSThomas Hellstrom 827cfe4d53eSThomas Hellstrom 828cfe4d53eSThomas Hellstrom /** 829cfe4d53eSThomas Hellstrom * struct drm_vmw_shader_create_arg 830cfe4d53eSThomas Hellstrom * 831cfe4d53eSThomas Hellstrom * @shader_type: Shader type of the shader to create. 832cfe4d53eSThomas Hellstrom * @size: Size of the byte-code in bytes. 833cfe4d53eSThomas Hellstrom * where the shader byte-code starts 834cfe4d53eSThomas Hellstrom * @buffer_handle: Buffer handle identifying the buffer containing the 835cfe4d53eSThomas Hellstrom * shader byte-code 836cfe4d53eSThomas Hellstrom * @shader_handle: On successful completion contains a handle that 837cfe4d53eSThomas Hellstrom * can be used to subsequently identify the shader. 838cfe4d53eSThomas Hellstrom * @offset: Offset in bytes into the buffer given by @buffer_handle, 839cfe4d53eSThomas Hellstrom * 840cfe4d53eSThomas Hellstrom * Input / Output argument to the DRM_VMW_CREATE_SHADER Ioctl. 841cfe4d53eSThomas Hellstrom */ 842cfe4d53eSThomas Hellstrom struct drm_vmw_shader_create_arg { 843cfe4d53eSThomas Hellstrom enum drm_vmw_shader_type shader_type; 84421de2fdaSMikko Rapeli __u32 size; 84521de2fdaSMikko Rapeli __u32 buffer_handle; 84621de2fdaSMikko Rapeli __u32 shader_handle; 84721de2fdaSMikko Rapeli __u64 offset; 848cfe4d53eSThomas Hellstrom }; 849cfe4d53eSThomas Hellstrom 850cfe4d53eSThomas Hellstrom /*************************************************************************/ 851cfe4d53eSThomas Hellstrom /** 852cfe4d53eSThomas Hellstrom * DRM_VMW_UNREF_SHADER - Unreferences a shader 853cfe4d53eSThomas Hellstrom * 854cfe4d53eSThomas Hellstrom * Destroys a user-space reference to a shader, optionally destroying 855cfe4d53eSThomas Hellstrom * it. 856cfe4d53eSThomas Hellstrom */ 857cfe4d53eSThomas Hellstrom 858cfe4d53eSThomas Hellstrom /** 859cfe4d53eSThomas Hellstrom * struct drm_vmw_shader_arg 860cfe4d53eSThomas Hellstrom * 861cfe4d53eSThomas Hellstrom * @handle: Handle identifying the shader to destroy. 862cfe4d53eSThomas Hellstrom * 863cfe4d53eSThomas Hellstrom * Input argument to the DRM_VMW_UNREF_SHADER ioctl. 864cfe4d53eSThomas Hellstrom */ 865cfe4d53eSThomas Hellstrom struct drm_vmw_shader_arg { 86621de2fdaSMikko Rapeli __u32 handle; 86721de2fdaSMikko Rapeli __u32 pad64; 868cfe4d53eSThomas Hellstrom }; 869cfe4d53eSThomas Hellstrom 870cfe4d53eSThomas Hellstrom /*************************************************************************/ 871cfe4d53eSThomas Hellstrom /** 872cfe4d53eSThomas Hellstrom * DRM_VMW_GB_SURFACE_CREATE - Create a host guest-backed surface. 873cfe4d53eSThomas Hellstrom * 874cfe4d53eSThomas Hellstrom * Allocates a surface handle and queues a create surface command 875cfe4d53eSThomas Hellstrom * for the host on the first use of the surface. The surface ID can 876cfe4d53eSThomas Hellstrom * be used as the surface ID in commands referencing the surface. 877cfe4d53eSThomas Hellstrom */ 878cfe4d53eSThomas Hellstrom 879cfe4d53eSThomas Hellstrom /** 880cfe4d53eSThomas Hellstrom * enum drm_vmw_surface_flags 881cfe4d53eSThomas Hellstrom * 882cfe4d53eSThomas Hellstrom * @drm_vmw_surface_flag_shareable: Whether the surface is shareable 883cfe4d53eSThomas Hellstrom * @drm_vmw_surface_flag_scanout: Whether the surface is a scanout 884cfe4d53eSThomas Hellstrom * surface. 885cfe4d53eSThomas Hellstrom * @drm_vmw_surface_flag_create_buffer: Create a backup buffer if none is 886cfe4d53eSThomas Hellstrom * given. 887cfe4d53eSThomas Hellstrom */ 888cfe4d53eSThomas Hellstrom enum drm_vmw_surface_flags { 889cfe4d53eSThomas Hellstrom drm_vmw_surface_flag_shareable = (1 << 0), 890cfe4d53eSThomas Hellstrom drm_vmw_surface_flag_scanout = (1 << 1), 891cfe4d53eSThomas Hellstrom drm_vmw_surface_flag_create_buffer = (1 << 2) 892cfe4d53eSThomas Hellstrom }; 893cfe4d53eSThomas Hellstrom 894cfe4d53eSThomas Hellstrom /** 895cfe4d53eSThomas Hellstrom * struct drm_vmw_gb_surface_create_req 896cfe4d53eSThomas Hellstrom * 897cfe4d53eSThomas Hellstrom * @svga3d_flags: SVGA3d surface flags for the device. 898cfe4d53eSThomas Hellstrom * @format: SVGA3d format. 899cfe4d53eSThomas Hellstrom * @mip_level: Number of mip levels for all faces. 900cfe4d53eSThomas Hellstrom * @drm_surface_flags Flags as described above. 90115c6f656SZack Rusin * @multisample_count Future use. Set to 0. 902cfe4d53eSThomas Hellstrom * @autogen_filter Future use. Set to 0. 903cfe4d53eSThomas Hellstrom * @buffer_handle Buffer handle of backup buffer. SVGA3D_INVALID_ID 904cfe4d53eSThomas Hellstrom * if none. 905cfe4d53eSThomas Hellstrom * @base_size Size of the base mip level for all faces. 906d80efd5cSThomas Hellstrom * @array_size Must be zero for non-DX hardware, and if non-zero 907d80efd5cSThomas Hellstrom * svga3d_flags must have proper bind flags setup. 908cfe4d53eSThomas Hellstrom * 909cfe4d53eSThomas Hellstrom * Input argument to the DRM_VMW_GB_SURFACE_CREATE Ioctl. 910cfe4d53eSThomas Hellstrom * Part of output argument for the DRM_VMW_GB_SURFACE_REF Ioctl. 911cfe4d53eSThomas Hellstrom */ 912cfe4d53eSThomas Hellstrom struct drm_vmw_gb_surface_create_req { 91321de2fdaSMikko Rapeli __u32 svga3d_flags; 91421de2fdaSMikko Rapeli __u32 format; 91521de2fdaSMikko Rapeli __u32 mip_levels; 916cfe4d53eSThomas Hellstrom enum drm_vmw_surface_flags drm_surface_flags; 91721de2fdaSMikko Rapeli __u32 multisample_count; 91821de2fdaSMikko Rapeli __u32 autogen_filter; 91921de2fdaSMikko Rapeli __u32 buffer_handle; 92021de2fdaSMikko Rapeli __u32 array_size; 921cfe4d53eSThomas Hellstrom struct drm_vmw_size base_size; 922cfe4d53eSThomas Hellstrom }; 923cfe4d53eSThomas Hellstrom 924cfe4d53eSThomas Hellstrom /** 925cfe4d53eSThomas Hellstrom * struct drm_vmw_gb_surface_create_rep 926cfe4d53eSThomas Hellstrom * 927cfe4d53eSThomas Hellstrom * @handle: Surface handle. 928cfe4d53eSThomas Hellstrom * @backup_size: Size of backup buffers for this surface. 929cfe4d53eSThomas Hellstrom * @buffer_handle: Handle of backup buffer. SVGA3D_INVALID_ID if none. 930cfe4d53eSThomas Hellstrom * @buffer_size: Actual size of the buffer identified by 931cfe4d53eSThomas Hellstrom * @buffer_handle 932cfe4d53eSThomas Hellstrom * @buffer_map_handle: Offset into device address space for the buffer 933cfe4d53eSThomas Hellstrom * identified by @buffer_handle. 934cfe4d53eSThomas Hellstrom * 935cfe4d53eSThomas Hellstrom * Part of output argument for the DRM_VMW_GB_SURFACE_REF ioctl. 936cfe4d53eSThomas Hellstrom * Output argument for the DRM_VMW_GB_SURFACE_CREATE ioctl. 937cfe4d53eSThomas Hellstrom */ 938cfe4d53eSThomas Hellstrom struct drm_vmw_gb_surface_create_rep { 93921de2fdaSMikko Rapeli __u32 handle; 94021de2fdaSMikko Rapeli __u32 backup_size; 94121de2fdaSMikko Rapeli __u32 buffer_handle; 94221de2fdaSMikko Rapeli __u32 buffer_size; 94321de2fdaSMikko Rapeli __u64 buffer_map_handle; 944cfe4d53eSThomas Hellstrom }; 945cfe4d53eSThomas Hellstrom 946cfe4d53eSThomas Hellstrom /** 947cfe4d53eSThomas Hellstrom * union drm_vmw_gb_surface_create_arg 948cfe4d53eSThomas Hellstrom * 949cfe4d53eSThomas Hellstrom * @req: Input argument as described above. 950cfe4d53eSThomas Hellstrom * @rep: Output argument as described above. 951cfe4d53eSThomas Hellstrom * 952cfe4d53eSThomas Hellstrom * Argument to the DRM_VMW_GB_SURFACE_CREATE ioctl. 953cfe4d53eSThomas Hellstrom */ 954cfe4d53eSThomas Hellstrom union drm_vmw_gb_surface_create_arg { 955cfe4d53eSThomas Hellstrom struct drm_vmw_gb_surface_create_rep rep; 956cfe4d53eSThomas Hellstrom struct drm_vmw_gb_surface_create_req req; 957cfe4d53eSThomas Hellstrom }; 958cfe4d53eSThomas Hellstrom 959cfe4d53eSThomas Hellstrom /*************************************************************************/ 960cfe4d53eSThomas Hellstrom /** 961cfe4d53eSThomas Hellstrom * DRM_VMW_GB_SURFACE_REF - Reference a host surface. 962cfe4d53eSThomas Hellstrom * 963cfe4d53eSThomas Hellstrom * Puts a reference on a host surface with a given handle, as previously 964cfe4d53eSThomas Hellstrom * returned by the DRM_VMW_GB_SURFACE_CREATE ioctl. 965cfe4d53eSThomas Hellstrom * A reference will make sure the surface isn't destroyed while we hold 966cfe4d53eSThomas Hellstrom * it and will allow the calling client to use the surface handle in 967cfe4d53eSThomas Hellstrom * the command stream. 968cfe4d53eSThomas Hellstrom * 969cfe4d53eSThomas Hellstrom * On successful return, the Ioctl returns the surface information given 970cfe4d53eSThomas Hellstrom * to and returned from the DRM_VMW_GB_SURFACE_CREATE ioctl. 971cfe4d53eSThomas Hellstrom */ 972cfe4d53eSThomas Hellstrom 973cfe4d53eSThomas Hellstrom /** 974cfe4d53eSThomas Hellstrom * struct drm_vmw_gb_surface_reference_arg 975cfe4d53eSThomas Hellstrom * 976cfe4d53eSThomas Hellstrom * @creq: The data used as input when the surface was created, as described 977cfe4d53eSThomas Hellstrom * above at "struct drm_vmw_gb_surface_create_req" 978cfe4d53eSThomas Hellstrom * @crep: Additional data output when the surface was created, as described 979cfe4d53eSThomas Hellstrom * above at "struct drm_vmw_gb_surface_create_rep" 980cfe4d53eSThomas Hellstrom * 981cfe4d53eSThomas Hellstrom * Output Argument to the DRM_VMW_GB_SURFACE_REF ioctl. 982cfe4d53eSThomas Hellstrom */ 983cfe4d53eSThomas Hellstrom struct drm_vmw_gb_surface_ref_rep { 984cfe4d53eSThomas Hellstrom struct drm_vmw_gb_surface_create_req creq; 985cfe4d53eSThomas Hellstrom struct drm_vmw_gb_surface_create_rep crep; 986cfe4d53eSThomas Hellstrom }; 987cfe4d53eSThomas Hellstrom 988cfe4d53eSThomas Hellstrom /** 989cfe4d53eSThomas Hellstrom * union drm_vmw_gb_surface_reference_arg 990cfe4d53eSThomas Hellstrom * 991cfe4d53eSThomas Hellstrom * @req: Input data as described above at "struct drm_vmw_surface_arg" 992cfe4d53eSThomas Hellstrom * @rep: Output data as described above at "struct drm_vmw_gb_surface_ref_rep" 993cfe4d53eSThomas Hellstrom * 994cfe4d53eSThomas Hellstrom * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl. 995cfe4d53eSThomas Hellstrom */ 996cfe4d53eSThomas Hellstrom union drm_vmw_gb_surface_reference_arg { 997cfe4d53eSThomas Hellstrom struct drm_vmw_gb_surface_ref_rep rep; 998cfe4d53eSThomas Hellstrom struct drm_vmw_surface_arg req; 999cfe4d53eSThomas Hellstrom }; 1000cfe4d53eSThomas Hellstrom 1001cfe4d53eSThomas Hellstrom 10021d7a5cbfSThomas Hellstrom /*************************************************************************/ 10031d7a5cbfSThomas Hellstrom /** 10041d7a5cbfSThomas Hellstrom * DRM_VMW_SYNCCPU - Sync a DMA buffer / MOB for CPU access. 10051d7a5cbfSThomas Hellstrom * 10061d7a5cbfSThomas Hellstrom * Idles any previously submitted GPU operations on the buffer and 10071d7a5cbfSThomas Hellstrom * by default blocks command submissions that reference the buffer. 10081d7a5cbfSThomas Hellstrom * If the file descriptor used to grab a blocking CPU sync is closed, the 10091d7a5cbfSThomas Hellstrom * cpu sync is released. 10101d7a5cbfSThomas Hellstrom * The flags argument indicates how the grab / release operation should be 10111d7a5cbfSThomas Hellstrom * performed: 10121d7a5cbfSThomas Hellstrom */ 10131d7a5cbfSThomas Hellstrom 10141d7a5cbfSThomas Hellstrom /** 10151d7a5cbfSThomas Hellstrom * enum drm_vmw_synccpu_flags - Synccpu flags: 10161d7a5cbfSThomas Hellstrom * 10171d7a5cbfSThomas Hellstrom * @drm_vmw_synccpu_read: Sync for read. If sync is done for read only, it's a 10181d7a5cbfSThomas Hellstrom * hint to the kernel to allow command submissions that references the buffer 10191d7a5cbfSThomas Hellstrom * for read-only. 10201d7a5cbfSThomas Hellstrom * @drm_vmw_synccpu_write: Sync for write. Block all command submissions 10211d7a5cbfSThomas Hellstrom * referencing this buffer. 10221d7a5cbfSThomas Hellstrom * @drm_vmw_synccpu_dontblock: Dont wait for GPU idle, but rather return 10231d7a5cbfSThomas Hellstrom * -EBUSY should the buffer be busy. 10241d7a5cbfSThomas Hellstrom * @drm_vmw_synccpu_allow_cs: Allow command submission that touches the buffer 10251d7a5cbfSThomas Hellstrom * while the buffer is synced for CPU. This is similar to the GEM bo idle 10261d7a5cbfSThomas Hellstrom * behavior. 10271d7a5cbfSThomas Hellstrom */ 10281d7a5cbfSThomas Hellstrom enum drm_vmw_synccpu_flags { 10291d7a5cbfSThomas Hellstrom drm_vmw_synccpu_read = (1 << 0), 10301d7a5cbfSThomas Hellstrom drm_vmw_synccpu_write = (1 << 1), 10311d7a5cbfSThomas Hellstrom drm_vmw_synccpu_dontblock = (1 << 2), 10321d7a5cbfSThomas Hellstrom drm_vmw_synccpu_allow_cs = (1 << 3) 10331d7a5cbfSThomas Hellstrom }; 10341d7a5cbfSThomas Hellstrom 10351d7a5cbfSThomas Hellstrom /** 10361d7a5cbfSThomas Hellstrom * enum drm_vmw_synccpu_op - Synccpu operations: 10371d7a5cbfSThomas Hellstrom * 10381d7a5cbfSThomas Hellstrom * @drm_vmw_synccpu_grab: Grab the buffer for CPU operations 10391d7a5cbfSThomas Hellstrom * @drm_vmw_synccpu_release: Release a previous grab. 10401d7a5cbfSThomas Hellstrom */ 10411d7a5cbfSThomas Hellstrom enum drm_vmw_synccpu_op { 10421d7a5cbfSThomas Hellstrom drm_vmw_synccpu_grab, 10431d7a5cbfSThomas Hellstrom drm_vmw_synccpu_release 10441d7a5cbfSThomas Hellstrom }; 10451d7a5cbfSThomas Hellstrom 10461d7a5cbfSThomas Hellstrom /** 10471d7a5cbfSThomas Hellstrom * struct drm_vmw_synccpu_arg 10481d7a5cbfSThomas Hellstrom * 10491d7a5cbfSThomas Hellstrom * @op: The synccpu operation as described above. 10501d7a5cbfSThomas Hellstrom * @handle: Handle identifying the buffer object. 10511d7a5cbfSThomas Hellstrom * @flags: Flags as described above. 10521d7a5cbfSThomas Hellstrom */ 10531d7a5cbfSThomas Hellstrom struct drm_vmw_synccpu_arg { 10541d7a5cbfSThomas Hellstrom enum drm_vmw_synccpu_op op; 10551d7a5cbfSThomas Hellstrom enum drm_vmw_synccpu_flags flags; 105621de2fdaSMikko Rapeli __u32 handle; 105721de2fdaSMikko Rapeli __u32 pad64; 10581d7a5cbfSThomas Hellstrom }; 1059cfe4d53eSThomas Hellstrom 1060d80efd5cSThomas Hellstrom /*************************************************************************/ 1061d80efd5cSThomas Hellstrom /** 1062d80efd5cSThomas Hellstrom * DRM_VMW_CREATE_EXTENDED_CONTEXT - Create a host context. 1063d80efd5cSThomas Hellstrom * 1064d80efd5cSThomas Hellstrom * Allocates a device unique context id, and queues a create context command 1065d80efd5cSThomas Hellstrom * for the host. Does not wait for host completion. 1066d80efd5cSThomas Hellstrom */ 1067d80efd5cSThomas Hellstrom enum drm_vmw_extended_context { 1068d80efd5cSThomas Hellstrom drm_vmw_context_legacy, 1069d80efd5cSThomas Hellstrom drm_vmw_context_dx 1070d80efd5cSThomas Hellstrom }; 1071d80efd5cSThomas Hellstrom 1072d80efd5cSThomas Hellstrom /** 1073d80efd5cSThomas Hellstrom * union drm_vmw_extended_context_arg 1074d80efd5cSThomas Hellstrom * 1075d80efd5cSThomas Hellstrom * @req: Context type. 1076d80efd5cSThomas Hellstrom * @rep: Context identifier. 1077d80efd5cSThomas Hellstrom * 1078d80efd5cSThomas Hellstrom * Argument to the DRM_VMW_CREATE_EXTENDED_CONTEXT Ioctl. 1079d80efd5cSThomas Hellstrom */ 1080d80efd5cSThomas Hellstrom union drm_vmw_extended_context_arg { 1081d80efd5cSThomas Hellstrom enum drm_vmw_extended_context req; 1082d80efd5cSThomas Hellstrom struct drm_vmw_context_arg rep; 1083d80efd5cSThomas Hellstrom }; 1084d3450e00SEmil Velikov 10852f9545ceSThomas Hellstrom /*************************************************************************/ 10862f9545ceSThomas Hellstrom /* 10872f9545ceSThomas Hellstrom * DRM_VMW_HANDLE_CLOSE - Close a user-space handle and release its 10882f9545ceSThomas Hellstrom * underlying resource. 10892f9545ceSThomas Hellstrom * 1090f1d34bfdSThomas Hellstrom * Note that this ioctl is overlaid on the deprecated DRM_VMW_UNREF_DMABUF 1091f1d34bfdSThomas Hellstrom * Ioctl. 10922f9545ceSThomas Hellstrom */ 10932f9545ceSThomas Hellstrom 10942f9545ceSThomas Hellstrom /** 10952f9545ceSThomas Hellstrom * struct drm_vmw_handle_close_arg 10962f9545ceSThomas Hellstrom * 10972f9545ceSThomas Hellstrom * @handle: Handle to close. 10982f9545ceSThomas Hellstrom * 10992f9545ceSThomas Hellstrom * Argument to the DRM_VMW_HANDLE_CLOSE Ioctl. 11002f9545ceSThomas Hellstrom */ 11012f9545ceSThomas Hellstrom struct drm_vmw_handle_close_arg { 11022f9545ceSThomas Hellstrom __u32 handle; 11032f9545ceSThomas Hellstrom __u32 pad64; 11042f9545ceSThomas Hellstrom }; 1105f1d34bfdSThomas Hellstrom #define drm_vmw_unref_dmabuf_arg drm_vmw_handle_close_arg 11062f9545ceSThomas Hellstrom 1107d3450e00SEmil Velikov #if defined(__cplusplus) 1108d3450e00SEmil Velikov } 1109d3450e00SEmil Velikov #endif 1110d3450e00SEmil Velikov 1111718dceddSDavid Howells #endif 1112