diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2012-11-21 06:32:19 -0500 |
---|---|---|
committer | Thomas Hellstrom <thellstrom@vmware.com> | 2014-01-17 01:52:33 -0500 |
commit | 1d7a5cbf8f74edee0b1d9ee479367b5d876bf627 (patch) | |
tree | 28598b7931f80455a980de7356ed5ea686db14a9 /include/uapi | |
parent | 15c6f6562317eb18e686a89735aa8c524d88096e (diff) |
drm/vmwgfx: Implement a buffer object synccpu ioctl.
This ioctl enables inter-process synchronization of buffer objects,
which is needed for mesa Guest-Backed objects.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'include/uapi')
-rw-r--r-- | include/uapi/drm/vmwgfx_drm.h | 63 |
1 files changed, 62 insertions, 1 deletions
diff --git a/include/uapi/drm/vmwgfx_drm.h b/include/uapi/drm/vmwgfx_drm.h index bb3b91d84914..adb7e0d0d3b6 100644 --- a/include/uapi/drm/vmwgfx_drm.h +++ b/include/uapi/drm/vmwgfx_drm.h | |||
@@ -28,6 +28,10 @@ | |||
28 | #ifndef __VMWGFX_DRM_H__ | 28 | #ifndef __VMWGFX_DRM_H__ |
29 | #define __VMWGFX_DRM_H__ | 29 | #define __VMWGFX_DRM_H__ |
30 | 30 | ||
31 | #ifndef __KERNEL__ | ||
32 | #include <drm.h> | ||
33 | #endif | ||
34 | |||
31 | #define DRM_VMW_MAX_SURFACE_FACES 6 | 35 | #define DRM_VMW_MAX_SURFACE_FACES 6 |
32 | #define DRM_VMW_MAX_MIP_LEVELS 24 | 36 | #define DRM_VMW_MAX_MIP_LEVELS 24 |
33 | 37 | ||
@@ -59,7 +63,7 @@ | |||
59 | #define DRM_VMW_UNREF_SHADER 22 | 63 | #define DRM_VMW_UNREF_SHADER 22 |
60 | #define DRM_VMW_GB_SURFACE_CREATE 23 | 64 | #define DRM_VMW_GB_SURFACE_CREATE 23 |
61 | #define DRM_VMW_GB_SURFACE_REF 24 | 65 | #define DRM_VMW_GB_SURFACE_REF 24 |
62 | 66 | #define DRM_VMW_SYNCCPU 25 | |
63 | 67 | ||
64 | /*************************************************************************/ | 68 | /*************************************************************************/ |
65 | /** | 69 | /** |
@@ -985,5 +989,62 @@ union drm_vmw_gb_surface_reference_arg { | |||
985 | }; | 989 | }; |
986 | 990 | ||
987 | 991 | ||
992 | /*************************************************************************/ | ||
993 | /** | ||
994 | * DRM_VMW_SYNCCPU - Sync a DMA buffer / MOB for CPU access. | ||
995 | * | ||
996 | * Idles any previously submitted GPU operations on the buffer and | ||
997 | * by default blocks command submissions that reference the buffer. | ||
998 | * If the file descriptor used to grab a blocking CPU sync is closed, the | ||
999 | * cpu sync is released. | ||
1000 | * The flags argument indicates how the grab / release operation should be | ||
1001 | * performed: | ||
1002 | */ | ||
1003 | |||
1004 | /** | ||
1005 | * enum drm_vmw_synccpu_flags - Synccpu flags: | ||
1006 | * | ||
1007 | * @drm_vmw_synccpu_read: Sync for read. If sync is done for read only, it's a | ||
1008 | * hint to the kernel to allow command submissions that references the buffer | ||
1009 | * for read-only. | ||
1010 | * @drm_vmw_synccpu_write: Sync for write. Block all command submissions | ||
1011 | * referencing this buffer. | ||
1012 | * @drm_vmw_synccpu_dontblock: Dont wait for GPU idle, but rather return | ||
1013 | * -EBUSY should the buffer be busy. | ||
1014 | * @drm_vmw_synccpu_allow_cs: Allow command submission that touches the buffer | ||
1015 | * while the buffer is synced for CPU. This is similar to the GEM bo idle | ||
1016 | * behavior. | ||
1017 | */ | ||
1018 | enum drm_vmw_synccpu_flags { | ||
1019 | drm_vmw_synccpu_read = (1 << 0), | ||
1020 | drm_vmw_synccpu_write = (1 << 1), | ||
1021 | drm_vmw_synccpu_dontblock = (1 << 2), | ||
1022 | drm_vmw_synccpu_allow_cs = (1 << 3) | ||
1023 | }; | ||
1024 | |||
1025 | /** | ||
1026 | * enum drm_vmw_synccpu_op - Synccpu operations: | ||
1027 | * | ||
1028 | * @drm_vmw_synccpu_grab: Grab the buffer for CPU operations | ||
1029 | * @drm_vmw_synccpu_release: Release a previous grab. | ||
1030 | */ | ||
1031 | enum drm_vmw_synccpu_op { | ||
1032 | drm_vmw_synccpu_grab, | ||
1033 | drm_vmw_synccpu_release | ||
1034 | }; | ||
1035 | |||
1036 | /** | ||
1037 | * struct drm_vmw_synccpu_arg | ||
1038 | * | ||
1039 | * @op: The synccpu operation as described above. | ||
1040 | * @handle: Handle identifying the buffer object. | ||
1041 | * @flags: Flags as described above. | ||
1042 | */ | ||
1043 | struct drm_vmw_synccpu_arg { | ||
1044 | enum drm_vmw_synccpu_op op; | ||
1045 | enum drm_vmw_synccpu_flags flags; | ||
1046 | uint32_t handle; | ||
1047 | uint32_t pad64; | ||
1048 | }; | ||
988 | 1049 | ||
989 | #endif | 1050 | #endif |