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