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__
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_UNREF_DMABUF 2
44 #define DRM_VMW_CURSOR_BYPASS 3
45 /* guarded by DRM_VMW_PARAM_NUM_STREAMS != 0*/
46 #define DRM_VMW_CONTROL_STREAM 4
47 #define DRM_VMW_CLAIM_STREAM 5
48 #define DRM_VMW_UNREF_STREAM 6
49 /* guarded by DRM_VMW_PARAM_3D == 1 */
50 #define DRM_VMW_CREATE_CONTEXT 7
51 #define DRM_VMW_UNREF_CONTEXT 8
52 #define DRM_VMW_CREATE_SURFACE 9
53 #define DRM_VMW_UNREF_SURFACE 10
54 #define DRM_VMW_REF_SURFACE 11
55 #define DRM_VMW_EXECBUF 12
56 #define DRM_VMW_GET_3D_CAP 13
57 #define DRM_VMW_FENCE_WAIT 14
58 #define DRM_VMW_FENCE_SIGNALED 15
59 #define DRM_VMW_FENCE_UNREF 16
60 #define DRM_VMW_FENCE_EVENT 17
61 #define DRM_VMW_PRESENT 18
62 #define DRM_VMW_PRESENT_READBACK 19
63 #define DRM_VMW_UPDATE_LAYOUT 20
64 #define DRM_VMW_CREATE_SHADER 21
65 #define DRM_VMW_UNREF_SHADER 22
66 #define DRM_VMW_GB_SURFACE_CREATE 23
67 #define DRM_VMW_GB_SURFACE_REF 24
68 #define DRM_VMW_SYNCCPU 25
69 #define DRM_VMW_CREATE_EXTENDED_CONTEXT 26
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 #define DRM_VMW_PARAM_NUM_STREAMS 0
84 #define DRM_VMW_PARAM_NUM_FREE_STREAMS 1
85 #define DRM_VMW_PARAM_3D 2
86 #define DRM_VMW_PARAM_HW_CAPS 3
87 #define DRM_VMW_PARAM_FIFO_CAPS 4
88 #define DRM_VMW_PARAM_MAX_FB_SIZE 5
89 #define DRM_VMW_PARAM_FIFO_HW_VERSION 6
90 #define DRM_VMW_PARAM_MAX_SURF_MEMORY 7
91 #define DRM_VMW_PARAM_3D_CAPS_SIZE 8
92 #define DRM_VMW_PARAM_MAX_MOB_MEMORY 9
93 #define DRM_VMW_PARAM_MAX_MOB_SIZE 10
94 #define DRM_VMW_PARAM_SCREEN_TARGET 11
95 #define DRM_VMW_PARAM_DX 12
98 * enum drm_vmw_handle_type - handle type for ref ioctls
101 enum drm_vmw_handle_type {
102 DRM_VMW_HANDLE_LEGACY = 0,
103 DRM_VMW_HANDLE_PRIME = 1
107 * struct drm_vmw_getparam_arg
109 * @value: Returned value. //Out
110 * @param: Parameter to query. //In.
112 * Argument to the DRM_VMW_GET_PARAM Ioctl.
115 struct drm_vmw_getparam_arg {
121 /*************************************************************************/
123 * DRM_VMW_CREATE_CONTEXT - Create a host context.
125 * Allocates a device unique context id, and queues a create context command
126 * for the host. Does not wait for host completion.
130 * struct drm_vmw_context_arg
132 * @cid: Device unique context ID.
134 * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
135 * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
138 struct drm_vmw_context_arg {
143 /*************************************************************************/
145 * DRM_VMW_UNREF_CONTEXT - Create a host context.
147 * Frees a global context id, and queues a destroy host command for the host.
148 * Does not wait for host completion. The context ID can be used directly
149 * in the command stream and shows up as the same context ID on the host.
152 /*************************************************************************/
154 * DRM_VMW_CREATE_SURFACE - Create a host suface.
156 * Allocates a device unique surface id, and queues a create surface command
157 * for the host. Does not wait for host completion. The surface ID can be
158 * used directly in the command stream and shows up as the same surface
163 * struct drm_wmv_surface_create_req
165 * @flags: Surface flags as understood by the host.
166 * @format: Surface format as understood by the host.
167 * @mip_levels: Number of mip levels for each face.
168 * An unused face should have 0 encoded.
169 * @size_addr: Address of a user-space array of sruct drm_vmw_size
170 * cast to an __u64 for 32-64 bit compatibility.
171 * The size of the array should equal the total number of mipmap levels.
172 * @shareable: Boolean whether other clients (as identified by file descriptors)
173 * may reference this surface.
174 * @scanout: Boolean whether the surface is intended to be used as a
177 * Input data to the DRM_VMW_CREATE_SURFACE Ioctl.
178 * Output data from the DRM_VMW_REF_SURFACE Ioctl.
181 struct drm_vmw_surface_create_req {
184 __u32 mip_levels[DRM_VMW_MAX_SURFACE_FACES];
191 * struct drm_wmv_surface_arg
193 * @sid: Surface id of created surface or surface to destroy or reference.
194 * @handle_type: Handle type for DRM_VMW_REF_SURFACE Ioctl.
196 * Output data from the DRM_VMW_CREATE_SURFACE Ioctl.
197 * Input argument to the DRM_VMW_UNREF_SURFACE Ioctl.
198 * Input argument to the DRM_VMW_REF_SURFACE Ioctl.
201 struct drm_vmw_surface_arg {
203 enum drm_vmw_handle_type handle_type;
207 * struct drm_vmw_size ioctl.
209 * @width - mip level width
210 * @height - mip level height
211 * @depth - mip level depth
213 * Description of a mip level.
214 * Input data to the DRM_WMW_CREATE_SURFACE Ioctl.
217 struct drm_vmw_size {
225 * union drm_vmw_surface_create_arg
227 * @rep: Output data as described above.
228 * @req: Input data as described above.
230 * Argument to the DRM_VMW_CREATE_SURFACE Ioctl.
233 union drm_vmw_surface_create_arg {
234 struct drm_vmw_surface_arg rep;
235 struct drm_vmw_surface_create_req req;
238 /*************************************************************************/
240 * DRM_VMW_REF_SURFACE - Reference a host surface.
242 * Puts a reference on a host surface with a give sid, as previously
243 * returned by the DRM_VMW_CREATE_SURFACE ioctl.
244 * A reference will make sure the surface isn't destroyed while we hold
245 * it and will allow the calling client to use the surface ID in the command
248 * On successful return, the Ioctl returns the surface information given
249 * in the DRM_VMW_CREATE_SURFACE ioctl.
253 * union drm_vmw_surface_reference_arg
255 * @rep: Output data as described above.
256 * @req: Input data as described above.
258 * Argument to the DRM_VMW_REF_SURFACE Ioctl.
261 union drm_vmw_surface_reference_arg {
262 struct drm_vmw_surface_create_req rep;
263 struct drm_vmw_surface_arg req;
266 /*************************************************************************/
268 * DRM_VMW_UNREF_SURFACE - Unreference a host surface.
270 * Clear a reference previously put on a host surface.
271 * When all references are gone, including the one implicitly placed
273 * a destroy surface command will be queued for the host.
274 * Does not wait for completion.
277 /*************************************************************************/
281 * Submit a command buffer for execution on the host, and return a
282 * fence seqno that when signaled, indicates that the command buffer has
287 * struct drm_vmw_execbuf_arg
289 * @commands: User-space address of a command buffer cast to an __u64.
290 * @command-size: Size in bytes of the command buffer.
291 * @throttle-us: Sleep until software is less than @throttle_us
292 * microseconds ahead of hardware. The driver may round this value
293 * to the nearest kernel tick.
294 * @fence_rep: User-space address of a struct drm_vmw_fence_rep cast to an
296 * @version: Allows expanding the execbuf ioctl parameters without breaking
297 * backwards compatibility, since user-space will always tell the kernel
298 * which version it uses.
299 * @flags: Execbuf flags. None currently.
301 * Argument to the DRM_VMW_EXECBUF Ioctl.
304 #define DRM_VMW_EXECBUF_VERSION 2
306 struct drm_vmw_execbuf_arg {
313 __u32 context_handle;
318 * struct drm_vmw_fence_rep
320 * @handle: Fence object handle for fence associated with a command submission.
321 * @mask: Fence flags relevant for this fence object.
322 * @seqno: Fence sequence number in fifo. A fence object with a lower
323 * seqno will signal the EXEC flag before a fence object with a higher
324 * seqno. This can be used by user-space to avoid kernel calls to determine
325 * whether a fence has signaled the EXEC flag. Note that @seqno will
327 * @passed_seqno: The highest seqno number processed by the hardware
328 * so far. This can be used to mark user-space fence objects as signaled, and
329 * to determine whether a fence seqno might be stale.
330 * @error: This member should've been set to -EFAULT on submission.
331 * The following actions should be take on completion:
332 * error == -EFAULT: Fence communication failed. The host is synchronized.
333 * Use the last fence id read from the FIFO fence register.
334 * error != 0 && error != -EFAULT:
335 * Fence submission failed. The host is synchronized. Use the fence_seq member.
336 * error == 0: All is OK, The host may not be synchronized.
337 * Use the fence_seq member.
339 * Input / Output data to the DRM_VMW_EXECBUF Ioctl.
342 struct drm_vmw_fence_rep {
351 /*************************************************************************/
353 * DRM_VMW_ALLOC_DMABUF
355 * Allocate a DMA buffer that is visible also to the host.
356 * NOTE: The buffer is
357 * identified by a handle and an offset, which are private to the guest, but
358 * useable in the command stream. The guest kernel may translate these
359 * and patch up the command stream accordingly. In the future, the offset may
360 * be zero at all times, or it may disappear from the interface before it is
363 * The DMA buffer may stay user-space mapped in the guest at all times,
364 * and is thus suitable for sub-allocation.
366 * DMA buffers are mapped using the mmap() syscall on the drm device.
370 * struct drm_vmw_alloc_dmabuf_req
372 * @size: Required minimum size of the buffer.
374 * Input data to the DRM_VMW_ALLOC_DMABUF Ioctl.
377 struct drm_vmw_alloc_dmabuf_req {
383 * struct drm_vmw_dmabuf_rep
385 * @map_handle: Offset to use in the mmap() call used to map the buffer.
386 * @handle: Handle unique to this buffer. Used for unreferencing.
387 * @cur_gmr_id: GMR id to use in the command stream when this buffer is
388 * referenced. See not above.
389 * @cur_gmr_offset: Offset to use in the command stream when this buffer is
390 * referenced. See note above.
392 * Output data from the DRM_VMW_ALLOC_DMABUF Ioctl.
395 struct drm_vmw_dmabuf_rep {
399 __u32 cur_gmr_offset;
404 * union drm_vmw_dmabuf_arg
406 * @req: Input data as described above.
407 * @rep: Output data as described above.
409 * Argument to the DRM_VMW_ALLOC_DMABUF Ioctl.
412 union drm_vmw_alloc_dmabuf_arg {
413 struct drm_vmw_alloc_dmabuf_req req;
414 struct drm_vmw_dmabuf_rep rep;
417 /*************************************************************************/
419 * DRM_VMW_UNREF_DMABUF - Free a DMA buffer.
424 * struct drm_vmw_unref_dmabuf_arg
426 * @handle: Handle indicating what buffer to free. Obtained from the
427 * DRM_VMW_ALLOC_DMABUF Ioctl.
429 * Argument to the DRM_VMW_UNREF_DMABUF Ioctl.
432 struct drm_vmw_unref_dmabuf_arg {
437 /*************************************************************************/
439 * DRM_VMW_CONTROL_STREAM - Control overlays, aka streams.
441 * This IOCTL controls the overlay units of the svga device.
442 * The SVGA overlay units does not work like regular hardware units in
443 * that they do not automaticaly read back the contents of the given dma
444 * buffer. But instead only read back for each call to this ioctl, and
445 * at any point between this call being made and a following call that
446 * either changes the buffer or disables the stream.
450 * struct drm_vmw_rect
452 * Defines a rectangle. Used in the overlay ioctl to define
453 * source and destination rectangle.
456 struct drm_vmw_rect {
464 * struct drm_vmw_control_stream_arg
466 * @stream_id: Stearm to control
467 * @enabled: If false all following arguments are ignored.
468 * @handle: Handle to buffer for getting data from.
469 * @format: Format of the overlay as understood by the host.
470 * @width: Width of the overlay.
471 * @height: Height of the overlay.
472 * @size: Size of the overlay in bytes.
473 * @pitch: Array of pitches, the two last are only used for YUV12 formats.
474 * @offset: Offset from start of dma buffer to overlay.
475 * @src: Source rect, must be within the defined area above.
476 * @dst: Destination rect, x and y may be negative.
478 * Argument to the DRM_VMW_CONTROL_STREAM Ioctl.
481 struct drm_vmw_control_stream_arg {
497 struct drm_vmw_rect src;
498 struct drm_vmw_rect dst;
501 /*************************************************************************/
503 * DRM_VMW_CURSOR_BYPASS - Give extra information about cursor bypass.
507 #define DRM_VMW_CURSOR_BYPASS_ALL (1 << 0)
508 #define DRM_VMW_CURSOR_BYPASS_FLAGS (1)
511 * struct drm_vmw_cursor_bypass_arg
514 * @crtc_id: Crtc id, only used if DMR_CURSOR_BYPASS_ALL isn't passed.
515 * @xpos: X position of cursor.
516 * @ypos: Y position of cursor.
520 * Argument to the DRM_VMW_CURSOR_BYPASS Ioctl.
523 struct drm_vmw_cursor_bypass_arg {
532 /*************************************************************************/
534 * DRM_VMW_CLAIM_STREAM - Claim a single stream.
538 * struct drm_vmw_context_arg
540 * @stream_id: Device unique context ID.
542 * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
543 * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
546 struct drm_vmw_stream_arg {
551 /*************************************************************************/
553 * DRM_VMW_UNREF_STREAM - Unclaim a stream.
555 * Return a single stream that was claimed by this process. Also makes
556 * sure that the stream has been stopped.
559 /*************************************************************************/
563 * Read 3D capabilities from the FIFO
568 * struct drm_vmw_get_3d_cap_arg
570 * @buffer: Pointer to a buffer for capability data, cast to an __u64
571 * @size: Max size to copy
573 * Input argument to the DRM_VMW_GET_3D_CAP_IOCTL
577 struct drm_vmw_get_3d_cap_arg {
583 /*************************************************************************/
587 * Waits for a fence object to signal. The wait is interruptible, so that
588 * signals may be delivered during the interrupt. The wait may timeout,
589 * in which case the calls returns -EBUSY. If the wait is restarted,
590 * that is restarting without resetting @cookie_valid to zero,
591 * the timeout is computed from the first call.
593 * The flags argument to the DRM_VMW_FENCE_WAIT ioctl indicates what to wait
595 * DRM_VMW_FENCE_FLAG_EXEC: All commands ahead of the fence in the command
598 * DRM_VMW_FENCE_FLAG_QUERY: All query results resulting from query finish
600 * in the buffer given to the EXECBUF ioctl returning the fence object handle
601 * are available to user-space.
603 * DRM_VMW_WAIT_OPTION_UNREF: If this wait option is given, and the
604 * fenc wait ioctl returns 0, the fence object has been unreferenced after
608 #define DRM_VMW_FENCE_FLAG_EXEC (1 << 0)
609 #define DRM_VMW_FENCE_FLAG_QUERY (1 << 1)
611 #define DRM_VMW_WAIT_OPTION_UNREF (1 << 0)
614 * struct drm_vmw_fence_wait_arg
616 * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
617 * @cookie_valid: Must be reset to 0 on first call. Left alone on restart.
618 * @kernel_cookie: Set to 0 on first call. Left alone on restart.
619 * @timeout_us: Wait timeout in microseconds. 0 for indefinite timeout.
620 * @lazy: Set to 1 if timing is not critical. Allow more than a kernel tick
622 * @flags: Fence flags to wait on.
623 * @wait_options: Options that control the behaviour of the wait ioctl.
625 * Input argument to the DRM_VMW_FENCE_WAIT ioctl.
628 struct drm_vmw_fence_wait_arg {
639 /*************************************************************************/
641 * DRM_VMW_FENCE_SIGNALED
643 * Checks if a fence object is signaled..
647 * struct drm_vmw_fence_signaled_arg
649 * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
650 * @flags: Fence object flags input to DRM_VMW_FENCE_SIGNALED ioctl
651 * @signaled: Out: Flags signaled.
652 * @sequence: Out: Highest sequence passed so far. Can be used to signal the
653 * EXEC flag of user-space fence objects.
655 * Input/Output argument to the DRM_VMW_FENCE_SIGNALED and DRM_VMW_FENCE_UNREF
659 struct drm_vmw_fence_signaled_arg {
664 __u32 signaled_flags;
668 /*************************************************************************/
670 * DRM_VMW_FENCE_UNREF
672 * Unreferences a fence object, and causes it to be destroyed if there are no
673 * other references to it.
678 * struct drm_vmw_fence_arg
680 * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
682 * Input/Output argument to the DRM_VMW_FENCE_UNREF ioctl..
685 struct drm_vmw_fence_arg {
691 /*************************************************************************/
693 * DRM_VMW_FENCE_EVENT
695 * Queues an event on a fence to be delivered on the drm character device
696 * when the fence has signaled the DRM_VMW_FENCE_FLAG_EXEC flag.
697 * Optionally the approximate time when the fence signaled is
698 * given by the event.
704 #define DRM_VMW_EVENT_FENCE_SIGNALED 0x80000000
706 struct drm_vmw_event_fence {
707 struct drm_event base;
714 * Flags that may be given to the command.
716 /* Request fence signaled time on the event. */
717 #define DRM_VMW_FE_FLAG_REQ_TIME (1 << 0)
720 * struct drm_vmw_fence_event_arg
722 * @fence_rep: Pointer to fence_rep structure cast to __u64 or 0 if
723 * the fence is not supposed to be referenced by user-space.
724 * @user_info: Info to be delivered with the event.
725 * @handle: Attach the event to this fence only.
726 * @flags: A set of flags as defined above.
728 struct drm_vmw_fence_event_arg {
736 /*************************************************************************/
740 * Executes an SVGA present on a given fb for a given surface. The surface
741 * is placed on the framebuffer. Cliprects are given relative to the given
742 * point (the point disignated by dest_{x|y}).
747 * struct drm_vmw_present_arg
748 * @fb_id: framebuffer id to present / read back from.
749 * @sid: Surface id to present from.
750 * @dest_x: X placement coordinate for surface.
751 * @dest_y: Y placement coordinate for surface.
752 * @clips_ptr: Pointer to an array of clip rects cast to an __u64.
753 * @num_clips: Number of cliprects given relative to the framebuffer origin,
754 * in the same coordinate space as the frame buffer.
755 * @pad64: Unused 64-bit padding.
757 * Input argument to the DRM_VMW_PRESENT ioctl.
760 struct drm_vmw_present_arg {
771 /*************************************************************************/
773 * DRM_VMW_PRESENT_READBACK
775 * Executes an SVGA present readback from a given fb to the dma buffer
776 * currently bound as the fb. If there is no dma buffer bound to the fb,
777 * an error will be returned.
782 * struct drm_vmw_present_arg
783 * @fb_id: fb_id to present / read back from.
784 * @num_clips: Number of cliprects.
785 * @clips_ptr: Pointer to an array of clip rects cast to an __u64.
786 * @fence_rep: Pointer to a struct drm_vmw_fence_rep, cast to an __u64.
787 * If this member is NULL, then the ioctl should not return a fence.
790 struct drm_vmw_present_readback_arg {
797 /*************************************************************************/
799 * DRM_VMW_UPDATE_LAYOUT - Update layout
801 * Updates the preferred modes and connection status for connectors. The
802 * command consists of one drm_vmw_update_layout_arg pointing to an array
803 * of num_outputs drm_vmw_rect's.
807 * struct drm_vmw_update_layout_arg
809 * @num_outputs: number of active connectors
810 * @rects: pointer to array of drm_vmw_rect cast to an __u64
812 * Input argument to the DRM_VMW_UPDATE_LAYOUT Ioctl.
814 struct drm_vmw_update_layout_arg {
821 /*************************************************************************/
823 * DRM_VMW_CREATE_SHADER - Create shader
825 * Creates a shader and optionally binds it to a dma buffer containing
826 * the shader byte-code.
830 * enum drm_vmw_shader_type - Shader types
832 enum drm_vmw_shader_type {
833 drm_vmw_shader_type_vs = 0,
834 drm_vmw_shader_type_ps,
839 * struct drm_vmw_shader_create_arg
841 * @shader_type: Shader type of the shader to create.
842 * @size: Size of the byte-code in bytes.
843 * where the shader byte-code starts
844 * @buffer_handle: Buffer handle identifying the buffer containing the
846 * @shader_handle: On successful completion contains a handle that
847 * can be used to subsequently identify the shader.
848 * @offset: Offset in bytes into the buffer given by @buffer_handle,
850 * Input / Output argument to the DRM_VMW_CREATE_SHADER Ioctl.
852 struct drm_vmw_shader_create_arg {
853 enum drm_vmw_shader_type shader_type;
860 /*************************************************************************/
862 * DRM_VMW_UNREF_SHADER - Unreferences a shader
864 * Destroys a user-space reference to a shader, optionally destroying
869 * struct drm_vmw_shader_arg
871 * @handle: Handle identifying the shader to destroy.
873 * Input argument to the DRM_VMW_UNREF_SHADER ioctl.
875 struct drm_vmw_shader_arg {
880 /*************************************************************************/
882 * DRM_VMW_GB_SURFACE_CREATE - Create a host guest-backed surface.
884 * Allocates a surface handle and queues a create surface command
885 * for the host on the first use of the surface. The surface ID can
886 * be used as the surface ID in commands referencing the surface.
890 * enum drm_vmw_surface_flags
892 * @drm_vmw_surface_flag_shareable: Whether the surface is shareable
893 * @drm_vmw_surface_flag_scanout: Whether the surface is a scanout
895 * @drm_vmw_surface_flag_create_buffer: Create a backup buffer if none is
898 enum drm_vmw_surface_flags {
899 drm_vmw_surface_flag_shareable = (1 << 0),
900 drm_vmw_surface_flag_scanout = (1 << 1),
901 drm_vmw_surface_flag_create_buffer = (1 << 2)
905 * struct drm_vmw_gb_surface_create_req
907 * @svga3d_flags: SVGA3d surface flags for the device.
908 * @format: SVGA3d format.
909 * @mip_level: Number of mip levels for all faces.
910 * @drm_surface_flags Flags as described above.
911 * @multisample_count Future use. Set to 0.
912 * @autogen_filter Future use. Set to 0.
913 * @buffer_handle Buffer handle of backup buffer. SVGA3D_INVALID_ID
915 * @base_size Size of the base mip level for all faces.
916 * @array_size Must be zero for non-DX hardware, and if non-zero
917 * svga3d_flags must have proper bind flags setup.
919 * Input argument to the DRM_VMW_GB_SURFACE_CREATE Ioctl.
920 * Part of output argument for the DRM_VMW_GB_SURFACE_REF Ioctl.
922 struct drm_vmw_gb_surface_create_req {
926 enum drm_vmw_surface_flags drm_surface_flags;
927 __u32 multisample_count;
928 __u32 autogen_filter;
931 struct drm_vmw_size base_size;
935 * struct drm_vmw_gb_surface_create_rep
937 * @handle: Surface handle.
938 * @backup_size: Size of backup buffers for this surface.
939 * @buffer_handle: Handle of backup buffer. SVGA3D_INVALID_ID if none.
940 * @buffer_size: Actual size of the buffer identified by
942 * @buffer_map_handle: Offset into device address space for the buffer
943 * identified by @buffer_handle.
945 * Part of output argument for the DRM_VMW_GB_SURFACE_REF ioctl.
946 * Output argument for the DRM_VMW_GB_SURFACE_CREATE ioctl.
948 struct drm_vmw_gb_surface_create_rep {
953 __u64 buffer_map_handle;
957 * union drm_vmw_gb_surface_create_arg
959 * @req: Input argument as described above.
960 * @rep: Output argument as described above.
962 * Argument to the DRM_VMW_GB_SURFACE_CREATE ioctl.
964 union drm_vmw_gb_surface_create_arg {
965 struct drm_vmw_gb_surface_create_rep rep;
966 struct drm_vmw_gb_surface_create_req req;
969 /*************************************************************************/
971 * DRM_VMW_GB_SURFACE_REF - Reference a host surface.
973 * Puts a reference on a host surface with a given handle, as previously
974 * returned by the DRM_VMW_GB_SURFACE_CREATE ioctl.
975 * A reference will make sure the surface isn't destroyed while we hold
976 * it and will allow the calling client to use the surface handle in
977 * the command stream.
979 * On successful return, the Ioctl returns the surface information given
980 * to and returned from the DRM_VMW_GB_SURFACE_CREATE ioctl.
984 * struct drm_vmw_gb_surface_reference_arg
986 * @creq: The data used as input when the surface was created, as described
987 * above at "struct drm_vmw_gb_surface_create_req"
988 * @crep: Additional data output when the surface was created, as described
989 * above at "struct drm_vmw_gb_surface_create_rep"
991 * Output Argument to the DRM_VMW_GB_SURFACE_REF ioctl.
993 struct drm_vmw_gb_surface_ref_rep {
994 struct drm_vmw_gb_surface_create_req creq;
995 struct drm_vmw_gb_surface_create_rep crep;
999 * union drm_vmw_gb_surface_reference_arg
1001 * @req: Input data as described above at "struct drm_vmw_surface_arg"
1002 * @rep: Output data as described above at "struct drm_vmw_gb_surface_ref_rep"
1004 * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl.
1006 union drm_vmw_gb_surface_reference_arg {
1007 struct drm_vmw_gb_surface_ref_rep rep;
1008 struct drm_vmw_surface_arg req;
1012 /*************************************************************************/
1014 * DRM_VMW_SYNCCPU - Sync a DMA buffer / MOB for CPU access.
1016 * Idles any previously submitted GPU operations on the buffer and
1017 * by default blocks command submissions that reference the buffer.
1018 * If the file descriptor used to grab a blocking CPU sync is closed, the
1019 * cpu sync is released.
1020 * The flags argument indicates how the grab / release operation should be
1025 * enum drm_vmw_synccpu_flags - Synccpu flags:
1027 * @drm_vmw_synccpu_read: Sync for read. If sync is done for read only, it's a
1028 * hint to the kernel to allow command submissions that references the buffer
1030 * @drm_vmw_synccpu_write: Sync for write. Block all command submissions
1031 * referencing this buffer.
1032 * @drm_vmw_synccpu_dontblock: Dont wait for GPU idle, but rather return
1033 * -EBUSY should the buffer be busy.
1034 * @drm_vmw_synccpu_allow_cs: Allow command submission that touches the buffer
1035 * while the buffer is synced for CPU. This is similar to the GEM bo idle
1038 enum drm_vmw_synccpu_flags {
1039 drm_vmw_synccpu_read = (1 << 0),
1040 drm_vmw_synccpu_write = (1 << 1),
1041 drm_vmw_synccpu_dontblock = (1 << 2),
1042 drm_vmw_synccpu_allow_cs = (1 << 3)
1046 * enum drm_vmw_synccpu_op - Synccpu operations:
1048 * @drm_vmw_synccpu_grab: Grab the buffer for CPU operations
1049 * @drm_vmw_synccpu_release: Release a previous grab.
1051 enum drm_vmw_synccpu_op {
1052 drm_vmw_synccpu_grab,
1053 drm_vmw_synccpu_release
1057 * struct drm_vmw_synccpu_arg
1059 * @op: The synccpu operation as described above.
1060 * @handle: Handle identifying the buffer object.
1061 * @flags: Flags as described above.
1063 struct drm_vmw_synccpu_arg {
1064 enum drm_vmw_synccpu_op op;
1065 enum drm_vmw_synccpu_flags flags;
1070 /*************************************************************************/
1072 * DRM_VMW_CREATE_EXTENDED_CONTEXT - Create a host context.
1074 * Allocates a device unique context id, and queues a create context command
1075 * for the host. Does not wait for host completion.
1077 enum drm_vmw_extended_context {
1078 drm_vmw_context_legacy,
1083 * union drm_vmw_extended_context_arg
1085 * @req: Context type.
1086 * @rep: Context identifier.
1088 * Argument to the DRM_VMW_CREATE_EXTENDED_CONTEXT Ioctl.
1090 union drm_vmw_extended_context_arg {
1091 enum drm_vmw_extended_context req;
1092 struct drm_vmw_context_arg rep;
1095 #if defined(__cplusplus)