blob: bb3b91d84914837315fc3785a79c0a9cdbf55739 [file] [log] [blame]
Jakob Bornecrantzfb1d9732009-12-10 00:19:58 +00001/**************************************************************************
2 *
3 * Copyright © 2009 VMware, Inc., Palo Alto, CA., USA
4 * All Rights Reserved.
5 *
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:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
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.
25 *
26 **************************************************************************/
27
28#ifndef __VMWGFX_DRM_H__
29#define __VMWGFX_DRM_H__
30
31#define DRM_VMW_MAX_SURFACE_FACES 6
32#define DRM_VMW_MAX_MIP_LEVELS 24
33
Jakob Bornecrantzfb1d9732009-12-10 00:19:58 +000034
35#define DRM_VMW_GET_PARAM 0
36#define DRM_VMW_ALLOC_DMABUF 1
37#define DRM_VMW_UNREF_DMABUF 2
38#define DRM_VMW_CURSOR_BYPASS 3
39/* guarded by DRM_VMW_PARAM_NUM_STREAMS != 0*/
40#define DRM_VMW_CONTROL_STREAM 4
41#define DRM_VMW_CLAIM_STREAM 5
42#define DRM_VMW_UNREF_STREAM 6
43/* guarded by DRM_VMW_PARAM_3D == 1 */
44#define DRM_VMW_CREATE_CONTEXT 7
45#define DRM_VMW_UNREF_CONTEXT 8
46#define DRM_VMW_CREATE_SURFACE 9
47#define DRM_VMW_UNREF_SURFACE 10
48#define DRM_VMW_REF_SURFACE 11
49#define DRM_VMW_EXECBUF 12
Thomas Hellstromae2a1042011-09-01 20:18:44 +000050#define DRM_VMW_GET_3D_CAP 13
51#define DRM_VMW_FENCE_WAIT 14
52#define DRM_VMW_FENCE_SIGNALED 15
53#define DRM_VMW_FENCE_UNREF 16
54#define DRM_VMW_FENCE_EVENT 17
Jakob Bornecrantz2fcd5a72011-10-04 20:13:26 +020055#define DRM_VMW_PRESENT 18
56#define DRM_VMW_PRESENT_READBACK 19
Thomas Hellstromcd2b89e2011-10-25 23:35:53 +020057#define DRM_VMW_UPDATE_LAYOUT 20
Thomas Hellstromcfe4d532012-11-21 10:23:14 +010058#define DRM_VMW_CREATE_SHADER 21
59#define DRM_VMW_UNREF_SHADER 22
60#define DRM_VMW_GB_SURFACE_CREATE 23
61#define DRM_VMW_GB_SURFACE_REF 24
62
Jakob Bornecrantzfb1d9732009-12-10 00:19:58 +000063
64/*************************************************************************/
65/**
66 * DRM_VMW_GET_PARAM - get device information.
67 *
68 * DRM_VMW_PARAM_FIFO_OFFSET:
69 * Offset to use to map the first page of the FIFO read-only.
70 * The fifo is mapped using the mmap() system call on the drm device.
71 *
72 * DRM_VMW_PARAM_OVERLAY_IOCTL:
73 * Does the driver support the overlay ioctl.
74 */
75
76#define DRM_VMW_PARAM_NUM_STREAMS 0
77#define DRM_VMW_PARAM_NUM_FREE_STREAMS 1
78#define DRM_VMW_PARAM_3D 2
Thomas Hellstrom07999a72011-09-01 20:18:40 +000079#define DRM_VMW_PARAM_HW_CAPS 3
80#define DRM_VMW_PARAM_FIFO_CAPS 4
81#define DRM_VMW_PARAM_MAX_FB_SIZE 5
Thomas Hellstromf63f6a52011-09-01 20:18:41 +000082#define DRM_VMW_PARAM_FIFO_HW_VERSION 6
Thomas Hellstromcfe4d532012-11-21 10:23:14 +010083#define DRM_VMW_PARAM_MAX_SURF_MEMORY 7
84#define DRM_VMW_PARAM_3D_CAPS_SIZE 8
Jakob Bornecrantzfb1d9732009-12-10 00:19:58 +000085
86/**
87 * struct drm_vmw_getparam_arg
88 *
89 * @value: Returned value. //Out
90 * @param: Parameter to query. //In.
91 *
92 * Argument to the DRM_VMW_GET_PARAM Ioctl.
93 */
94
95struct drm_vmw_getparam_arg {
96 uint64_t value;
97 uint32_t param;
98 uint32_t pad64;
99};
100
101/*************************************************************************/
102/**
Jakob Bornecrantzfb1d9732009-12-10 00:19:58 +0000103 * DRM_VMW_CREATE_CONTEXT - Create a host context.
104 *
105 * Allocates a device unique context id, and queues a create context command
106 * for the host. Does not wait for host completion.
107 */
108
109/**
110 * struct drm_vmw_context_arg
111 *
112 * @cid: Device unique context ID.
113 *
114 * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
115 * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
116 */
117
118struct drm_vmw_context_arg {
119 int32_t cid;
120 uint32_t pad64;
121};
122
123/*************************************************************************/
124/**
125 * DRM_VMW_UNREF_CONTEXT - Create a host context.
126 *
127 * Frees a global context id, and queues a destroy host command for the host.
128 * Does not wait for host completion. The context ID can be used directly
129 * in the command stream and shows up as the same context ID on the host.
130 */
131
132/*************************************************************************/
133/**
134 * DRM_VMW_CREATE_SURFACE - Create a host suface.
135 *
136 * Allocates a device unique surface id, and queues a create surface command
137 * for the host. Does not wait for host completion. The surface ID can be
138 * used directly in the command stream and shows up as the same surface
139 * ID on the host.
140 */
141
142/**
143 * struct drm_wmv_surface_create_req
144 *
145 * @flags: Surface flags as understood by the host.
146 * @format: Surface format as understood by the host.
147 * @mip_levels: Number of mip levels for each face.
148 * An unused face should have 0 encoded.
149 * @size_addr: Address of a user-space array of sruct drm_vmw_size
150 * cast to an uint64_t for 32-64 bit compatibility.
151 * The size of the array should equal the total number of mipmap levels.
152 * @shareable: Boolean whether other clients (as identified by file descriptors)
153 * may reference this surface.
Thomas Hellstromf77cef32010-02-09 19:41:55 +0000154 * @scanout: Boolean whether the surface is intended to be used as a
155 * scanout.
Jakob Bornecrantzfb1d9732009-12-10 00:19:58 +0000156 *
157 * Input data to the DRM_VMW_CREATE_SURFACE Ioctl.
158 * Output data from the DRM_VMW_REF_SURFACE Ioctl.
159 */
160
161struct drm_vmw_surface_create_req {
162 uint32_t flags;
163 uint32_t format;
164 uint32_t mip_levels[DRM_VMW_MAX_SURFACE_FACES];
165 uint64_t size_addr;
166 int32_t shareable;
Thomas Hellstromf77cef32010-02-09 19:41:55 +0000167 int32_t scanout;
Jakob Bornecrantzfb1d9732009-12-10 00:19:58 +0000168};
169
170/**
171 * struct drm_wmv_surface_arg
172 *
173 * @sid: Surface id of created surface or surface to destroy or reference.
174 *
175 * Output data from the DRM_VMW_CREATE_SURFACE Ioctl.
176 * Input argument to the DRM_VMW_UNREF_SURFACE Ioctl.
177 * Input argument to the DRM_VMW_REF_SURFACE Ioctl.
178 */
179
180struct drm_vmw_surface_arg {
181 int32_t sid;
182 uint32_t pad64;
183};
184
185/**
186 * struct drm_vmw_size ioctl.
187 *
188 * @width - mip level width
189 * @height - mip level height
190 * @depth - mip level depth
191 *
192 * Description of a mip level.
193 * Input data to the DRM_WMW_CREATE_SURFACE Ioctl.
194 */
195
196struct drm_vmw_size {
197 uint32_t width;
198 uint32_t height;
199 uint32_t depth;
200 uint32_t pad64;
201};
202
203/**
204 * union drm_vmw_surface_create_arg
205 *
206 * @rep: Output data as described above.
207 * @req: Input data as described above.
208 *
209 * Argument to the DRM_VMW_CREATE_SURFACE Ioctl.
210 */
211
212union drm_vmw_surface_create_arg {
213 struct drm_vmw_surface_arg rep;
214 struct drm_vmw_surface_create_req req;
215};
216
217/*************************************************************************/
218/**
219 * DRM_VMW_REF_SURFACE - Reference a host surface.
220 *
221 * Puts a reference on a host surface with a give sid, as previously
222 * returned by the DRM_VMW_CREATE_SURFACE ioctl.
223 * A reference will make sure the surface isn't destroyed while we hold
224 * it and will allow the calling client to use the surface ID in the command
225 * stream.
226 *
227 * On successful return, the Ioctl returns the surface information given
228 * in the DRM_VMW_CREATE_SURFACE ioctl.
229 */
230
231/**
232 * union drm_vmw_surface_reference_arg
233 *
234 * @rep: Output data as described above.
235 * @req: Input data as described above.
236 *
237 * Argument to the DRM_VMW_REF_SURFACE Ioctl.
238 */
239
240union drm_vmw_surface_reference_arg {
241 struct drm_vmw_surface_create_req rep;
242 struct drm_vmw_surface_arg req;
243};
244
245/*************************************************************************/
246/**
247 * DRM_VMW_UNREF_SURFACE - Unreference a host surface.
248 *
249 * Clear a reference previously put on a host surface.
250 * When all references are gone, including the one implicitly placed
251 * on creation,
252 * a destroy surface command will be queued for the host.
253 * Does not wait for completion.
254 */
255
256/*************************************************************************/
257/**
258 * DRM_VMW_EXECBUF
259 *
260 * Submit a command buffer for execution on the host, and return a
Thomas Hellstrom6bcd8d3c2011-09-01 20:18:42 +0000261 * fence seqno that when signaled, indicates that the command buffer has
Jakob Bornecrantzfb1d9732009-12-10 00:19:58 +0000262 * executed.
263 */
264
265/**
266 * struct drm_vmw_execbuf_arg
267 *
268 * @commands: User-space address of a command buffer cast to an uint64_t.
269 * @command-size: Size in bytes of the command buffer.
Thomas Hellstromf77cef32010-02-09 19:41:55 +0000270 * @throttle-us: Sleep until software is less than @throttle_us
271 * microseconds ahead of hardware. The driver may round this value
272 * to the nearest kernel tick.
Jakob Bornecrantzfb1d9732009-12-10 00:19:58 +0000273 * @fence_rep: User-space address of a struct drm_vmw_fence_rep cast to an
274 * uint64_t.
Jakob Bornecrantza87897e2010-02-09 21:29:47 +0000275 * @version: Allows expanding the execbuf ioctl parameters without breaking
276 * backwards compatibility, since user-space will always tell the kernel
277 * which version it uses.
278 * @flags: Execbuf flags. None currently.
Jakob Bornecrantzfb1d9732009-12-10 00:19:58 +0000279 *
280 * Argument to the DRM_VMW_EXECBUF Ioctl.
281 */
282
Thomas Hellstrom2ae7b032011-09-01 20:18:45 +0000283#define DRM_VMW_EXECBUF_VERSION 1
Jakob Bornecrantza87897e2010-02-09 21:29:47 +0000284
Jakob Bornecrantzfb1d9732009-12-10 00:19:58 +0000285struct drm_vmw_execbuf_arg {
286 uint64_t commands;
287 uint32_t command_size;
Thomas Hellstromf77cef32010-02-09 19:41:55 +0000288 uint32_t throttle_us;
Jakob Bornecrantzfb1d9732009-12-10 00:19:58 +0000289 uint64_t fence_rep;
Thomas Hellstromae2a1042011-09-01 20:18:44 +0000290 uint32_t version;
291 uint32_t flags;
Jakob Bornecrantzfb1d9732009-12-10 00:19:58 +0000292};
293
294/**
295 * struct drm_vmw_fence_rep
296 *
Thomas Hellstromae2a1042011-09-01 20:18:44 +0000297 * @handle: Fence object handle for fence associated with a command submission.
298 * @mask: Fence flags relevant for this fence object.
299 * @seqno: Fence sequence number in fifo. A fence object with a lower
300 * seqno will signal the EXEC flag before a fence object with a higher
301 * seqno. This can be used by user-space to avoid kernel calls to determine
302 * whether a fence has signaled the EXEC flag. Note that @seqno will
303 * wrap at 32-bit.
304 * @passed_seqno: The highest seqno number processed by the hardware
305 * so far. This can be used to mark user-space fence objects as signaled, and
306 * to determine whether a fence seqno might be stale.
Jakob Bornecrantzfb1d9732009-12-10 00:19:58 +0000307 * @error: This member should've been set to -EFAULT on submission.
308 * The following actions should be take on completion:
309 * error == -EFAULT: Fence communication failed. The host is synchronized.
310 * Use the last fence id read from the FIFO fence register.
311 * error != 0 && error != -EFAULT:
312 * Fence submission failed. The host is synchronized. Use the fence_seq member.
313 * error == 0: All is OK, The host may not be synchronized.
314 * Use the fence_seq member.
315 *
316 * Input / Output data to the DRM_VMW_EXECBUF Ioctl.
317 */
318
319struct drm_vmw_fence_rep {
Thomas Hellstromae2a1042011-09-01 20:18:44 +0000320 uint32_t handle;
321 uint32_t mask;
322 uint32_t seqno;
323 uint32_t passed_seqno;
Jakob Bornecrantzfb1d9732009-12-10 00:19:58 +0000324 uint32_t pad64;
Thomas Hellstromae2a1042011-09-01 20:18:44 +0000325 int32_t error;
Jakob Bornecrantzfb1d9732009-12-10 00:19:58 +0000326};
327
328/*************************************************************************/
329/**
330 * DRM_VMW_ALLOC_DMABUF
331 *
332 * Allocate a DMA buffer that is visible also to the host.
333 * NOTE: The buffer is
334 * identified by a handle and an offset, which are private to the guest, but
335 * useable in the command stream. The guest kernel may translate these
336 * and patch up the command stream accordingly. In the future, the offset may
337 * be zero at all times, or it may disappear from the interface before it is
338 * fixed.
339 *
340 * The DMA buffer may stay user-space mapped in the guest at all times,
341 * and is thus suitable for sub-allocation.
342 *
343 * DMA buffers are mapped using the mmap() syscall on the drm device.
344 */
345
346/**
347 * struct drm_vmw_alloc_dmabuf_req
348 *
349 * @size: Required minimum size of the buffer.
350 *
351 * Input data to the DRM_VMW_ALLOC_DMABUF Ioctl.
352 */
353
354struct drm_vmw_alloc_dmabuf_req {
355 uint32_t size;
356 uint32_t pad64;
357};
358
359/**
360 * struct drm_vmw_dmabuf_rep
361 *
362 * @map_handle: Offset to use in the mmap() call used to map the buffer.
363 * @handle: Handle unique to this buffer. Used for unreferencing.
364 * @cur_gmr_id: GMR id to use in the command stream when this buffer is
365 * referenced. See not above.
366 * @cur_gmr_offset: Offset to use in the command stream when this buffer is
367 * referenced. See note above.
368 *
369 * Output data from the DRM_VMW_ALLOC_DMABUF Ioctl.
370 */
371
372struct drm_vmw_dmabuf_rep {
373 uint64_t map_handle;
374 uint32_t handle;
375 uint32_t cur_gmr_id;
376 uint32_t cur_gmr_offset;
377 uint32_t pad64;
378};
379
380/**
381 * union drm_vmw_dmabuf_arg
382 *
383 * @req: Input data as described above.
384 * @rep: Output data as described above.
385 *
386 * Argument to the DRM_VMW_ALLOC_DMABUF Ioctl.
387 */
388
389union drm_vmw_alloc_dmabuf_arg {
390 struct drm_vmw_alloc_dmabuf_req req;
391 struct drm_vmw_dmabuf_rep rep;
392};
393
394/*************************************************************************/
395/**
396 * DRM_VMW_UNREF_DMABUF - Free a DMA buffer.
397 *
398 */
399
400/**
401 * struct drm_vmw_unref_dmabuf_arg
402 *
403 * @handle: Handle indicating what buffer to free. Obtained from the
404 * DRM_VMW_ALLOC_DMABUF Ioctl.
405 *
406 * Argument to the DRM_VMW_UNREF_DMABUF Ioctl.
407 */
408
409struct drm_vmw_unref_dmabuf_arg {
410 uint32_t handle;
411 uint32_t pad64;
412};
413
Jakob Bornecrantzfb1d9732009-12-10 00:19:58 +0000414/*************************************************************************/
415/**
416 * DRM_VMW_CONTROL_STREAM - Control overlays, aka streams.
417 *
418 * This IOCTL controls the overlay units of the svga device.
419 * The SVGA overlay units does not work like regular hardware units in
420 * that they do not automaticaly read back the contents of the given dma
421 * buffer. But instead only read back for each call to this ioctl, and
422 * at any point between this call being made and a following call that
423 * either changes the buffer or disables the stream.
424 */
425
426/**
427 * struct drm_vmw_rect
428 *
429 * Defines a rectangle. Used in the overlay ioctl to define
430 * source and destination rectangle.
431 */
432
433struct drm_vmw_rect {
434 int32_t x;
435 int32_t y;
436 uint32_t w;
437 uint32_t h;
438};
439
440/**
441 * struct drm_vmw_control_stream_arg
442 *
443 * @stream_id: Stearm to control
444 * @enabled: If false all following arguments are ignored.
445 * @handle: Handle to buffer for getting data from.
446 * @format: Format of the overlay as understood by the host.
447 * @width: Width of the overlay.
448 * @height: Height of the overlay.
449 * @size: Size of the overlay in bytes.
450 * @pitch: Array of pitches, the two last are only used for YUV12 formats.
451 * @offset: Offset from start of dma buffer to overlay.
452 * @src: Source rect, must be within the defined area above.
453 * @dst: Destination rect, x and y may be negative.
454 *
455 * Argument to the DRM_VMW_CONTROL_STREAM Ioctl.
456 */
457
458struct drm_vmw_control_stream_arg {
459 uint32_t stream_id;
460 uint32_t enabled;
461
462 uint32_t flags;
463 uint32_t color_key;
464
465 uint32_t handle;
466 uint32_t offset;
467 int32_t format;
468 uint32_t size;
469 uint32_t width;
470 uint32_t height;
471 uint32_t pitch[3];
472
473 uint32_t pad64;
474 struct drm_vmw_rect src;
475 struct drm_vmw_rect dst;
476};
477
478/*************************************************************************/
479/**
480 * DRM_VMW_CURSOR_BYPASS - Give extra information about cursor bypass.
481 *
482 */
483
484#define DRM_VMW_CURSOR_BYPASS_ALL (1 << 0)
485#define DRM_VMW_CURSOR_BYPASS_FLAGS (1)
486
487/**
488 * struct drm_vmw_cursor_bypass_arg
489 *
490 * @flags: Flags.
491 * @crtc_id: Crtc id, only used if DMR_CURSOR_BYPASS_ALL isn't passed.
492 * @xpos: X position of cursor.
493 * @ypos: Y position of cursor.
494 * @xhot: X hotspot.
495 * @yhot: Y hotspot.
496 *
497 * Argument to the DRM_VMW_CURSOR_BYPASS Ioctl.
498 */
499
500struct drm_vmw_cursor_bypass_arg {
501 uint32_t flags;
502 uint32_t crtc_id;
503 int32_t xpos;
504 int32_t ypos;
505 int32_t xhot;
506 int32_t yhot;
507};
508
509/*************************************************************************/
510/**
511 * DRM_VMW_CLAIM_STREAM - Claim a single stream.
512 */
513
514/**
515 * struct drm_vmw_context_arg
516 *
517 * @stream_id: Device unique context ID.
518 *
519 * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
520 * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
521 */
522
523struct drm_vmw_stream_arg {
524 uint32_t stream_id;
525 uint32_t pad64;
526};
527
528/*************************************************************************/
529/**
530 * DRM_VMW_UNREF_STREAM - Unclaim a stream.
531 *
532 * Return a single stream that was claimed by this process. Also makes
533 * sure that the stream has been stopped.
534 */
Thomas Hellstromae2a1042011-09-01 20:18:44 +0000535
Thomas Hellstromf63f6a52011-09-01 20:18:41 +0000536/*************************************************************************/
537/**
538 * DRM_VMW_GET_3D_CAP
539 *
540 * Read 3D capabilities from the FIFO
541 *
542 */
543
544/**
545 * struct drm_vmw_get_3d_cap_arg
546 *
547 * @buffer: Pointer to a buffer for capability data, cast to an uint64_t
548 * @size: Max size to copy
549 *
550 * Input argument to the DRM_VMW_GET_3D_CAP_IOCTL
551 * ioctls.
552 */
553
554struct drm_vmw_get_3d_cap_arg {
555 uint64_t buffer;
556 uint32_t max_size;
557 uint32_t pad64;
558};
Jakob Bornecrantzfb1d9732009-12-10 00:19:58 +0000559
Jakob Bornecrantzd8bd19d2010-06-01 11:54:20 +0200560/*************************************************************************/
561/**
Thomas Hellstromae2a1042011-09-01 20:18:44 +0000562 * DRM_VMW_FENCE_WAIT
563 *
564 * Waits for a fence object to signal. The wait is interruptible, so that
565 * signals may be delivered during the interrupt. The wait may timeout,
566 * in which case the calls returns -EBUSY. If the wait is restarted,
567 * that is restarting without resetting @cookie_valid to zero,
568 * the timeout is computed from the first call.
569 *
570 * The flags argument to the DRM_VMW_FENCE_WAIT ioctl indicates what to wait
571 * on:
572 * DRM_VMW_FENCE_FLAG_EXEC: All commands ahead of the fence in the command
573 * stream
574 * have executed.
575 * DRM_VMW_FENCE_FLAG_QUERY: All query results resulting from query finish
576 * commands
577 * in the buffer given to the EXECBUF ioctl returning the fence object handle
578 * are available to user-space.
579 *
580 * DRM_VMW_WAIT_OPTION_UNREF: If this wait option is given, and the
581 * fenc wait ioctl returns 0, the fence object has been unreferenced after
582 * the wait.
583 */
584
585#define DRM_VMW_FENCE_FLAG_EXEC (1 << 0)
586#define DRM_VMW_FENCE_FLAG_QUERY (1 << 1)
587
588#define DRM_VMW_WAIT_OPTION_UNREF (1 << 0)
589
590/**
591 * struct drm_vmw_fence_wait_arg
592 *
593 * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
594 * @cookie_valid: Must be reset to 0 on first call. Left alone on restart.
595 * @kernel_cookie: Set to 0 on first call. Left alone on restart.
596 * @timeout_us: Wait timeout in microseconds. 0 for indefinite timeout.
597 * @lazy: Set to 1 if timing is not critical. Allow more than a kernel tick
598 * before returning.
599 * @flags: Fence flags to wait on.
600 * @wait_options: Options that control the behaviour of the wait ioctl.
601 *
602 * Input argument to the DRM_VMW_FENCE_WAIT ioctl.
603 */
604
605struct drm_vmw_fence_wait_arg {
606 uint32_t handle;
607 int32_t cookie_valid;
608 uint64_t kernel_cookie;
609 uint64_t timeout_us;
610 int32_t lazy;
611 int32_t flags;
612 int32_t wait_options;
613 int32_t pad64;
614};
615
616/*************************************************************************/
617/**
618 * DRM_VMW_FENCE_SIGNALED
619 *
620 * Checks if a fence object is signaled..
621 */
622
623/**
624 * struct drm_vmw_fence_signaled_arg
625 *
626 * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
627 * @flags: Fence object flags input to DRM_VMW_FENCE_SIGNALED ioctl
628 * @signaled: Out: Flags signaled.
629 * @sequence: Out: Highest sequence passed so far. Can be used to signal the
630 * EXEC flag of user-space fence objects.
631 *
632 * Input/Output argument to the DRM_VMW_FENCE_SIGNALED and DRM_VMW_FENCE_UNREF
633 * ioctls.
634 */
635
636struct drm_vmw_fence_signaled_arg {
637 uint32_t handle;
638 uint32_t flags;
639 int32_t signaled;
640 uint32_t passed_seqno;
641 uint32_t signaled_flags;
642 uint32_t pad64;
643};
644
645/*************************************************************************/
646/**
647 * DRM_VMW_FENCE_UNREF
648 *
649 * Unreferences a fence object, and causes it to be destroyed if there are no
650 * other references to it.
651 *
652 */
653
654/**
655 * struct drm_vmw_fence_arg
656 *
657 * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
658 *
659 * Input/Output argument to the DRM_VMW_FENCE_UNREF ioctl..
660 */
661
662struct drm_vmw_fence_arg {
663 uint32_t handle;
664 uint32_t pad64;
665};
666
667
Jakob Bornecrantz2fcd5a72011-10-04 20:13:26 +0200668/*************************************************************************/
669/**
Thomas Hellstrom57c5ee72011-10-10 12:23:26 +0200670 * DRM_VMW_FENCE_EVENT
671 *
672 * Queues an event on a fence to be delivered on the drm character device
673 * when the fence has signaled the DRM_VMW_FENCE_FLAG_EXEC flag.
674 * Optionally the approximate time when the fence signaled is
675 * given by the event.
676 */
677
678/*
679 * The event type
680 */
681#define DRM_VMW_EVENT_FENCE_SIGNALED 0x80000000
682
683struct drm_vmw_event_fence {
684 struct drm_event base;
685 uint64_t user_data;
686 uint32_t tv_sec;
687 uint32_t tv_usec;
688};
689
690/*
691 * Flags that may be given to the command.
692 */
693/* Request fence signaled time on the event. */
694#define DRM_VMW_FE_FLAG_REQ_TIME (1 << 0)
695
696/**
697 * struct drm_vmw_fence_event_arg
698 *
699 * @fence_rep: Pointer to fence_rep structure cast to uint64_t or 0 if
700 * the fence is not supposed to be referenced by user-space.
701 * @user_info: Info to be delivered with the event.
702 * @handle: Attach the event to this fence only.
703 * @flags: A set of flags as defined above.
704 */
705struct drm_vmw_fence_event_arg {
706 uint64_t fence_rep;
707 uint64_t user_data;
708 uint32_t handle;
709 uint32_t flags;
710};
711
712
713/*************************************************************************/
714/**
Jakob Bornecrantz2fcd5a72011-10-04 20:13:26 +0200715 * DRM_VMW_PRESENT
716 *
717 * Executes an SVGA present on a given fb for a given surface. The surface
718 * is placed on the framebuffer. Cliprects are given relative to the given
719 * point (the point disignated by dest_{x|y}).
720 *
721 */
722
723/**
724 * struct drm_vmw_present_arg
725 * @fb_id: framebuffer id to present / read back from.
726 * @sid: Surface id to present from.
727 * @dest_x: X placement coordinate for surface.
728 * @dest_y: Y placement coordinate for surface.
729 * @clips_ptr: Pointer to an array of clip rects cast to an uint64_t.
730 * @num_clips: Number of cliprects given relative to the framebuffer origin,
731 * in the same coordinate space as the frame buffer.
732 * @pad64: Unused 64-bit padding.
733 *
734 * Input argument to the DRM_VMW_PRESENT ioctl.
735 */
736
737struct drm_vmw_present_arg {
738 uint32_t fb_id;
739 uint32_t sid;
740 int32_t dest_x;
741 int32_t dest_y;
742 uint64_t clips_ptr;
743 uint32_t num_clips;
744 uint32_t pad64;
745};
746
747
748/*************************************************************************/
749/**
750 * DRM_VMW_PRESENT_READBACK
751 *
752 * Executes an SVGA present readback from a given fb to the dma buffer
753 * currently bound as the fb. If there is no dma buffer bound to the fb,
754 * an error will be returned.
755 *
756 */
757
758/**
759 * struct drm_vmw_present_arg
760 * @fb_id: fb_id to present / read back from.
761 * @num_clips: Number of cliprects.
762 * @clips_ptr: Pointer to an array of clip rects cast to an uint64_t.
763 * @fence_rep: Pointer to a struct drm_vmw_fence_rep, cast to an uint64_t.
764 * If this member is NULL, then the ioctl should not return a fence.
765 */
766
767struct drm_vmw_present_readback_arg {
768 uint32_t fb_id;
769 uint32_t num_clips;
770 uint64_t clips_ptr;
771 uint64_t fence_rep;
772};
Thomas Hellstromcd2b89e2011-10-25 23:35:53 +0200773
774/*************************************************************************/
775/**
776 * DRM_VMW_UPDATE_LAYOUT - Update layout
777 *
778 * Updates the preferred modes and connection status for connectors. The
779 * command consists of one drm_vmw_update_layout_arg pointing to an array
780 * of num_outputs drm_vmw_rect's.
781 */
782
783/**
784 * struct drm_vmw_update_layout_arg
785 *
786 * @num_outputs: number of active connectors
787 * @rects: pointer to array of drm_vmw_rect cast to an uint64_t
788 *
789 * Input argument to the DRM_VMW_UPDATE_LAYOUT Ioctl.
790 */
791struct drm_vmw_update_layout_arg {
792 uint32_t num_outputs;
793 uint32_t pad64;
794 uint64_t rects;
795};
796
Thomas Hellstromcfe4d532012-11-21 10:23:14 +0100797
798/*************************************************************************/
799/**
800 * DRM_VMW_CREATE_SHADER - Create shader
801 *
802 * Creates a shader and optionally binds it to a dma buffer containing
803 * the shader byte-code.
804 */
805
806/**
807 * enum drm_vmw_shader_type - Shader types
808 */
809enum drm_vmw_shader_type {
810 drm_vmw_shader_type_vs = 0,
811 drm_vmw_shader_type_ps,
812 drm_vmw_shader_type_gs
813};
814
815
816/**
817 * struct drm_vmw_shader_create_arg
818 *
819 * @shader_type: Shader type of the shader to create.
820 * @size: Size of the byte-code in bytes.
821 * where the shader byte-code starts
822 * @buffer_handle: Buffer handle identifying the buffer containing the
823 * shader byte-code
824 * @shader_handle: On successful completion contains a handle that
825 * can be used to subsequently identify the shader.
826 * @offset: Offset in bytes into the buffer given by @buffer_handle,
827 *
828 * Input / Output argument to the DRM_VMW_CREATE_SHADER Ioctl.
829 */
830struct drm_vmw_shader_create_arg {
831 enum drm_vmw_shader_type shader_type;
832 uint32_t size;
833 uint32_t buffer_handle;
834 uint32_t shader_handle;
835 uint64_t offset;
836};
837
838/*************************************************************************/
839/**
840 * DRM_VMW_UNREF_SHADER - Unreferences a shader
841 *
842 * Destroys a user-space reference to a shader, optionally destroying
843 * it.
844 */
845
846/**
847 * struct drm_vmw_shader_arg
848 *
849 * @handle: Handle identifying the shader to destroy.
850 *
851 * Input argument to the DRM_VMW_UNREF_SHADER ioctl.
852 */
853struct drm_vmw_shader_arg {
854 uint32_t handle;
855 uint32_t pad64;
856};
857
858/*************************************************************************/
859/**
860 * DRM_VMW_GB_SURFACE_CREATE - Create a host guest-backed surface.
861 *
862 * Allocates a surface handle and queues a create surface command
863 * for the host on the first use of the surface. The surface ID can
864 * be used as the surface ID in commands referencing the surface.
865 */
866
867/**
868 * enum drm_vmw_surface_flags
869 *
870 * @drm_vmw_surface_flag_shareable: Whether the surface is shareable
871 * @drm_vmw_surface_flag_scanout: Whether the surface is a scanout
872 * surface.
873 * @drm_vmw_surface_flag_create_buffer: Create a backup buffer if none is
874 * given.
875 */
876enum drm_vmw_surface_flags {
877 drm_vmw_surface_flag_shareable = (1 << 0),
878 drm_vmw_surface_flag_scanout = (1 << 1),
879 drm_vmw_surface_flag_create_buffer = (1 << 2)
880};
881
882/**
883 * struct drm_vmw_gb_surface_create_req
884 *
885 * @svga3d_flags: SVGA3d surface flags for the device.
886 * @format: SVGA3d format.
887 * @mip_level: Number of mip levels for all faces.
888 * @drm_surface_flags Flags as described above.
Zack Rusin15c6f652012-11-21 12:25:33 +0100889 * @multisample_count Future use. Set to 0.
Thomas Hellstromcfe4d532012-11-21 10:23:14 +0100890 * @autogen_filter Future use. Set to 0.
891 * @buffer_handle Buffer handle of backup buffer. SVGA3D_INVALID_ID
892 * if none.
893 * @base_size Size of the base mip level for all faces.
894 *
895 * Input argument to the DRM_VMW_GB_SURFACE_CREATE Ioctl.
896 * Part of output argument for the DRM_VMW_GB_SURFACE_REF Ioctl.
897 */
898struct drm_vmw_gb_surface_create_req {
899 uint32_t svga3d_flags;
900 uint32_t format;
901 uint32_t mip_levels;
902 enum drm_vmw_surface_flags drm_surface_flags;
903 uint32_t multisample_count;
904 uint32_t autogen_filter;
905 uint32_t buffer_handle;
906 uint32_t pad64;
907 struct drm_vmw_size base_size;
908};
909
910/**
911 * struct drm_vmw_gb_surface_create_rep
912 *
913 * @handle: Surface handle.
914 * @backup_size: Size of backup buffers for this surface.
915 * @buffer_handle: Handle of backup buffer. SVGA3D_INVALID_ID if none.
916 * @buffer_size: Actual size of the buffer identified by
917 * @buffer_handle
918 * @buffer_map_handle: Offset into device address space for the buffer
919 * identified by @buffer_handle.
920 *
921 * Part of output argument for the DRM_VMW_GB_SURFACE_REF ioctl.
922 * Output argument for the DRM_VMW_GB_SURFACE_CREATE ioctl.
923 */
924struct drm_vmw_gb_surface_create_rep {
925 uint32_t handle;
926 uint32_t backup_size;
927 uint32_t buffer_handle;
928 uint32_t buffer_size;
929 uint64_t buffer_map_handle;
930};
931
932/**
933 * union drm_vmw_gb_surface_create_arg
934 *
935 * @req: Input argument as described above.
936 * @rep: Output argument as described above.
937 *
938 * Argument to the DRM_VMW_GB_SURFACE_CREATE ioctl.
939 */
940union drm_vmw_gb_surface_create_arg {
941 struct drm_vmw_gb_surface_create_rep rep;
942 struct drm_vmw_gb_surface_create_req req;
943};
944
945/*************************************************************************/
946/**
947 * DRM_VMW_GB_SURFACE_REF - Reference a host surface.
948 *
949 * Puts a reference on a host surface with a given handle, as previously
950 * returned by the DRM_VMW_GB_SURFACE_CREATE ioctl.
951 * A reference will make sure the surface isn't destroyed while we hold
952 * it and will allow the calling client to use the surface handle in
953 * the command stream.
954 *
955 * On successful return, the Ioctl returns the surface information given
956 * to and returned from the DRM_VMW_GB_SURFACE_CREATE ioctl.
957 */
958
959/**
960 * struct drm_vmw_gb_surface_reference_arg
961 *
962 * @creq: The data used as input when the surface was created, as described
963 * above at "struct drm_vmw_gb_surface_create_req"
964 * @crep: Additional data output when the surface was created, as described
965 * above at "struct drm_vmw_gb_surface_create_rep"
966 *
967 * Output Argument to the DRM_VMW_GB_SURFACE_REF ioctl.
968 */
969struct drm_vmw_gb_surface_ref_rep {
970 struct drm_vmw_gb_surface_create_req creq;
971 struct drm_vmw_gb_surface_create_rep crep;
972};
973
974/**
975 * union drm_vmw_gb_surface_reference_arg
976 *
977 * @req: Input data as described above at "struct drm_vmw_surface_arg"
978 * @rep: Output data as described above at "struct drm_vmw_gb_surface_ref_rep"
979 *
980 * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl.
981 */
982union drm_vmw_gb_surface_reference_arg {
983 struct drm_vmw_gb_surface_ref_rep rep;
984 struct drm_vmw_surface_arg req;
985};
986
987
988
Jakob Bornecrantzfb1d9732009-12-10 00:19:58 +0000989#endif