1 /**************************************************************************
3 * Copyright © 2009-2015 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__
35 #define DRM_VMW_MAX_SURFACE_FACES 6
36 #define DRM_VMW_MAX_MIP_LEVELS 24
39 #define DRM_VMW_GET_PARAM 0
40 #define DRM_VMW_ALLOC_DMABUF 1
41 #define DRM_VMW_UNREF_DMABUF 2
42 #define DRM_VMW_CURSOR_BYPASS 3
43 /* guarded by DRM_VMW_PARAM_NUM_STREAMS != 0*/
44 #define DRM_VMW_CONTROL_STREAM 4
45 #define DRM_VMW_CLAIM_STREAM 5
46 #define DRM_VMW_UNREF_STREAM 6
47 /* guarded by DRM_VMW_PARAM_3D == 1 */
48 #define DRM_VMW_CREATE_CONTEXT 7
49 #define DRM_VMW_UNREF_CONTEXT 8
50 #define DRM_VMW_CREATE_SURFACE 9
51 #define DRM_VMW_UNREF_SURFACE 10
52 #define DRM_VMW_REF_SURFACE 11
53 #define DRM_VMW_EXECBUF 12
54 #define DRM_VMW_GET_3D_CAP 13
55 #define DRM_VMW_FENCE_WAIT 14
56 #define DRM_VMW_FENCE_SIGNALED 15
57 #define DRM_VMW_FENCE_UNREF 16
58 #define DRM_VMW_FENCE_EVENT 17
59 #define DRM_VMW_PRESENT 18
60 #define DRM_VMW_PRESENT_READBACK 19
61 #define DRM_VMW_UPDATE_LAYOUT 20
62 #define DRM_VMW_CREATE_SHADER 21
63 #define DRM_VMW_UNREF_SHADER 22
64 #define DRM_VMW_GB_SURFACE_CREATE 23
65 #define DRM_VMW_GB_SURFACE_REF 24
66 #define DRM_VMW_SYNCCPU 25
67 #define DRM_VMW_CREATE_EXTENDED_CONTEXT 26
68 #define DRM_VMW_GB_SURFACE_CREATE_EXT 27
69 #define DRM_VMW_GB_SURFACE_REF_EXT 28
71 /*************************************************************************/
73 * DRM_VMW_GET_PARAM - get device information.
75 * DRM_VMW_PARAM_FIFO_OFFSET:
76 * Offset to use to map the first page of the FIFO read-only.
77 * The fifo is mapped using the mmap() system call on the drm device.
79 * DRM_VMW_PARAM_OVERLAY_IOCTL:
80 * Does the driver support the overlay ioctl.
83 * SM4_1 support is enabled.
86 #define DRM_VMW_PARAM_NUM_STREAMS 0
87 #define DRM_VMW_PARAM_NUM_FREE_STREAMS 1
88 #define DRM_VMW_PARAM_3D 2
89 #define DRM_VMW_PARAM_HW_CAPS 3
90 #define DRM_VMW_PARAM_FIFO_CAPS 4
91 #define DRM_VMW_PARAM_MAX_FB_SIZE 5
92 #define DRM_VMW_PARAM_FIFO_HW_VERSION 6
93 #define DRM_VMW_PARAM_MAX_SURF_MEMORY 7
94 #define DRM_VMW_PARAM_3D_CAPS_SIZE 8
95 #define DRM_VMW_PARAM_MAX_MOB_MEMORY 9
96 #define DRM_VMW_PARAM_MAX_MOB_SIZE 10
97 #define DRM_VMW_PARAM_SCREEN_TARGET 11
98 #define DRM_VMW_PARAM_VGPU10 12
99 #define DRM_VMW_PARAM_HW_CAPS2 13
100 #define DRM_VMW_PARAM_SM4_1 14
103 * enum drm_vmw_handle_type - handle type for ref ioctls
106 enum drm_vmw_handle_type
{
107 DRM_VMW_HANDLE_LEGACY
= 0,
108 DRM_VMW_HANDLE_PRIME
= 1
112 * struct drm_vmw_getparam_arg
114 * @value: Returned value. //Out
115 * @param: Parameter to query. //In.
117 * Argument to the DRM_VMW_GET_PARAM Ioctl.
120 struct drm_vmw_getparam_arg
{
126 /*************************************************************************/
128 * DRM_VMW_CREATE_CONTEXT - Create a host context.
130 * Allocates a device unique context id, and queues a create context command
131 * for the host. Does not wait for host completion.
135 * struct drm_vmw_context_arg
137 * @cid: Device unique context ID.
139 * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
140 * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
143 struct drm_vmw_context_arg
{
148 /*************************************************************************/
150 * DRM_VMW_UNREF_CONTEXT - Create a host context.
152 * Frees a global context id, and queues a destroy host command for the host.
153 * Does not wait for host completion. The context ID can be used directly
154 * in the command stream and shows up as the same context ID on the host.
157 /*************************************************************************/
159 * DRM_VMW_CREATE_SURFACE - Create a host suface.
161 * Allocates a device unique surface id, and queues a create surface command
162 * for the host. Does not wait for host completion. The surface ID can be
163 * used directly in the command stream and shows up as the same surface
168 * struct drm_wmv_surface_create_req
170 * @flags: Surface flags as understood by the host.
171 * @format: Surface format as understood by the host.
172 * @mip_levels: Number of mip levels for each face.
173 * An unused face should have 0 encoded.
174 * @size_addr: Address of a user-space array of sruct drm_vmw_size
175 * cast to an uint64_t for 32-64 bit compatibility.
176 * The size of the array should equal the total number of mipmap levels.
177 * @shareable: Boolean whether other clients (as identified by file descriptors)
178 * may reference this surface.
179 * @scanout: Boolean whether the surface is intended to be used as a
182 * Input data to the DRM_VMW_CREATE_SURFACE Ioctl.
183 * Output data from the DRM_VMW_REF_SURFACE Ioctl.
186 struct drm_vmw_surface_create_req
{
189 uint32_t mip_levels
[DRM_VMW_MAX_SURFACE_FACES
];
196 * struct drm_wmv_surface_arg
198 * @sid: Surface id of created surface or surface to destroy or reference.
199 * @handle_type: Handle type for DRM_VMW_REF_SURFACE Ioctl.
201 * Output data from the DRM_VMW_CREATE_SURFACE Ioctl.
202 * Input argument to the DRM_VMW_UNREF_SURFACE Ioctl.
203 * Input argument to the DRM_VMW_REF_SURFACE Ioctl.
206 struct drm_vmw_surface_arg
{
208 enum drm_vmw_handle_type handle_type
;
212 * struct drm_vmw_size ioctl.
214 * @width - mip level width
215 * @height - mip level height
216 * @depth - mip level depth
218 * Description of a mip level.
219 * Input data to the DRM_WMW_CREATE_SURFACE Ioctl.
222 struct drm_vmw_size
{
230 * union drm_vmw_surface_create_arg
232 * @rep: Output data as described above.
233 * @req: Input data as described above.
235 * Argument to the DRM_VMW_CREATE_SURFACE Ioctl.
238 union drm_vmw_surface_create_arg
{
239 struct drm_vmw_surface_arg rep
;
240 struct drm_vmw_surface_create_req req
;
243 /*************************************************************************/
245 * DRM_VMW_REF_SURFACE - Reference a host surface.
247 * Puts a reference on a host surface with a give sid, as previously
248 * returned by the DRM_VMW_CREATE_SURFACE ioctl.
249 * A reference will make sure the surface isn't destroyed while we hold
250 * it and will allow the calling client to use the surface ID in the command
253 * On successful return, the Ioctl returns the surface information given
254 * in the DRM_VMW_CREATE_SURFACE ioctl.
258 * union drm_vmw_surface_reference_arg
260 * @rep: Output data as described above.
261 * @req: Input data as described above.
263 * Argument to the DRM_VMW_REF_SURFACE Ioctl.
266 union drm_vmw_surface_reference_arg
{
267 struct drm_vmw_surface_create_req rep
;
268 struct drm_vmw_surface_arg req
;
271 /*************************************************************************/
273 * DRM_VMW_UNREF_SURFACE - Unreference a host surface.
275 * Clear a reference previously put on a host surface.
276 * When all references are gone, including the one implicitly placed
278 * a destroy surface command will be queued for the host.
279 * Does not wait for completion.
282 /*************************************************************************/
286 * Submit a command buffer for execution on the host, and return a
287 * fence seqno that when signaled, indicates that the command buffer has
292 * struct drm_vmw_execbuf_arg
294 * @commands: User-space address of a command buffer cast to an uint64_t.
295 * @command-size: Size in bytes of the command buffer.
296 * @throttle-us: Sleep until software is less than @throttle_us
297 * microseconds ahead of hardware. The driver may round this value
298 * to the nearest kernel tick.
299 * @fence_rep: User-space address of a struct drm_vmw_fence_rep cast to an
301 * @version: Allows expanding the execbuf ioctl parameters without breaking
302 * backwards compatibility, since user-space will always tell the kernel
303 * which version it uses.
304 * @flags: Execbuf flags.
305 * @imported_fence_fd: FD for a fence imported from another device
307 * Argument to the DRM_VMW_EXECBUF Ioctl.
310 #define DRM_VMW_EXECBUF_VERSION 2
312 #define DRM_VMW_EXECBUF_FLAG_IMPORT_FENCE_FD (1 << 0)
313 #define DRM_VMW_EXECBUF_FLAG_EXPORT_FENCE_FD (1 << 1)
315 struct drm_vmw_execbuf_arg
{
317 uint32_t command_size
;
318 uint32_t throttle_us
;
322 uint32_t context_handle
;
323 int32_t imported_fence_fd
;
327 * struct drm_vmw_fence_rep
329 * @handle: Fence object handle for fence associated with a command submission.
330 * @mask: Fence flags relevant for this fence object.
331 * @seqno: Fence sequence number in fifo. A fence object with a lower
332 * seqno will signal the EXEC flag before a fence object with a higher
333 * seqno. This can be used by user-space to avoid kernel calls to determine
334 * whether a fence has signaled the EXEC flag. Note that @seqno will
336 * @passed_seqno: The highest seqno number processed by the hardware
337 * so far. This can be used to mark user-space fence objects as signaled, and
338 * to determine whether a fence seqno might be stale.
339 * @fd: FD associated with the fence, -1 if not exported
340 * @error: This member should've been set to -EFAULT on submission.
341 * The following actions should be take on completion:
342 * error == -EFAULT: Fence communication failed. The host is synchronized.
343 * Use the last fence id read from the FIFO fence register.
344 * error != 0 && error != -EFAULT:
345 * Fence submission failed. The host is synchronized. Use the fence_seq member.
346 * error == 0: All is OK, The host may not be synchronized.
347 * Use the fence_seq member.
349 * Input / Output data to the DRM_VMW_EXECBUF Ioctl.
352 struct drm_vmw_fence_rep
{
356 uint32_t passed_seqno
;
361 /*************************************************************************/
363 * DRM_VMW_ALLOC_DMABUF
365 * Allocate a DMA buffer that is visible also to the host.
366 * NOTE: The buffer is
367 * identified by a handle and an offset, which are private to the guest, but
368 * useable in the command stream. The guest kernel may translate these
369 * and patch up the command stream accordingly. In the future, the offset may
370 * be zero at all times, or it may disappear from the interface before it is
373 * The DMA buffer may stay user-space mapped in the guest at all times,
374 * and is thus suitable for sub-allocation.
376 * DMA buffers are mapped using the mmap() syscall on the drm device.
380 * struct drm_vmw_alloc_dmabuf_req
382 * @size: Required minimum size of the buffer.
384 * Input data to the DRM_VMW_ALLOC_DMABUF Ioctl.
387 struct drm_vmw_alloc_dmabuf_req
{
393 * struct drm_vmw_dmabuf_rep
395 * @map_handle: Offset to use in the mmap() call used to map the buffer.
396 * @handle: Handle unique to this buffer. Used for unreferencing.
397 * @cur_gmr_id: GMR id to use in the command stream when this buffer is
398 * referenced. See not above.
399 * @cur_gmr_offset: Offset to use in the command stream when this buffer is
400 * referenced. See note above.
402 * Output data from the DRM_VMW_ALLOC_DMABUF Ioctl.
405 struct drm_vmw_dmabuf_rep
{
409 uint32_t cur_gmr_offset
;
414 * union drm_vmw_dmabuf_arg
416 * @req: Input data as described above.
417 * @rep: Output data as described above.
419 * Argument to the DRM_VMW_ALLOC_DMABUF Ioctl.
422 union drm_vmw_alloc_dmabuf_arg
{
423 struct drm_vmw_alloc_dmabuf_req req
;
424 struct drm_vmw_dmabuf_rep rep
;
427 /*************************************************************************/
429 * DRM_VMW_UNREF_DMABUF - Free a DMA buffer.
434 * struct drm_vmw_unref_dmabuf_arg
436 * @handle: Handle indicating what buffer to free. Obtained from the
437 * DRM_VMW_ALLOC_DMABUF Ioctl.
439 * Argument to the DRM_VMW_UNREF_DMABUF Ioctl.
442 struct drm_vmw_unref_dmabuf_arg
{
447 /*************************************************************************/
449 * DRM_VMW_CONTROL_STREAM - Control overlays, aka streams.
451 * This IOCTL controls the overlay units of the svga device.
452 * The SVGA overlay units does not work like regular hardware units in
453 * that they do not automaticaly read back the contents of the given dma
454 * buffer. But instead only read back for each call to this ioctl, and
455 * at any point between this call being made and a following call that
456 * either changes the buffer or disables the stream.
460 * struct drm_vmw_rect
462 * Defines a rectangle. Used in the overlay ioctl to define
463 * source and destination rectangle.
466 struct drm_vmw_rect
{
474 * struct drm_vmw_control_stream_arg
476 * @stream_id: Stearm to control
477 * @enabled: If false all following arguments are ignored.
478 * @handle: Handle to buffer for getting data from.
479 * @format: Format of the overlay as understood by the host.
480 * @width: Width of the overlay.
481 * @height: Height of the overlay.
482 * @size: Size of the overlay in bytes.
483 * @pitch: Array of pitches, the two last are only used for YUV12 formats.
484 * @offset: Offset from start of dma buffer to overlay.
485 * @src: Source rect, must be within the defined area above.
486 * @dst: Destination rect, x and y may be negative.
488 * Argument to the DRM_VMW_CONTROL_STREAM Ioctl.
491 struct drm_vmw_control_stream_arg
{
507 struct drm_vmw_rect src
;
508 struct drm_vmw_rect dst
;
511 /*************************************************************************/
513 * DRM_VMW_CURSOR_BYPASS - Give extra information about cursor bypass.
517 #define DRM_VMW_CURSOR_BYPASS_ALL (1 << 0)
518 #define DRM_VMW_CURSOR_BYPASS_FLAGS (1)
521 * struct drm_vmw_cursor_bypass_arg
524 * @crtc_id: Crtc id, only used if DMR_CURSOR_BYPASS_ALL isn't passed.
525 * @xpos: X position of cursor.
526 * @ypos: Y position of cursor.
530 * Argument to the DRM_VMW_CURSOR_BYPASS Ioctl.
533 struct drm_vmw_cursor_bypass_arg
{
542 /*************************************************************************/
544 * DRM_VMW_CLAIM_STREAM - Claim a single stream.
548 * struct drm_vmw_context_arg
550 * @stream_id: Device unique context ID.
552 * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
553 * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
556 struct drm_vmw_stream_arg
{
561 /*************************************************************************/
563 * DRM_VMW_UNREF_STREAM - Unclaim a stream.
565 * Return a single stream that was claimed by this process. Also makes
566 * sure that the stream has been stopped.
569 /*************************************************************************/
573 * Read 3D capabilities from the FIFO
578 * struct drm_vmw_get_3d_cap_arg
580 * @buffer: Pointer to a buffer for capability data, cast to an uint64_t
581 * @size: Max size to copy
583 * Input argument to the DRM_VMW_GET_3D_CAP_IOCTL
587 struct drm_vmw_get_3d_cap_arg
{
594 /*************************************************************************/
598 * Waits for a fence object to signal. The wait is interruptible, so that
599 * signals may be delivered during the interrupt. The wait may timeout,
600 * in which case the calls returns -EBUSY. If the wait is restarted,
601 * that is restarting without resetting @cookie_valid to zero,
602 * the timeout is computed from the first call.
604 * The flags argument to the DRM_VMW_FENCE_WAIT ioctl indicates what to wait
606 * DRM_VMW_FENCE_FLAG_EXEC: All commands ahead of the fence in the command
609 * DRM_VMW_FENCE_FLAG_QUERY: All query results resulting from query finish
611 * in the buffer given to the EXECBUF ioctl returning the fence object handle
612 * are available to user-space.
614 * DRM_VMW_WAIT_OPTION_UNREF: If this wait option is given, and the
615 * fenc wait ioctl returns 0, the fence object has been unreferenced after
619 #define DRM_VMW_FENCE_FLAG_EXEC (1 << 0)
620 #define DRM_VMW_FENCE_FLAG_QUERY (1 << 1)
622 #define DRM_VMW_WAIT_OPTION_UNREF (1 << 0)
625 * struct drm_vmw_fence_wait_arg
627 * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
628 * @cookie_valid: Must be reset to 0 on first call. Left alone on restart.
629 * @kernel_cookie: Set to 0 on first call. Left alone on restart.
630 * @timeout_us: Wait timeout in microseconds. 0 for indefinite timeout.
631 * @lazy: Set to 1 if timing is not critical. Allow more than a kernel tick
633 * @flags: Fence flags to wait on.
634 * @wait_options: Options that control the behaviour of the wait ioctl.
636 * Input argument to the DRM_VMW_FENCE_WAIT ioctl.
639 struct drm_vmw_fence_wait_arg
{
641 int32_t cookie_valid
;
642 uint64_t kernel_cookie
;
646 int32_t wait_options
;
650 /*************************************************************************/
652 * DRM_VMW_FENCE_SIGNALED
654 * Checks if a fence object is signaled..
658 * struct drm_vmw_fence_signaled_arg
660 * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
661 * @flags: Fence object flags input to DRM_VMW_FENCE_SIGNALED ioctl
662 * @signaled: Out: Flags signaled.
663 * @sequence: Out: Highest sequence passed so far. Can be used to signal the
664 * EXEC flag of user-space fence objects.
666 * Input/Output argument to the DRM_VMW_FENCE_SIGNALED and DRM_VMW_FENCE_UNREF
670 struct drm_vmw_fence_signaled_arg
{
674 uint32_t passed_seqno
;
675 uint32_t signaled_flags
;
679 /*************************************************************************/
681 * DRM_VMW_FENCE_UNREF
683 * Unreferences a fence object, and causes it to be destroyed if there are no
684 * other references to it.
689 * struct drm_vmw_fence_arg
691 * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
693 * Input/Output argument to the DRM_VMW_FENCE_UNREF ioctl..
696 struct drm_vmw_fence_arg
{
702 /*************************************************************************/
704 * DRM_VMW_FENCE_EVENT
706 * Queues an event on a fence to be delivered on the drm character device
707 * when the fence has signaled the DRM_VMW_FENCE_FLAG_EXEC flag.
708 * Optionally the approximate time when the fence signaled is
709 * given by the event.
715 #define DRM_VMW_EVENT_FENCE_SIGNALED 0x80000000
717 struct drm_vmw_event_fence
{
718 struct drm_event base
;
725 * Flags that may be given to the command.
727 /* Request fence signaled time on the event. */
728 #define DRM_VMW_FE_FLAG_REQ_TIME (1 << 0)
731 * struct drm_vmw_fence_event_arg
733 * @fence_rep: Pointer to fence_rep structure cast to uint64_t or 0 if
734 * the fence is not supposed to be referenced by user-space.
735 * @user_info: Info to be delivered with the event.
736 * @handle: Attach the event to this fence only.
737 * @flags: A set of flags as defined above.
739 struct drm_vmw_fence_event_arg
{
747 /*************************************************************************/
751 * Executes an SVGA present on a given fb for a given surface. The surface
752 * is placed on the framebuffer. Cliprects are given relative to the given
753 * point (the point disignated by dest_{x|y}).
758 * struct drm_vmw_present_arg
759 * @fb_id: framebuffer id to present / read back from.
760 * @sid: Surface id to present from.
761 * @dest_x: X placement coordinate for surface.
762 * @dest_y: Y placement coordinate for surface.
763 * @clips_ptr: Pointer to an array of clip rects cast to an uint64_t.
764 * @num_clips: Number of cliprects given relative to the framebuffer origin,
765 * in the same coordinate space as the frame buffer.
766 * @pad64: Unused 64-bit padding.
768 * Input argument to the DRM_VMW_PRESENT ioctl.
771 struct drm_vmw_present_arg
{
782 /*************************************************************************/
784 * DRM_VMW_PRESENT_READBACK
786 * Executes an SVGA present readback from a given fb to the dma buffer
787 * currently bound as the fb. If there is no dma buffer bound to the fb,
788 * an error will be returned.
793 * struct drm_vmw_present_arg
794 * @fb_id: fb_id to present / read back from.
795 * @num_clips: Number of cliprects.
796 * @clips_ptr: Pointer to an array of clip rects cast to an uint64_t.
797 * @fence_rep: Pointer to a struct drm_vmw_fence_rep, cast to an uint64_t.
798 * If this member is NULL, then the ioctl should not return a fence.
801 struct drm_vmw_present_readback_arg
{
808 /*************************************************************************/
810 * DRM_VMW_UPDATE_LAYOUT - Update layout
812 * Updates the preferred modes and connection status for connectors. The
813 * command consists of one drm_vmw_update_layout_arg pointing to an array
814 * of num_outputs drm_vmw_rect's.
818 * struct drm_vmw_update_layout_arg
820 * @num_outputs: number of active connectors
821 * @rects: pointer to array of drm_vmw_rect cast to an uint64_t
823 * Input argument to the DRM_VMW_UPDATE_LAYOUT Ioctl.
825 struct drm_vmw_update_layout_arg
{
826 uint32_t num_outputs
;
832 /*************************************************************************/
834 * DRM_VMW_CREATE_SHADER - Create shader
836 * Creates a shader and optionally binds it to a dma buffer containing
837 * the shader byte-code.
841 * enum drm_vmw_shader_type - Shader types
843 enum drm_vmw_shader_type
{
844 drm_vmw_shader_type_vs
= 0,
845 drm_vmw_shader_type_ps
,
850 * struct drm_vmw_shader_create_arg
852 * @shader_type: Shader type of the shader to create.
853 * @size: Size of the byte-code in bytes.
854 * where the shader byte-code starts
855 * @buffer_handle: Buffer handle identifying the buffer containing the
857 * @shader_handle: On successful completion contains a handle that
858 * can be used to subsequently identify the shader.
859 * @offset: Offset in bytes into the buffer given by @buffer_handle,
861 * Input / Output argument to the DRM_VMW_CREATE_SHADER Ioctl.
863 struct drm_vmw_shader_create_arg
{
864 enum drm_vmw_shader_type shader_type
;
866 uint32_t buffer_handle
;
867 uint32_t shader_handle
;
871 /*************************************************************************/
873 * DRM_VMW_UNREF_SHADER - Unreferences a shader
875 * Destroys a user-space reference to a shader, optionally destroying
880 * struct drm_vmw_shader_arg
882 * @handle: Handle identifying the shader to destroy.
884 * Input argument to the DRM_VMW_UNREF_SHADER ioctl.
886 struct drm_vmw_shader_arg
{
891 /*************************************************************************/
893 * DRM_VMW_GB_SURFACE_CREATE - Create a host guest-backed surface.
895 * Allocates a surface handle and queues a create surface command
896 * for the host on the first use of the surface. The surface ID can
897 * be used as the surface ID in commands referencing the surface.
901 * enum drm_vmw_surface_flags
903 * @drm_vmw_surface_flag_shareable: Whether the surface is shareable
904 * @drm_vmw_surface_flag_scanout: Whether the surface is a scanout
906 * @drm_vmw_surface_flag_create_buffer: Create a backup buffer if none is
909 enum drm_vmw_surface_flags
{
910 drm_vmw_surface_flag_shareable
= (1 << 0),
911 drm_vmw_surface_flag_scanout
= (1 << 1),
912 drm_vmw_surface_flag_create_buffer
= (1 << 2)
916 * struct drm_vmw_gb_surface_create_req
918 * @svga3d_flags: SVGA3d surface flags for the device.
919 * @format: SVGA3d format.
920 * @mip_level: Number of mip levels for all faces.
921 * @drm_surface_flags Flags as described above.
922 * @multisample_count Future use. Set to 0.
923 * @autogen_filter Future use. Set to 0.
924 * @buffer_handle Buffer handle of backup buffer. SVGA3D_INVALID_ID
926 * @base_size Size of the base mip level for all faces.
927 * @array_size Must be zero for non-vgpu10 hardware, and if non-zero
928 * svga3d_flags must have proper bind flags setup.
930 * Input argument to the DRM_VMW_GB_SURFACE_CREATE Ioctl.
931 * Part of output argument for the DRM_VMW_GB_SURFACE_REF Ioctl.
933 struct drm_vmw_gb_surface_create_req
{
934 uint32_t svga3d_flags
;
937 enum drm_vmw_surface_flags drm_surface_flags
;
938 uint32_t multisample_count
;
939 uint32_t autogen_filter
;
940 uint32_t buffer_handle
;
942 struct drm_vmw_size base_size
;
946 * struct drm_vmw_gb_surface_create_rep
948 * @handle: Surface handle.
949 * @backup_size: Size of backup buffers for this surface.
950 * @buffer_handle: Handle of backup buffer. SVGA3D_INVALID_ID if none.
951 * @buffer_size: Actual size of the buffer identified by
953 * @buffer_map_handle: Offset into device address space for the buffer
954 * identified by @buffer_handle.
956 * Part of output argument for the DRM_VMW_GB_SURFACE_REF ioctl.
957 * Output argument for the DRM_VMW_GB_SURFACE_CREATE ioctl.
959 struct drm_vmw_gb_surface_create_rep
{
961 uint32_t backup_size
;
962 uint32_t buffer_handle
;
963 uint32_t buffer_size
;
964 uint64_t buffer_map_handle
;
968 * union drm_vmw_gb_surface_create_arg
970 * @req: Input argument as described above.
971 * @rep: Output argument as described above.
973 * Argument to the DRM_VMW_GB_SURFACE_CREATE ioctl.
975 union drm_vmw_gb_surface_create_arg
{
976 struct drm_vmw_gb_surface_create_rep rep
;
977 struct drm_vmw_gb_surface_create_req req
;
980 /*************************************************************************/
982 * DRM_VMW_GB_SURFACE_REF - Reference a host surface.
984 * Puts a reference on a host surface with a given handle, as previously
985 * returned by the DRM_VMW_GB_SURFACE_CREATE ioctl.
986 * A reference will make sure the surface isn't destroyed while we hold
987 * it and will allow the calling client to use the surface handle in
988 * the command stream.
990 * On successful return, the Ioctl returns the surface information given
991 * to and returned from the DRM_VMW_GB_SURFACE_CREATE ioctl.
995 * struct drm_vmw_gb_surface_reference_arg
997 * @creq: The data used as input when the surface was created, as described
998 * above at "struct drm_vmw_gb_surface_create_req"
999 * @crep: Additional data output when the surface was created, as described
1000 * above at "struct drm_vmw_gb_surface_create_rep"
1002 * Output Argument to the DRM_VMW_GB_SURFACE_REF ioctl.
1004 struct drm_vmw_gb_surface_ref_rep
{
1005 struct drm_vmw_gb_surface_create_req creq
;
1006 struct drm_vmw_gb_surface_create_rep crep
;
1010 * union drm_vmw_gb_surface_reference_arg
1012 * @req: Input data as described above at "struct drm_vmw_surface_arg"
1013 * @rep: Output data as described above at "struct drm_vmw_gb_surface_ref_rep"
1015 * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl.
1017 union drm_vmw_gb_surface_reference_arg
{
1018 struct drm_vmw_gb_surface_ref_rep rep
;
1019 struct drm_vmw_surface_arg req
;
1023 /*************************************************************************/
1025 * DRM_VMW_SYNCCPU - Sync a DMA buffer / MOB for CPU access.
1027 * Idles any previously submitted GPU operations on the buffer and
1028 * by default blocks command submissions that reference the buffer.
1029 * If the file descriptor used to grab a blocking CPU sync is closed, the
1030 * cpu sync is released.
1031 * The flags argument indicates how the grab / release operation should be
1036 * enum drm_vmw_synccpu_flags - Synccpu flags:
1038 * @drm_vmw_synccpu_read: Sync for read. If sync is done for read only, it's a
1039 * hint to the kernel to allow command submissions that references the buffer
1041 * @drm_vmw_synccpu_write: Sync for write. Block all command submissions
1042 * referencing this buffer.
1043 * @drm_vmw_synccpu_dontblock: Dont wait for GPU idle, but rather return
1044 * -EBUSY should the buffer be busy.
1045 * @drm_vmw_synccpu_allow_cs: Allow command submission that touches the buffer
1046 * while the buffer is synced for CPU. This is similar to the GEM bo idle
1049 enum drm_vmw_synccpu_flags
{
1050 drm_vmw_synccpu_read
= (1 << 0),
1051 drm_vmw_synccpu_write
= (1 << 1),
1052 drm_vmw_synccpu_dontblock
= (1 << 2),
1053 drm_vmw_synccpu_allow_cs
= (1 << 3)
1057 * enum drm_vmw_synccpu_op - Synccpu operations:
1059 * @drm_vmw_synccpu_grab: Grab the buffer for CPU operations
1060 * @drm_vmw_synccpu_release: Release a previous grab.
1062 enum drm_vmw_synccpu_op
{
1063 drm_vmw_synccpu_grab
,
1064 drm_vmw_synccpu_release
1068 * struct drm_vmw_synccpu_arg
1070 * @op: The synccpu operation as described above.
1071 * @handle: Handle identifying the buffer object.
1072 * @flags: Flags as described above.
1074 struct drm_vmw_synccpu_arg
{
1075 enum drm_vmw_synccpu_op op
;
1076 enum drm_vmw_synccpu_flags flags
;
1081 /*************************************************************************/
1083 * DRM_VMW_CREATE_EXTENDED_CONTEXT - Create a host context.
1085 * Allocates a device unique context id, and queues a create context command
1086 * for the host. Does not wait for host completion.
1088 enum drm_vmw_extended_context
{
1089 drm_vmw_context_legacy
,
1090 drm_vmw_context_vgpu10
1094 * union drm_vmw_extended_context_arg
1096 * @req: Context type.
1097 * @rep: Context identifier.
1099 * Argument to the DRM_VMW_CREATE_EXTENDED_CONTEXT Ioctl.
1101 union drm_vmw_extended_context_arg
{
1102 enum drm_vmw_extended_context req
;
1103 struct drm_vmw_context_arg rep
;
1106 /*************************************************************************/
1108 * DRM_VMW_GB_SURFACE_CREATE_EXT - Create a host guest-backed surface.
1110 * Allocates a surface handle and queues a create surface command
1111 * for the host on the first use of the surface. The surface ID can
1112 * be used as the surface ID in commands referencing the surface.
1114 * This new command extends DRM_VMW_GB_SURFACE_CREATE by adding version
1115 * parameter and 64 bit svga flag.
1119 * enum drm_vmw_surface_version
1121 * @drm_vmw_surface_gb_v1: Corresponds to current gb surface format with
1122 * svga3d surface flags split into 2, upper half and lower half.
1124 enum drm_vmw_surface_version
{
1125 drm_vmw_gb_surface_v1
1129 * struct drm_vmw_gb_surface_create_ext_req
1131 * @base: Surface create parameters.
1132 * @version: Version of surface create ioctl.
1133 * @svga3d_flags_upper_32_bits: Upper 32 bits of svga3d flags.
1134 * @multisample_pattern: Multisampling pattern when msaa is supported.
1135 * @quality_level: Precision settings for each sample.
1136 * @must_be_zero: Reserved for future usage.
1138 * Input argument to the DRM_VMW_GB_SURFACE_CREATE_EXT Ioctl.
1139 * Part of output argument for the DRM_VMW_GB_SURFACE_REF_EXT Ioctl.
1141 struct drm_vmw_gb_surface_create_ext_req
{
1142 struct drm_vmw_gb_surface_create_req base
;
1143 enum drm_vmw_surface_version version
;
1144 uint32_t svga3d_flags_upper_32_bits
;
1145 SVGA3dMSPattern multisample_pattern
;
1146 SVGA3dMSQualityLevel quality_level
;
1147 uint64_t must_be_zero
;
1151 * union drm_vmw_gb_surface_create_ext_arg
1153 * @req: Input argument as described above.
1154 * @rep: Output argument as described above.
1156 * Argument to the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl.
1158 union drm_vmw_gb_surface_create_ext_arg
{
1159 struct drm_vmw_gb_surface_create_rep rep
;
1160 struct drm_vmw_gb_surface_create_ext_req req
;
1163 /*************************************************************************/
1165 * DRM_VMW_GB_SURFACE_REF_EXT - Reference a host surface.
1167 * Puts a reference on a host surface with a given handle, as previously
1168 * returned by the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl.
1169 * A reference will make sure the surface isn't destroyed while we hold
1170 * it and will allow the calling client to use the surface handle in
1171 * the command stream.
1173 * On successful return, the Ioctl returns the surface information given
1174 * to and returned from the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl.
1178 * struct drm_vmw_gb_surface_ref_ext_rep
1180 * @creq: The data used as input when the surface was created, as described
1181 * above at "struct drm_vmw_gb_surface_create_ext_req"
1182 * @crep: Additional data output when the surface was created, as described
1183 * above at "struct drm_vmw_gb_surface_create_rep"
1185 * Output Argument to the DRM_VMW_GB_SURFACE_REF_EXT ioctl.
1187 struct drm_vmw_gb_surface_ref_ext_rep
{
1188 struct drm_vmw_gb_surface_create_ext_req creq
;
1189 struct drm_vmw_gb_surface_create_rep crep
;
1193 * union drm_vmw_gb_surface_reference_ext_arg
1195 * @req: Input data as described above at "struct drm_vmw_surface_arg"
1196 * @rep: Output data as described above at
1197 * "struct drm_vmw_gb_surface_ref_ext_rep"
1199 * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl.
1201 union drm_vmw_gb_surface_reference_ext_arg
{
1202 struct drm_vmw_gb_surface_ref_ext_rep rep
;
1203 struct drm_vmw_surface_arg req
;