1 /**************************************************************************
3 * Copyright © 2009-2022 VMware, Inc., Palo Alto, CA., USA
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
28 #ifndef __VMWGFX_DRM_H__
29 #define __VMWGFX_DRM_H__
33 #if defined(__cplusplus)
37 #define DRM_VMW_MAX_SURFACE_FACES 6
38 #define DRM_VMW_MAX_MIP_LEVELS 24
41 #define DRM_VMW_GET_PARAM 0
42 #define DRM_VMW_ALLOC_DMABUF 1
43 #define DRM_VMW_ALLOC_BO 1
44 #define DRM_VMW_UNREF_DMABUF 2
45 #define DRM_VMW_HANDLE_CLOSE 2
46 #define DRM_VMW_CURSOR_BYPASS 3
47 /* guarded by DRM_VMW_PARAM_NUM_STREAMS != 0*/
48 #define DRM_VMW_CONTROL_STREAM 4
49 #define DRM_VMW_CLAIM_STREAM 5
50 #define DRM_VMW_UNREF_STREAM 6
51 /* guarded by DRM_VMW_PARAM_3D == 1 */
52 #define DRM_VMW_CREATE_CONTEXT 7
53 #define DRM_VMW_UNREF_CONTEXT 8
54 #define DRM_VMW_CREATE_SURFACE 9
55 #define DRM_VMW_UNREF_SURFACE 10
56 #define DRM_VMW_REF_SURFACE 11
57 #define DRM_VMW_EXECBUF 12
58 #define DRM_VMW_GET_3D_CAP 13
59 #define DRM_VMW_FENCE_WAIT 14
60 #define DRM_VMW_FENCE_SIGNALED 15
61 #define DRM_VMW_FENCE_UNREF 16
62 #define DRM_VMW_FENCE_EVENT 17
63 #define DRM_VMW_PRESENT 18
64 #define DRM_VMW_PRESENT_READBACK 19
65 #define DRM_VMW_UPDATE_LAYOUT 20
66 #define DRM_VMW_CREATE_SHADER 21
67 #define DRM_VMW_UNREF_SHADER 22
68 #define DRM_VMW_GB_SURFACE_CREATE 23
69 #define DRM_VMW_GB_SURFACE_REF 24
70 #define DRM_VMW_SYNCCPU 25
71 #define DRM_VMW_CREATE_EXTENDED_CONTEXT 26
72 #define DRM_VMW_GB_SURFACE_CREATE_EXT 27
73 #define DRM_VMW_GB_SURFACE_REF_EXT 28
74 #define DRM_VMW_MSG 29
75 #define DRM_VMW_MKSSTAT_RESET 30
76 #define DRM_VMW_MKSSTAT_ADD 31
77 #define DRM_VMW_MKSSTAT_REMOVE 32
79 /*************************************************************************/
81 * DRM_VMW_GET_PARAM - get device information.
83 * DRM_VMW_PARAM_FIFO_OFFSET:
84 * Offset to use to map the first page of the FIFO read-only.
85 * The fifo is mapped using the mmap() system call on the drm device.
87 * DRM_VMW_PARAM_OVERLAY_IOCTL:
88 * Does the driver support the overlay ioctl.
91 * SM4_1 support is enabled.
94 * SM5 support is enabled.
97 * SM5.1+GL4.3 support is enabled.
99 * DRM_VMW_PARAM_DEVICE_ID
100 * PCI ID of the underlying SVGA device.
103 #define DRM_VMW_PARAM_NUM_STREAMS 0
104 #define DRM_VMW_PARAM_NUM_FREE_STREAMS 1
105 #define DRM_VMW_PARAM_3D 2
106 #define DRM_VMW_PARAM_HW_CAPS 3
107 #define DRM_VMW_PARAM_FIFO_CAPS 4
108 #define DRM_VMW_PARAM_MAX_FB_SIZE 5
109 #define DRM_VMW_PARAM_FIFO_HW_VERSION 6
110 #define DRM_VMW_PARAM_MAX_SURF_MEMORY 7
111 #define DRM_VMW_PARAM_3D_CAPS_SIZE 8
112 #define DRM_VMW_PARAM_MAX_MOB_MEMORY 9
113 #define DRM_VMW_PARAM_MAX_MOB_SIZE 10
114 #define DRM_VMW_PARAM_SCREEN_TARGET 11
115 #define DRM_VMW_PARAM_DX 12
116 #define DRM_VMW_PARAM_HW_CAPS2 13
117 #define DRM_VMW_PARAM_SM4_1 14
118 #define DRM_VMW_PARAM_SM5 15
119 #define DRM_VMW_PARAM_GL43 16
120 #define DRM_VMW_PARAM_DEVICE_ID 17
123 * enum drm_vmw_handle_type - handle type for ref ioctls
126 enum drm_vmw_handle_type {
127 DRM_VMW_HANDLE_LEGACY = 0,
128 DRM_VMW_HANDLE_PRIME = 1
132 * struct drm_vmw_getparam_arg
134 * @value: Returned value. //Out
135 * @param: Parameter to query. //In.
137 * Argument to the DRM_VMW_GET_PARAM Ioctl.
140 struct drm_vmw_getparam_arg {
146 /*************************************************************************/
148 * DRM_VMW_CREATE_CONTEXT - Create a host context.
150 * Allocates a device unique context id, and queues a create context command
151 * for the host. Does not wait for host completion.
155 * struct drm_vmw_context_arg
157 * @cid: Device unique context ID.
159 * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
160 * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
163 struct drm_vmw_context_arg {
168 /*************************************************************************/
170 * DRM_VMW_UNREF_CONTEXT - Create a host context.
172 * Frees a global context id, and queues a destroy host command for the host.
173 * Does not wait for host completion. The context ID can be used directly
174 * in the command stream and shows up as the same context ID on the host.
177 /*************************************************************************/
179 * DRM_VMW_CREATE_SURFACE - Create a host suface.
181 * Allocates a device unique surface id, and queues a create surface command
182 * for the host. Does not wait for host completion. The surface ID can be
183 * used directly in the command stream and shows up as the same surface
188 * struct drm_wmv_surface_create_req
190 * @flags: Surface flags as understood by the host.
191 * @format: Surface format as understood by the host.
192 * @mip_levels: Number of mip levels for each face.
193 * An unused face should have 0 encoded.
194 * @size_addr: Address of a user-space array of sruct drm_vmw_size
195 * cast to an __u64 for 32-64 bit compatibility.
196 * The size of the array should equal the total number of mipmap levels.
197 * @shareable: Boolean whether other clients (as identified by file descriptors)
198 * may reference this surface.
199 * @scanout: Boolean whether the surface is intended to be used as a
202 * Input data to the DRM_VMW_CREATE_SURFACE Ioctl.
203 * Output data from the DRM_VMW_REF_SURFACE Ioctl.
206 struct drm_vmw_surface_create_req {
209 __u32 mip_levels[DRM_VMW_MAX_SURFACE_FACES];
216 * struct drm_wmv_surface_arg
218 * @sid: Surface id of created surface or surface to destroy or reference.
219 * @handle_type: Handle type for DRM_VMW_REF_SURFACE Ioctl.
221 * Output data from the DRM_VMW_CREATE_SURFACE Ioctl.
222 * Input argument to the DRM_VMW_UNREF_SURFACE Ioctl.
223 * Input argument to the DRM_VMW_REF_SURFACE Ioctl.
226 struct drm_vmw_surface_arg {
228 enum drm_vmw_handle_type handle_type;
232 * struct drm_vmw_size ioctl.
234 * @width - mip level width
235 * @height - mip level height
236 * @depth - mip level depth
238 * Description of a mip level.
239 * Input data to the DRM_WMW_CREATE_SURFACE Ioctl.
242 struct drm_vmw_size {
250 * union drm_vmw_surface_create_arg
252 * @rep: Output data as described above.
253 * @req: Input data as described above.
255 * Argument to the DRM_VMW_CREATE_SURFACE Ioctl.
258 union drm_vmw_surface_create_arg {
259 struct drm_vmw_surface_arg rep;
260 struct drm_vmw_surface_create_req req;
263 /*************************************************************************/
265 * DRM_VMW_REF_SURFACE - Reference a host surface.
267 * Puts a reference on a host surface with a give sid, as previously
268 * returned by the DRM_VMW_CREATE_SURFACE ioctl.
269 * A reference will make sure the surface isn't destroyed while we hold
270 * it and will allow the calling client to use the surface ID in the command
273 * On successful return, the Ioctl returns the surface information given
274 * in the DRM_VMW_CREATE_SURFACE ioctl.
278 * union drm_vmw_surface_reference_arg
280 * @rep: Output data as described above.
281 * @req: Input data as described above.
283 * Argument to the DRM_VMW_REF_SURFACE Ioctl.
286 union drm_vmw_surface_reference_arg {
287 struct drm_vmw_surface_create_req rep;
288 struct drm_vmw_surface_arg req;
291 /*************************************************************************/
293 * DRM_VMW_UNREF_SURFACE - Unreference a host surface.
295 * Clear a reference previously put on a host surface.
296 * When all references are gone, including the one implicitly placed
298 * a destroy surface command will be queued for the host.
299 * Does not wait for completion.
302 /*************************************************************************/
306 * Submit a command buffer for execution on the host, and return a
307 * fence seqno that when signaled, indicates that the command buffer has
312 * struct drm_vmw_execbuf_arg
314 * @commands: User-space address of a command buffer cast to an __u64.
315 * @command-size: Size in bytes of the command buffer.
316 * @throttle-us: Sleep until software is less than @throttle_us
317 * microseconds ahead of hardware. The driver may round this value
318 * to the nearest kernel tick.
319 * @fence_rep: User-space address of a struct drm_vmw_fence_rep cast to an
321 * @version: Allows expanding the execbuf ioctl parameters without breaking
322 * backwards compatibility, since user-space will always tell the kernel
323 * which version it uses.
324 * @flags: Execbuf flags.
325 * @imported_fence_fd: FD for a fence imported from another device
327 * Argument to the DRM_VMW_EXECBUF Ioctl.
330 #define DRM_VMW_EXECBUF_VERSION 2
332 #define DRM_VMW_EXECBUF_FLAG_IMPORT_FENCE_FD (1 << 0)
333 #define DRM_VMW_EXECBUF_FLAG_EXPORT_FENCE_FD (1 << 1)
335 struct drm_vmw_execbuf_arg {
342 __u32 context_handle;
343 __s32 imported_fence_fd;
347 * struct drm_vmw_fence_rep
349 * @handle: Fence object handle for fence associated with a command submission.
350 * @mask: Fence flags relevant for this fence object.
351 * @seqno: Fence sequence number in fifo. A fence object with a lower
352 * seqno will signal the EXEC flag before a fence object with a higher
353 * seqno. This can be used by user-space to avoid kernel calls to determine
354 * whether a fence has signaled the EXEC flag. Note that @seqno will
356 * @passed_seqno: The highest seqno number processed by the hardware
357 * so far. This can be used to mark user-space fence objects as signaled, and
358 * to determine whether a fence seqno might be stale.
359 * @fd: FD associated with the fence, -1 if not exported
360 * @error: This member should've been set to -EFAULT on submission.
361 * The following actions should be take on completion:
362 * error == -EFAULT: Fence communication failed. The host is synchronized.
363 * Use the last fence id read from the FIFO fence register.
364 * error != 0 && error != -EFAULT:
365 * Fence submission failed. The host is synchronized. Use the fence_seq member.
366 * error == 0: All is OK, The host may not be synchronized.
367 * Use the fence_seq member.
369 * Input / Output data to the DRM_VMW_EXECBUF Ioctl.
372 struct drm_vmw_fence_rep {
381 /*************************************************************************/
385 * Allocate a buffer object that is visible also to the host.
386 * NOTE: The buffer is
387 * identified by a handle and an offset, which are private to the guest, but
388 * useable in the command stream. The guest kernel may translate these
389 * and patch up the command stream accordingly. In the future, the offset may
390 * be zero at all times, or it may disappear from the interface before it is
393 * The buffer object may stay user-space mapped in the guest at all times,
394 * and is thus suitable for sub-allocation.
396 * Buffer objects are mapped using the mmap() syscall on the drm device.
400 * struct drm_vmw_alloc_bo_req
402 * @size: Required minimum size of the buffer.
404 * Input data to the DRM_VMW_ALLOC_BO Ioctl.
407 struct drm_vmw_alloc_bo_req {
411 #define drm_vmw_alloc_dmabuf_req drm_vmw_alloc_bo_req
414 * struct drm_vmw_bo_rep
416 * @map_handle: Offset to use in the mmap() call used to map the buffer.
417 * @handle: Handle unique to this buffer. Used for unreferencing.
418 * @cur_gmr_id: GMR id to use in the command stream when this buffer is
419 * referenced. See not above.
420 * @cur_gmr_offset: Offset to use in the command stream when this buffer is
421 * referenced. See note above.
423 * Output data from the DRM_VMW_ALLOC_BO Ioctl.
426 struct drm_vmw_bo_rep {
430 __u32 cur_gmr_offset;
433 #define drm_vmw_dmabuf_rep drm_vmw_bo_rep
436 * union drm_vmw_alloc_bo_arg
438 * @req: Input data as described above.
439 * @rep: Output data as described above.
441 * Argument to the DRM_VMW_ALLOC_BO Ioctl.
444 union drm_vmw_alloc_bo_arg {
445 struct drm_vmw_alloc_bo_req req;
446 struct drm_vmw_bo_rep rep;
448 #define drm_vmw_alloc_dmabuf_arg drm_vmw_alloc_bo_arg
450 /*************************************************************************/
452 * DRM_VMW_CONTROL_STREAM - Control overlays, aka streams.
454 * This IOCTL controls the overlay units of the svga device.
455 * The SVGA overlay units does not work like regular hardware units in
456 * that they do not automaticaly read back the contents of the given dma
457 * buffer. But instead only read back for each call to this ioctl, and
458 * at any point between this call being made and a following call that
459 * either changes the buffer or disables the stream.
463 * struct drm_vmw_rect
465 * Defines a rectangle. Used in the overlay ioctl to define
466 * source and destination rectangle.
469 struct drm_vmw_rect {
477 * struct drm_vmw_control_stream_arg
479 * @stream_id: Stearm to control
480 * @enabled: If false all following arguments are ignored.
481 * @handle: Handle to buffer for getting data from.
482 * @format: Format of the overlay as understood by the host.
483 * @width: Width of the overlay.
484 * @height: Height of the overlay.
485 * @size: Size of the overlay in bytes.
486 * @pitch: Array of pitches, the two last are only used for YUV12 formats.
487 * @offset: Offset from start of dma buffer to overlay.
488 * @src: Source rect, must be within the defined area above.
489 * @dst: Destination rect, x and y may be negative.
491 * Argument to the DRM_VMW_CONTROL_STREAM Ioctl.
494 struct drm_vmw_control_stream_arg {
510 struct drm_vmw_rect src;
511 struct drm_vmw_rect dst;
514 /*************************************************************************/
516 * DRM_VMW_CURSOR_BYPASS - Give extra information about cursor bypass.
520 #define DRM_VMW_CURSOR_BYPASS_ALL (1 << 0)
521 #define DRM_VMW_CURSOR_BYPASS_FLAGS (1)
524 * struct drm_vmw_cursor_bypass_arg
527 * @crtc_id: Crtc id, only used if DMR_CURSOR_BYPASS_ALL isn't passed.
528 * @xpos: X position of cursor.
529 * @ypos: Y position of cursor.
533 * Argument to the DRM_VMW_CURSOR_BYPASS Ioctl.
536 struct drm_vmw_cursor_bypass_arg {
545 /*************************************************************************/
547 * DRM_VMW_CLAIM_STREAM - Claim a single stream.
551 * struct drm_vmw_context_arg
553 * @stream_id: Device unique context ID.
555 * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
556 * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
559 struct drm_vmw_stream_arg {
564 /*************************************************************************/
566 * DRM_VMW_UNREF_STREAM - Unclaim a stream.
568 * Return a single stream that was claimed by this process. Also makes
569 * sure that the stream has been stopped.
572 /*************************************************************************/
576 * Read 3D capabilities from the FIFO
581 * struct drm_vmw_get_3d_cap_arg
583 * @buffer: Pointer to a buffer for capability data, cast to an __u64
584 * @size: Max size to copy
586 * Input argument to the DRM_VMW_GET_3D_CAP_IOCTL
590 struct drm_vmw_get_3d_cap_arg {
596 /*************************************************************************/
600 * Waits for a fence object to signal. The wait is interruptible, so that
601 * signals may be delivered during the interrupt. The wait may timeout,
602 * in which case the calls returns -EBUSY. If the wait is restarted,
603 * that is restarting without resetting @cookie_valid to zero,
604 * the timeout is computed from the first call.
606 * The flags argument to the DRM_VMW_FENCE_WAIT ioctl indicates what to wait
608 * DRM_VMW_FENCE_FLAG_EXEC: All commands ahead of the fence in the command
611 * DRM_VMW_FENCE_FLAG_QUERY: All query results resulting from query finish
613 * in the buffer given to the EXECBUF ioctl returning the fence object handle
614 * are available to user-space.
616 * DRM_VMW_WAIT_OPTION_UNREF: If this wait option is given, and the
617 * fenc wait ioctl returns 0, the fence object has been unreferenced after
621 #define DRM_VMW_FENCE_FLAG_EXEC (1 << 0)
622 #define DRM_VMW_FENCE_FLAG_QUERY (1 << 1)
624 #define DRM_VMW_WAIT_OPTION_UNREF (1 << 0)
627 * struct drm_vmw_fence_wait_arg
629 * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
630 * @cookie_valid: Must be reset to 0 on first call. Left alone on restart.
631 * @kernel_cookie: Set to 0 on first call. Left alone on restart.
632 * @timeout_us: Wait timeout in microseconds. 0 for indefinite timeout.
633 * @lazy: Set to 1 if timing is not critical. Allow more than a kernel tick
635 * @flags: Fence flags to wait on.
636 * @wait_options: Options that control the behaviour of the wait ioctl.
638 * Input argument to the DRM_VMW_FENCE_WAIT ioctl.
641 struct drm_vmw_fence_wait_arg {
652 /*************************************************************************/
654 * DRM_VMW_FENCE_SIGNALED
656 * Checks if a fence object is signaled..
660 * struct drm_vmw_fence_signaled_arg
662 * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
663 * @flags: Fence object flags input to DRM_VMW_FENCE_SIGNALED ioctl
664 * @signaled: Out: Flags signaled.
665 * @sequence: Out: Highest sequence passed so far. Can be used to signal the
666 * EXEC flag of user-space fence objects.
668 * Input/Output argument to the DRM_VMW_FENCE_SIGNALED and DRM_VMW_FENCE_UNREF
672 struct drm_vmw_fence_signaled_arg {
677 __u32 signaled_flags;
681 /*************************************************************************/
683 * DRM_VMW_FENCE_UNREF
685 * Unreferences a fence object, and causes it to be destroyed if there are no
686 * other references to it.
691 * struct drm_vmw_fence_arg
693 * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
695 * Input/Output argument to the DRM_VMW_FENCE_UNREF ioctl..
698 struct drm_vmw_fence_arg {
704 /*************************************************************************/
706 * DRM_VMW_FENCE_EVENT
708 * Queues an event on a fence to be delivered on the drm character device
709 * when the fence has signaled the DRM_VMW_FENCE_FLAG_EXEC flag.
710 * Optionally the approximate time when the fence signaled is
711 * given by the event.
717 #define DRM_VMW_EVENT_FENCE_SIGNALED 0x80000000
719 struct drm_vmw_event_fence {
720 struct drm_event base;
727 * Flags that may be given to the command.
729 /* Request fence signaled time on the event. */
730 #define DRM_VMW_FE_FLAG_REQ_TIME (1 << 0)
733 * struct drm_vmw_fence_event_arg
735 * @fence_rep: Pointer to fence_rep structure cast to __u64 or 0 if
736 * the fence is not supposed to be referenced by user-space.
737 * @user_info: Info to be delivered with the event.
738 * @handle: Attach the event to this fence only.
739 * @flags: A set of flags as defined above.
741 struct drm_vmw_fence_event_arg {
749 /*************************************************************************/
753 * Executes an SVGA present on a given fb for a given surface. The surface
754 * is placed on the framebuffer. Cliprects are given relative to the given
755 * point (the point disignated by dest_{x|y}).
760 * struct drm_vmw_present_arg
761 * @fb_id: framebuffer id to present / read back from.
762 * @sid: Surface id to present from.
763 * @dest_x: X placement coordinate for surface.
764 * @dest_y: Y placement coordinate for surface.
765 * @clips_ptr: Pointer to an array of clip rects cast to an __u64.
766 * @num_clips: Number of cliprects given relative to the framebuffer origin,
767 * in the same coordinate space as the frame buffer.
768 * @pad64: Unused 64-bit padding.
770 * Input argument to the DRM_VMW_PRESENT ioctl.
773 struct drm_vmw_present_arg {
784 /*************************************************************************/
786 * DRM_VMW_PRESENT_READBACK
788 * Executes an SVGA present readback from a given fb to the dma buffer
789 * currently bound as the fb. If there is no dma buffer bound to the fb,
790 * an error will be returned.
795 * struct drm_vmw_present_arg
796 * @fb_id: fb_id to present / read back from.
797 * @num_clips: Number of cliprects.
798 * @clips_ptr: Pointer to an array of clip rects cast to an __u64.
799 * @fence_rep: Pointer to a struct drm_vmw_fence_rep, cast to an __u64.
800 * If this member is NULL, then the ioctl should not return a fence.
803 struct drm_vmw_present_readback_arg {
810 /*************************************************************************/
812 * DRM_VMW_UPDATE_LAYOUT - Update layout
814 * Updates the preferred modes and connection status for connectors. The
815 * command consists of one drm_vmw_update_layout_arg pointing to an array
816 * of num_outputs drm_vmw_rect's.
820 * struct drm_vmw_update_layout_arg
822 * @num_outputs: number of active connectors
823 * @rects: pointer to array of drm_vmw_rect cast to an __u64
825 * Input argument to the DRM_VMW_UPDATE_LAYOUT Ioctl.
827 struct drm_vmw_update_layout_arg {
834 /*************************************************************************/
836 * DRM_VMW_CREATE_SHADER - Create shader
838 * Creates a shader and optionally binds it to a dma buffer containing
839 * the shader byte-code.
843 * enum drm_vmw_shader_type - Shader types
845 enum drm_vmw_shader_type {
846 drm_vmw_shader_type_vs = 0,
847 drm_vmw_shader_type_ps,
852 * struct drm_vmw_shader_create_arg
854 * @shader_type: Shader type of the shader to create.
855 * @size: Size of the byte-code in bytes.
856 * where the shader byte-code starts
857 * @buffer_handle: Buffer handle identifying the buffer containing the
859 * @shader_handle: On successful completion contains a handle that
860 * can be used to subsequently identify the shader.
861 * @offset: Offset in bytes into the buffer given by @buffer_handle,
863 * Input / Output argument to the DRM_VMW_CREATE_SHADER Ioctl.
865 struct drm_vmw_shader_create_arg {
866 enum drm_vmw_shader_type shader_type;
873 /*************************************************************************/
875 * DRM_VMW_UNREF_SHADER - Unreferences a shader
877 * Destroys a user-space reference to a shader, optionally destroying
882 * struct drm_vmw_shader_arg
884 * @handle: Handle identifying the shader to destroy.
886 * Input argument to the DRM_VMW_UNREF_SHADER ioctl.
888 struct drm_vmw_shader_arg {
893 /*************************************************************************/
895 * DRM_VMW_GB_SURFACE_CREATE - Create a host guest-backed surface.
897 * Allocates a surface handle and queues a create surface command
898 * for the host on the first use of the surface. The surface ID can
899 * be used as the surface ID in commands referencing the surface.
903 * enum drm_vmw_surface_flags
905 * @drm_vmw_surface_flag_shareable: Whether the surface is shareable
906 * @drm_vmw_surface_flag_scanout: Whether the surface is a scanout
908 * @drm_vmw_surface_flag_create_buffer: Create a backup buffer if none is
910 * @drm_vmw_surface_flag_coherent: Back surface with coherent memory.
912 enum drm_vmw_surface_flags {
913 drm_vmw_surface_flag_shareable = (1 << 0),
914 drm_vmw_surface_flag_scanout = (1 << 1),
915 drm_vmw_surface_flag_create_buffer = (1 << 2),
916 drm_vmw_surface_flag_coherent = (1 << 3),
920 * struct drm_vmw_gb_surface_create_req
922 * @svga3d_flags: SVGA3d surface flags for the device.
923 * @format: SVGA3d format.
924 * @mip_level: Number of mip levels for all faces.
925 * @drm_surface_flags Flags as described above.
926 * @multisample_count Future use. Set to 0.
927 * @autogen_filter Future use. Set to 0.
928 * @buffer_handle Buffer handle of backup buffer. SVGA3D_INVALID_ID
930 * @base_size Size of the base mip level for all faces.
931 * @array_size Must be zero for non-DX hardware, and if non-zero
932 * svga3d_flags must have proper bind flags setup.
934 * Input argument to the DRM_VMW_GB_SURFACE_CREATE Ioctl.
935 * Part of output argument for the DRM_VMW_GB_SURFACE_REF Ioctl.
937 struct drm_vmw_gb_surface_create_req {
941 enum drm_vmw_surface_flags drm_surface_flags;
942 __u32 multisample_count;
943 __u32 autogen_filter;
946 struct drm_vmw_size base_size;
950 * struct drm_vmw_gb_surface_create_rep
952 * @handle: Surface handle.
953 * @backup_size: Size of backup buffers for this surface.
954 * @buffer_handle: Handle of backup buffer. SVGA3D_INVALID_ID if none.
955 * @buffer_size: Actual size of the buffer identified by
957 * @buffer_map_handle: Offset into device address space for the buffer
958 * identified by @buffer_handle.
960 * Part of output argument for the DRM_VMW_GB_SURFACE_REF ioctl.
961 * Output argument for the DRM_VMW_GB_SURFACE_CREATE ioctl.
963 struct drm_vmw_gb_surface_create_rep {
968 __u64 buffer_map_handle;
972 * union drm_vmw_gb_surface_create_arg
974 * @req: Input argument as described above.
975 * @rep: Output argument as described above.
977 * Argument to the DRM_VMW_GB_SURFACE_CREATE ioctl.
979 union drm_vmw_gb_surface_create_arg {
980 struct drm_vmw_gb_surface_create_rep rep;
981 struct drm_vmw_gb_surface_create_req req;
984 /*************************************************************************/
986 * DRM_VMW_GB_SURFACE_REF - Reference a host surface.
988 * Puts a reference on a host surface with a given handle, as previously
989 * returned by the DRM_VMW_GB_SURFACE_CREATE ioctl.
990 * A reference will make sure the surface isn't destroyed while we hold
991 * it and will allow the calling client to use the surface handle in
992 * the command stream.
994 * On successful return, the Ioctl returns the surface information given
995 * to and returned from the DRM_VMW_GB_SURFACE_CREATE ioctl.
999 * struct drm_vmw_gb_surface_reference_arg
1001 * @creq: The data used as input when the surface was created, as described
1002 * above at "struct drm_vmw_gb_surface_create_req"
1003 * @crep: Additional data output when the surface was created, as described
1004 * above at "struct drm_vmw_gb_surface_create_rep"
1006 * Output Argument to the DRM_VMW_GB_SURFACE_REF ioctl.
1008 struct drm_vmw_gb_surface_ref_rep {
1009 struct drm_vmw_gb_surface_create_req creq;
1010 struct drm_vmw_gb_surface_create_rep crep;
1014 * union drm_vmw_gb_surface_reference_arg
1016 * @req: Input data as described above at "struct drm_vmw_surface_arg"
1017 * @rep: Output data as described above at "struct drm_vmw_gb_surface_ref_rep"
1019 * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl.
1021 union drm_vmw_gb_surface_reference_arg {
1022 struct drm_vmw_gb_surface_ref_rep rep;
1023 struct drm_vmw_surface_arg req;
1027 /*************************************************************************/
1029 * DRM_VMW_SYNCCPU - Sync a DMA buffer / MOB for CPU access.
1031 * Idles any previously submitted GPU operations on the buffer and
1032 * by default blocks command submissions that reference the buffer.
1033 * If the file descriptor used to grab a blocking CPU sync is closed, the
1034 * cpu sync is released.
1035 * The flags argument indicates how the grab / release operation should be
1040 * enum drm_vmw_synccpu_flags - Synccpu flags:
1042 * @drm_vmw_synccpu_read: Sync for read. If sync is done for read only, it's a
1043 * hint to the kernel to allow command submissions that references the buffer
1045 * @drm_vmw_synccpu_write: Sync for write. Block all command submissions
1046 * referencing this buffer.
1047 * @drm_vmw_synccpu_dontblock: Dont wait for GPU idle, but rather return
1048 * -EBUSY should the buffer be busy.
1049 * @drm_vmw_synccpu_allow_cs: Allow command submission that touches the buffer
1050 * while the buffer is synced for CPU. This is similar to the GEM bo idle
1053 enum drm_vmw_synccpu_flags {
1054 drm_vmw_synccpu_read = (1 << 0),
1055 drm_vmw_synccpu_write = (1 << 1),
1056 drm_vmw_synccpu_dontblock = (1 << 2),
1057 drm_vmw_synccpu_allow_cs = (1 << 3)
1061 * enum drm_vmw_synccpu_op - Synccpu operations:
1063 * @drm_vmw_synccpu_grab: Grab the buffer for CPU operations
1064 * @drm_vmw_synccpu_release: Release a previous grab.
1066 enum drm_vmw_synccpu_op {
1067 drm_vmw_synccpu_grab,
1068 drm_vmw_synccpu_release
1072 * struct drm_vmw_synccpu_arg
1074 * @op: The synccpu operation as described above.
1075 * @handle: Handle identifying the buffer object.
1076 * @flags: Flags as described above.
1078 struct drm_vmw_synccpu_arg {
1079 enum drm_vmw_synccpu_op op;
1080 enum drm_vmw_synccpu_flags flags;
1085 /*************************************************************************/
1087 * DRM_VMW_CREATE_EXTENDED_CONTEXT - Create a host context.
1089 * Allocates a device unique context id, and queues a create context command
1090 * for the host. Does not wait for host completion.
1092 enum drm_vmw_extended_context {
1093 drm_vmw_context_legacy,
1098 * union drm_vmw_extended_context_arg
1100 * @req: Context type.
1101 * @rep: Context identifier.
1103 * Argument to the DRM_VMW_CREATE_EXTENDED_CONTEXT Ioctl.
1105 union drm_vmw_extended_context_arg {
1106 enum drm_vmw_extended_context req;
1107 struct drm_vmw_context_arg rep;
1110 /*************************************************************************/
1112 * DRM_VMW_HANDLE_CLOSE - Close a user-space handle and release its
1113 * underlying resource.
1115 * Note that this ioctl is overlaid on the deprecated DRM_VMW_UNREF_DMABUF
1120 * struct drm_vmw_handle_close_arg
1122 * @handle: Handle to close.
1124 * Argument to the DRM_VMW_HANDLE_CLOSE Ioctl.
1126 struct drm_vmw_handle_close_arg {
1130 #define drm_vmw_unref_dmabuf_arg drm_vmw_handle_close_arg
1132 /*************************************************************************/
1134 * DRM_VMW_GB_SURFACE_CREATE_EXT - Create a host guest-backed surface.
1136 * Allocates a surface handle and queues a create surface command
1137 * for the host on the first use of the surface. The surface ID can
1138 * be used as the surface ID in commands referencing the surface.
1140 * This new command extends DRM_VMW_GB_SURFACE_CREATE by adding version
1141 * parameter and 64 bit svga flag.
1145 * enum drm_vmw_surface_version
1147 * @drm_vmw_surface_gb_v1: Corresponds to current gb surface format with
1148 * svga3d surface flags split into 2, upper half and lower half.
1150 enum drm_vmw_surface_version {
1151 drm_vmw_gb_surface_v1,
1155 * struct drm_vmw_gb_surface_create_ext_req
1157 * @base: Surface create parameters.
1158 * @version: Version of surface create ioctl.
1159 * @svga3d_flags_upper_32_bits: Upper 32 bits of svga3d flags.
1160 * @multisample_pattern: Multisampling pattern when msaa is supported.
1161 * @quality_level: Precision settings for each sample.
1162 * @buffer_byte_stride: Buffer byte stride.
1163 * @must_be_zero: Reserved for future usage.
1165 * Input argument to the DRM_VMW_GB_SURFACE_CREATE_EXT Ioctl.
1166 * Part of output argument for the DRM_VMW_GB_SURFACE_REF_EXT Ioctl.
1168 struct drm_vmw_gb_surface_create_ext_req {
1169 struct drm_vmw_gb_surface_create_req base;
1170 enum drm_vmw_surface_version version;
1171 __u32 svga3d_flags_upper_32_bits;
1172 __u32 multisample_pattern;
1173 __u32 quality_level;
1174 __u32 buffer_byte_stride;
1179 * union drm_vmw_gb_surface_create_ext_arg
1181 * @req: Input argument as described above.
1182 * @rep: Output argument as described above.
1184 * Argument to the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl.
1186 union drm_vmw_gb_surface_create_ext_arg {
1187 struct drm_vmw_gb_surface_create_rep rep;
1188 struct drm_vmw_gb_surface_create_ext_req req;
1191 /*************************************************************************/
1193 * DRM_VMW_GB_SURFACE_REF_EXT - Reference a host surface.
1195 * Puts a reference on a host surface with a given handle, as previously
1196 * returned by the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl.
1197 * A reference will make sure the surface isn't destroyed while we hold
1198 * it and will allow the calling client to use the surface handle in
1199 * the command stream.
1201 * On successful return, the Ioctl returns the surface information given
1202 * to and returned from the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl.
1206 * struct drm_vmw_gb_surface_ref_ext_rep
1208 * @creq: The data used as input when the surface was created, as described
1209 * above at "struct drm_vmw_gb_surface_create_ext_req"
1210 * @crep: Additional data output when the surface was created, as described
1211 * above at "struct drm_vmw_gb_surface_create_rep"
1213 * Output Argument to the DRM_VMW_GB_SURFACE_REF_EXT ioctl.
1215 struct drm_vmw_gb_surface_ref_ext_rep {
1216 struct drm_vmw_gb_surface_create_ext_req creq;
1217 struct drm_vmw_gb_surface_create_rep crep;
1221 * union drm_vmw_gb_surface_reference_ext_arg
1223 * @req: Input data as described above at "struct drm_vmw_surface_arg"
1224 * @rep: Output data as described above at
1225 * "struct drm_vmw_gb_surface_ref_ext_rep"
1227 * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl.
1229 union drm_vmw_gb_surface_reference_ext_arg {
1230 struct drm_vmw_gb_surface_ref_ext_rep rep;
1231 struct drm_vmw_surface_arg req;
1235 * struct drm_vmw_msg_arg
1237 * @send: Pointer to user-space msg string (null terminated).
1238 * @receive: Pointer to user-space receive buffer.
1239 * @send_only: Boolean whether this is only sending or receiving too.
1241 * Argument to the DRM_VMW_MSG ioctl.
1243 struct drm_vmw_msg_arg {
1251 * struct drm_vmw_mksstat_add_arg
1253 * @stat: Pointer to user-space stat-counters array, page-aligned.
1254 * @info: Pointer to user-space counter-infos array, page-aligned.
1255 * @strs: Pointer to user-space stat strings, page-aligned.
1256 * @stat_len: Length in bytes of stat-counters array.
1257 * @info_len: Length in bytes of counter-infos array.
1258 * @strs_len: Length in bytes of the stat strings, terminators included.
1259 * @description: Pointer to instance descriptor string; will be truncated
1260 * to MKS_GUEST_STAT_INSTANCE_DESC_LENGTH chars.
1261 * @id: Output identifier of the produced record; -1 if error.
1263 * Argument to the DRM_VMW_MKSSTAT_ADD ioctl.
1265 struct drm_vmw_mksstat_add_arg {
1277 * struct drm_vmw_mksstat_remove_arg
1279 * @id: Identifier of the record being disposed, originally obtained through
1280 * DRM_VMW_MKSSTAT_ADD ioctl.
1282 * Argument to the DRM_VMW_MKSSTAT_REMOVE ioctl.
1284 struct drm_vmw_mksstat_remove_arg {
1288 #if defined(__cplusplus)