diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2011-09-01 16:18:44 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-09-06 06:51:11 -0400 |
commit | ae2a104058e217548215bfe6c6c8a98752139c29 (patch) | |
tree | 9f3fccec1c8f4e78b67b44fc6b4cdda10f3291da /include/drm | |
parent | 4f73a96bd76914009682432842ac04a32ab9115b (diff) |
vmwgfx: Implement fence objects
Will be needed for queries and drm event-driven throttling.
As a benefit, they help avoid stale user-space fence handles.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'include/drm')
-rw-r--r-- | include/drm/vmwgfx_drm.h | 149 |
1 files changed, 134 insertions, 15 deletions
diff --git a/include/drm/vmwgfx_drm.h b/include/drm/vmwgfx_drm.h index c2b3909ac50a..763a7a3885a1 100644 --- a/include/drm/vmwgfx_drm.h +++ b/include/drm/vmwgfx_drm.h | |||
@@ -48,8 +48,12 @@ | |||
48 | #define DRM_VMW_UNREF_SURFACE 10 | 48 | #define DRM_VMW_UNREF_SURFACE 10 |
49 | #define DRM_VMW_REF_SURFACE 11 | 49 | #define DRM_VMW_REF_SURFACE 11 |
50 | #define DRM_VMW_EXECBUF 12 | 50 | #define DRM_VMW_EXECBUF 12 |
51 | #define DRM_VMW_FENCE_WAIT 13 | 51 | #define DRM_VMW_GET_3D_CAP 13 |
52 | #define DRM_VMW_GET_3D_CAP 14 | 52 | #define DRM_VMW_FENCE_WAIT 14 |
53 | #define DRM_VMW_FENCE_SIGNALED 15 | ||
54 | #define DRM_VMW_FENCE_UNREF 16 | ||
55 | #define DRM_VMW_FENCE_EVENT 17 | ||
56 | |||
53 | 57 | ||
54 | /*************************************************************************/ | 58 | /*************************************************************************/ |
55 | /** | 59 | /** |
@@ -318,14 +322,23 @@ struct drm_vmw_execbuf_arg { | |||
318 | uint32_t command_size; | 322 | uint32_t command_size; |
319 | uint32_t throttle_us; | 323 | uint32_t throttle_us; |
320 | uint64_t fence_rep; | 324 | uint64_t fence_rep; |
321 | uint32_t version; | 325 | uint32_t version; |
322 | uint32_t flags; | 326 | uint32_t flags; |
323 | }; | 327 | }; |
324 | 328 | ||
325 | /** | 329 | /** |
326 | * struct drm_vmw_fence_rep | 330 | * struct drm_vmw_fence_rep |
327 | * | 331 | * |
328 | * @fence_seq: Fence seqno associated with a command submission. | 332 | * @handle: Fence object handle for fence associated with a command submission. |
333 | * @mask: Fence flags relevant for this fence object. | ||
334 | * @seqno: Fence sequence number in fifo. A fence object with a lower | ||
335 | * seqno will signal the EXEC flag before a fence object with a higher | ||
336 | * seqno. This can be used by user-space to avoid kernel calls to determine | ||
337 | * whether a fence has signaled the EXEC flag. Note that @seqno will | ||
338 | * wrap at 32-bit. | ||
339 | * @passed_seqno: The highest seqno number processed by the hardware | ||
340 | * so far. This can be used to mark user-space fence objects as signaled, and | ||
341 | * to determine whether a fence seqno might be stale. | ||
329 | * @error: This member should've been set to -EFAULT on submission. | 342 | * @error: This member should've been set to -EFAULT on submission. |
330 | * The following actions should be take on completion: | 343 | * The following actions should be take on completion: |
331 | * error == -EFAULT: Fence communication failed. The host is synchronized. | 344 | * error == -EFAULT: Fence communication failed. The host is synchronized. |
@@ -339,9 +352,12 @@ struct drm_vmw_execbuf_arg { | |||
339 | */ | 352 | */ |
340 | 353 | ||
341 | struct drm_vmw_fence_rep { | 354 | struct drm_vmw_fence_rep { |
342 | uint64_t fence_seq; | 355 | uint32_t handle; |
343 | int32_t error; | 356 | uint32_t mask; |
357 | uint32_t seqno; | ||
358 | uint32_t passed_seqno; | ||
344 | uint32_t pad64; | 359 | uint32_t pad64; |
360 | int32_t error; | ||
345 | }; | 361 | }; |
346 | 362 | ||
347 | /*************************************************************************/ | 363 | /*************************************************************************/ |
@@ -430,14 +446,6 @@ struct drm_vmw_unref_dmabuf_arg { | |||
430 | uint32_t pad64; | 446 | uint32_t pad64; |
431 | }; | 447 | }; |
432 | 448 | ||
433 | |||
434 | struct drm_vmw_fence_wait_arg { | ||
435 | uint64_t seqno; | ||
436 | uint64_t kernel_cookie; | ||
437 | int32_t cookie_valid; | ||
438 | int32_t pad64; | ||
439 | }; | ||
440 | |||
441 | /*************************************************************************/ | 449 | /*************************************************************************/ |
442 | /** | 450 | /** |
443 | * DRM_VMW_CONTROL_STREAM - Control overlays, aka streams. | 451 | * DRM_VMW_CONTROL_STREAM - Control overlays, aka streams. |
@@ -559,6 +567,7 @@ struct drm_vmw_stream_arg { | |||
559 | * Return a single stream that was claimed by this process. Also makes | 567 | * Return a single stream that was claimed by this process. Also makes |
560 | * sure that the stream has been stopped. | 568 | * sure that the stream has been stopped. |
561 | */ | 569 | */ |
570 | |||
562 | /*************************************************************************/ | 571 | /*************************************************************************/ |
563 | /** | 572 | /** |
564 | * DRM_VMW_GET_3D_CAP | 573 | * DRM_VMW_GET_3D_CAP |
@@ -607,4 +616,114 @@ struct drm_vmw_update_layout_arg { | |||
607 | uint64_t rects; | 616 | uint64_t rects; |
608 | }; | 617 | }; |
609 | 618 | ||
619 | |||
620 | /*************************************************************************/ | ||
621 | /** | ||
622 | * DRM_VMW_FENCE_WAIT | ||
623 | * | ||
624 | * Waits for a fence object to signal. The wait is interruptible, so that | ||
625 | * signals may be delivered during the interrupt. The wait may timeout, | ||
626 | * in which case the calls returns -EBUSY. If the wait is restarted, | ||
627 | * that is restarting without resetting @cookie_valid to zero, | ||
628 | * the timeout is computed from the first call. | ||
629 | * | ||
630 | * The flags argument to the DRM_VMW_FENCE_WAIT ioctl indicates what to wait | ||
631 | * on: | ||
632 | * DRM_VMW_FENCE_FLAG_EXEC: All commands ahead of the fence in the command | ||
633 | * stream | ||
634 | * have executed. | ||
635 | * DRM_VMW_FENCE_FLAG_QUERY: All query results resulting from query finish | ||
636 | * commands | ||
637 | * in the buffer given to the EXECBUF ioctl returning the fence object handle | ||
638 | * are available to user-space. | ||
639 | * | ||
640 | * DRM_VMW_WAIT_OPTION_UNREF: If this wait option is given, and the | ||
641 | * fenc wait ioctl returns 0, the fence object has been unreferenced after | ||
642 | * the wait. | ||
643 | */ | ||
644 | |||
645 | #define DRM_VMW_FENCE_FLAG_EXEC (1 << 0) | ||
646 | #define DRM_VMW_FENCE_FLAG_QUERY (1 << 1) | ||
647 | |||
648 | #define DRM_VMW_WAIT_OPTION_UNREF (1 << 0) | ||
649 | |||
650 | /** | ||
651 | * struct drm_vmw_fence_wait_arg | ||
652 | * | ||
653 | * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl. | ||
654 | * @cookie_valid: Must be reset to 0 on first call. Left alone on restart. | ||
655 | * @kernel_cookie: Set to 0 on first call. Left alone on restart. | ||
656 | * @timeout_us: Wait timeout in microseconds. 0 for indefinite timeout. | ||
657 | * @lazy: Set to 1 if timing is not critical. Allow more than a kernel tick | ||
658 | * before returning. | ||
659 | * @flags: Fence flags to wait on. | ||
660 | * @wait_options: Options that control the behaviour of the wait ioctl. | ||
661 | * | ||
662 | * Input argument to the DRM_VMW_FENCE_WAIT ioctl. | ||
663 | */ | ||
664 | |||
665 | struct drm_vmw_fence_wait_arg { | ||
666 | uint32_t handle; | ||
667 | int32_t cookie_valid; | ||
668 | uint64_t kernel_cookie; | ||
669 | uint64_t timeout_us; | ||
670 | int32_t lazy; | ||
671 | int32_t flags; | ||
672 | int32_t wait_options; | ||
673 | int32_t pad64; | ||
674 | }; | ||
675 | |||
676 | /*************************************************************************/ | ||
677 | /** | ||
678 | * DRM_VMW_FENCE_SIGNALED | ||
679 | * | ||
680 | * Checks if a fence object is signaled.. | ||
681 | */ | ||
682 | |||
683 | /** | ||
684 | * struct drm_vmw_fence_signaled_arg | ||
685 | * | ||
686 | * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl. | ||
687 | * @flags: Fence object flags input to DRM_VMW_FENCE_SIGNALED ioctl | ||
688 | * @signaled: Out: Flags signaled. | ||
689 | * @sequence: Out: Highest sequence passed so far. Can be used to signal the | ||
690 | * EXEC flag of user-space fence objects. | ||
691 | * | ||
692 | * Input/Output argument to the DRM_VMW_FENCE_SIGNALED and DRM_VMW_FENCE_UNREF | ||
693 | * ioctls. | ||
694 | */ | ||
695 | |||
696 | struct drm_vmw_fence_signaled_arg { | ||
697 | uint32_t handle; | ||
698 | uint32_t flags; | ||
699 | int32_t signaled; | ||
700 | uint32_t passed_seqno; | ||
701 | uint32_t signaled_flags; | ||
702 | uint32_t pad64; | ||
703 | }; | ||
704 | |||
705 | /*************************************************************************/ | ||
706 | /** | ||
707 | * DRM_VMW_FENCE_UNREF | ||
708 | * | ||
709 | * Unreferences a fence object, and causes it to be destroyed if there are no | ||
710 | * other references to it. | ||
711 | * | ||
712 | */ | ||
713 | |||
714 | /** | ||
715 | * struct drm_vmw_fence_arg | ||
716 | * | ||
717 | * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl. | ||
718 | * | ||
719 | * Input/Output argument to the DRM_VMW_FENCE_UNREF ioctl.. | ||
720 | */ | ||
721 | |||
722 | struct drm_vmw_fence_arg { | ||
723 | uint32_t handle; | ||
724 | uint32_t pad64; | ||
725 | }; | ||
726 | |||
727 | |||
728 | |||
610 | #endif | 729 | #endif |