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