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