x86: cpu-hotplug: Prevent softirq wakeup on wrong CPU
[linux-2.6/linux-mips.git] / include / drm / vmwgfx_drm.h
blob5c36432d9ce5639f2105f52be5b911cd2ab29819
1 /**************************************************************************
3 * Copyright © 2009 VMware, Inc., Palo Alto, CA., USA
4 * All Rights Reserved.
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
16 * of the Software.
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__
31 #define DRM_VMW_MAX_SURFACE_FACES 6
32 #define DRM_VMW_MAX_MIP_LEVELS 24
34 #define DRM_VMW_EXT_NAME_LEN 128
36 #define DRM_VMW_GET_PARAM 0
37 #define DRM_VMW_ALLOC_DMABUF 1
38 #define DRM_VMW_UNREF_DMABUF 2
39 #define DRM_VMW_CURSOR_BYPASS 3
40 /* guarded by DRM_VMW_PARAM_NUM_STREAMS != 0*/
41 #define DRM_VMW_CONTROL_STREAM 4
42 #define DRM_VMW_CLAIM_STREAM 5
43 #define DRM_VMW_UNREF_STREAM 6
44 /* guarded by DRM_VMW_PARAM_3D == 1 */
45 #define DRM_VMW_CREATE_CONTEXT 7
46 #define DRM_VMW_UNREF_CONTEXT 8
47 #define DRM_VMW_CREATE_SURFACE 9
48 #define DRM_VMW_UNREF_SURFACE 10
49 #define DRM_VMW_REF_SURFACE 11
50 #define DRM_VMW_EXECBUF 12
51 #define DRM_VMW_FIFO_DEBUG 13
52 #define DRM_VMW_FENCE_WAIT 14
53 /* guarded by minor version >= 2 */
54 #define DRM_VMW_UPDATE_LAYOUT 15
57 /*************************************************************************/
58 /**
59 * DRM_VMW_GET_PARAM - get device information.
61 * DRM_VMW_PARAM_FIFO_OFFSET:
62 * Offset to use to map the first page of the FIFO read-only.
63 * The fifo is mapped using the mmap() system call on the drm device.
65 * DRM_VMW_PARAM_OVERLAY_IOCTL:
66 * Does the driver support the overlay ioctl.
69 #define DRM_VMW_PARAM_NUM_STREAMS 0
70 #define DRM_VMW_PARAM_NUM_FREE_STREAMS 1
71 #define DRM_VMW_PARAM_3D 2
72 #define DRM_VMW_PARAM_FIFO_OFFSET 3
73 #define DRM_VMW_PARAM_HW_CAPS 4
74 #define DRM_VMW_PARAM_FIFO_CAPS 5
75 #define DRM_VMW_PARAM_MAX_FB_SIZE 6
77 /**
78 * struct drm_vmw_getparam_arg
80 * @value: Returned value. //Out
81 * @param: Parameter to query. //In.
83 * Argument to the DRM_VMW_GET_PARAM Ioctl.
86 struct drm_vmw_getparam_arg {
87 uint64_t value;
88 uint32_t param;
89 uint32_t pad64;
92 /*************************************************************************/
93 /**
94 * DRM_VMW_EXTENSION - Query device extensions.
97 /**
98 * struct drm_vmw_extension_rep
100 * @exists: The queried extension exists.
101 * @driver_ioctl_offset: Ioctl number of the first ioctl in the extension.
102 * @driver_sarea_offset: Offset to any space in the DRI SAREA
103 * used by the extension.
104 * @major: Major version number of the extension.
105 * @minor: Minor version number of the extension.
106 * @pl: Patch level version number of the extension.
108 * Output argument to the DRM_VMW_EXTENSION Ioctl.
111 struct drm_vmw_extension_rep {
112 int32_t exists;
113 uint32_t driver_ioctl_offset;
114 uint32_t driver_sarea_offset;
115 uint32_t major;
116 uint32_t minor;
117 uint32_t pl;
118 uint32_t pad64;
122 * union drm_vmw_extension_arg
124 * @extension - Ascii name of the extension to be queried. //In
125 * @rep - Reply as defined above. //Out
127 * Argument to the DRM_VMW_EXTENSION Ioctl.
130 union drm_vmw_extension_arg {
131 char extension[DRM_VMW_EXT_NAME_LEN];
132 struct drm_vmw_extension_rep rep;
135 /*************************************************************************/
137 * DRM_VMW_CREATE_CONTEXT - Create a host context.
139 * Allocates a device unique context id, and queues a create context command
140 * for the host. Does not wait for host completion.
144 * struct drm_vmw_context_arg
146 * @cid: Device unique context ID.
148 * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
149 * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
152 struct drm_vmw_context_arg {
153 int32_t cid;
154 uint32_t pad64;
157 /*************************************************************************/
159 * DRM_VMW_UNREF_CONTEXT - Create a host context.
161 * Frees a global context id, and queues a destroy host command for the host.
162 * Does not wait for host completion. The context ID can be used directly
163 * in the command stream and shows up as the same context ID on the host.
166 /*************************************************************************/
168 * DRM_VMW_CREATE_SURFACE - Create a host suface.
170 * Allocates a device unique surface id, and queues a create surface command
171 * for the host. Does not wait for host completion. The surface ID can be
172 * used directly in the command stream and shows up as the same surface
173 * ID on the host.
177 * struct drm_wmv_surface_create_req
179 * @flags: Surface flags as understood by the host.
180 * @format: Surface format as understood by the host.
181 * @mip_levels: Number of mip levels for each face.
182 * An unused face should have 0 encoded.
183 * @size_addr: Address of a user-space array of sruct drm_vmw_size
184 * cast to an uint64_t for 32-64 bit compatibility.
185 * The size of the array should equal the total number of mipmap levels.
186 * @shareable: Boolean whether other clients (as identified by file descriptors)
187 * may reference this surface.
188 * @scanout: Boolean whether the surface is intended to be used as a
189 * scanout.
191 * Input data to the DRM_VMW_CREATE_SURFACE Ioctl.
192 * Output data from the DRM_VMW_REF_SURFACE Ioctl.
195 struct drm_vmw_surface_create_req {
196 uint32_t flags;
197 uint32_t format;
198 uint32_t mip_levels[DRM_VMW_MAX_SURFACE_FACES];
199 uint64_t size_addr;
200 int32_t shareable;
201 int32_t scanout;
205 * struct drm_wmv_surface_arg
207 * @sid: Surface id of created surface or surface to destroy or reference.
209 * Output data from the DRM_VMW_CREATE_SURFACE Ioctl.
210 * Input argument to the DRM_VMW_UNREF_SURFACE Ioctl.
211 * Input argument to the DRM_VMW_REF_SURFACE Ioctl.
214 struct drm_vmw_surface_arg {
215 int32_t sid;
216 uint32_t pad64;
220 * struct drm_vmw_size ioctl.
222 * @width - mip level width
223 * @height - mip level height
224 * @depth - mip level depth
226 * Description of a mip level.
227 * Input data to the DRM_WMW_CREATE_SURFACE Ioctl.
230 struct drm_vmw_size {
231 uint32_t width;
232 uint32_t height;
233 uint32_t depth;
234 uint32_t pad64;
238 * union drm_vmw_surface_create_arg
240 * @rep: Output data as described above.
241 * @req: Input data as described above.
243 * Argument to the DRM_VMW_CREATE_SURFACE Ioctl.
246 union drm_vmw_surface_create_arg {
247 struct drm_vmw_surface_arg rep;
248 struct drm_vmw_surface_create_req req;
251 /*************************************************************************/
253 * DRM_VMW_REF_SURFACE - Reference a host surface.
255 * Puts a reference on a host surface with a give sid, as previously
256 * returned by the DRM_VMW_CREATE_SURFACE ioctl.
257 * A reference will make sure the surface isn't destroyed while we hold
258 * it and will allow the calling client to use the surface ID in the command
259 * stream.
261 * On successful return, the Ioctl returns the surface information given
262 * in the DRM_VMW_CREATE_SURFACE ioctl.
266 * union drm_vmw_surface_reference_arg
268 * @rep: Output data as described above.
269 * @req: Input data as described above.
271 * Argument to the DRM_VMW_REF_SURFACE Ioctl.
274 union drm_vmw_surface_reference_arg {
275 struct drm_vmw_surface_create_req rep;
276 struct drm_vmw_surface_arg req;
279 /*************************************************************************/
281 * DRM_VMW_UNREF_SURFACE - Unreference a host surface.
283 * Clear a reference previously put on a host surface.
284 * When all references are gone, including the one implicitly placed
285 * on creation,
286 * a destroy surface command will be queued for the host.
287 * Does not wait for completion.
290 /*************************************************************************/
292 * DRM_VMW_EXECBUF
294 * Submit a command buffer for execution on the host, and return a
295 * fence sequence that when signaled, indicates that the command buffer has
296 * executed.
300 * struct drm_vmw_execbuf_arg
302 * @commands: User-space address of a command buffer cast to an uint64_t.
303 * @command-size: Size in bytes of the command buffer.
304 * @throttle-us: Sleep until software is less than @throttle_us
305 * microseconds ahead of hardware. The driver may round this value
306 * to the nearest kernel tick.
307 * @fence_rep: User-space address of a struct drm_vmw_fence_rep cast to an
308 * uint64_t.
309 * @version: Allows expanding the execbuf ioctl parameters without breaking
310 * backwards compatibility, since user-space will always tell the kernel
311 * which version it uses.
312 * @flags: Execbuf flags. None currently.
314 * Argument to the DRM_VMW_EXECBUF Ioctl.
317 #define DRM_VMW_EXECBUF_VERSION 0
319 struct drm_vmw_execbuf_arg {
320 uint64_t commands;
321 uint32_t command_size;
322 uint32_t throttle_us;
323 uint64_t fence_rep;
324 uint32_t version;
325 uint32_t flags;
329 * struct drm_vmw_fence_rep
331 * @fence_seq: Fence sequence associated with a command submission.
332 * @error: This member should've been set to -EFAULT on submission.
333 * The following actions should be take on completion:
334 * error == -EFAULT: Fence communication failed. The host is synchronized.
335 * Use the last fence id read from the FIFO fence register.
336 * error != 0 && error != -EFAULT:
337 * Fence submission failed. The host is synchronized. Use the fence_seq member.
338 * error == 0: All is OK, The host may not be synchronized.
339 * Use the fence_seq member.
341 * Input / Output data to the DRM_VMW_EXECBUF Ioctl.
344 struct drm_vmw_fence_rep {
345 uint64_t fence_seq;
346 int32_t error;
347 uint32_t pad64;
350 /*************************************************************************/
352 * DRM_VMW_ALLOC_DMABUF
354 * Allocate a DMA buffer that is visible also to the host.
355 * NOTE: The buffer is
356 * identified by a handle and an offset, which are private to the guest, but
357 * useable in the command stream. The guest kernel may translate these
358 * and patch up the command stream accordingly. In the future, the offset may
359 * be zero at all times, or it may disappear from the interface before it is
360 * fixed.
362 * The DMA buffer may stay user-space mapped in the guest at all times,
363 * and is thus suitable for sub-allocation.
365 * DMA buffers are mapped using the mmap() syscall on the drm device.
369 * struct drm_vmw_alloc_dmabuf_req
371 * @size: Required minimum size of the buffer.
373 * Input data to the DRM_VMW_ALLOC_DMABUF Ioctl.
376 struct drm_vmw_alloc_dmabuf_req {
377 uint32_t size;
378 uint32_t pad64;
382 * struct drm_vmw_dmabuf_rep
384 * @map_handle: Offset to use in the mmap() call used to map the buffer.
385 * @handle: Handle unique to this buffer. Used for unreferencing.
386 * @cur_gmr_id: GMR id to use in the command stream when this buffer is
387 * referenced. See not above.
388 * @cur_gmr_offset: Offset to use in the command stream when this buffer is
389 * referenced. See note above.
391 * Output data from the DRM_VMW_ALLOC_DMABUF Ioctl.
394 struct drm_vmw_dmabuf_rep {
395 uint64_t map_handle;
396 uint32_t handle;
397 uint32_t cur_gmr_id;
398 uint32_t cur_gmr_offset;
399 uint32_t pad64;
403 * union drm_vmw_dmabuf_arg
405 * @req: Input data as described above.
406 * @rep: Output data as described above.
408 * Argument to the DRM_VMW_ALLOC_DMABUF Ioctl.
411 union drm_vmw_alloc_dmabuf_arg {
412 struct drm_vmw_alloc_dmabuf_req req;
413 struct drm_vmw_dmabuf_rep rep;
416 /*************************************************************************/
418 * DRM_VMW_UNREF_DMABUF - Free a DMA buffer.
423 * struct drm_vmw_unref_dmabuf_arg
425 * @handle: Handle indicating what buffer to free. Obtained from the
426 * DRM_VMW_ALLOC_DMABUF Ioctl.
428 * Argument to the DRM_VMW_UNREF_DMABUF Ioctl.
431 struct drm_vmw_unref_dmabuf_arg {
432 uint32_t handle;
433 uint32_t pad64;
436 /*************************************************************************/
438 * DRM_VMW_FIFO_DEBUG - Get last FIFO submission.
440 * This IOCTL copies the last FIFO submission directly out of the FIFO buffer.
444 * struct drm_vmw_fifo_debug_arg
446 * @debug_buffer: User space address of a debug_buffer cast to an uint64_t //In
447 * @debug_buffer_size: Size in bytes of debug buffer //In
448 * @used_size: Number of bytes copied to the buffer // Out
449 * @did_not_fit: Boolean indicating that the fifo contents did not fit. //Out
451 * Argument to the DRM_VMW_FIFO_DEBUG Ioctl.
454 struct drm_vmw_fifo_debug_arg {
455 uint64_t debug_buffer;
456 uint32_t debug_buffer_size;
457 uint32_t used_size;
458 int32_t did_not_fit;
459 uint32_t pad64;
462 struct drm_vmw_fence_wait_arg {
463 uint64_t sequence;
464 uint64_t kernel_cookie;
465 int32_t cookie_valid;
466 int32_t pad64;
469 /*************************************************************************/
471 * DRM_VMW_CONTROL_STREAM - Control overlays, aka streams.
473 * This IOCTL controls the overlay units of the svga device.
474 * The SVGA overlay units does not work like regular hardware units in
475 * that they do not automaticaly read back the contents of the given dma
476 * buffer. But instead only read back for each call to this ioctl, and
477 * at any point between this call being made and a following call that
478 * either changes the buffer or disables the stream.
482 * struct drm_vmw_rect
484 * Defines a rectangle. Used in the overlay ioctl to define
485 * source and destination rectangle.
488 struct drm_vmw_rect {
489 int32_t x;
490 int32_t y;
491 uint32_t w;
492 uint32_t h;
496 * struct drm_vmw_control_stream_arg
498 * @stream_id: Stearm to control
499 * @enabled: If false all following arguments are ignored.
500 * @handle: Handle to buffer for getting data from.
501 * @format: Format of the overlay as understood by the host.
502 * @width: Width of the overlay.
503 * @height: Height of the overlay.
504 * @size: Size of the overlay in bytes.
505 * @pitch: Array of pitches, the two last are only used for YUV12 formats.
506 * @offset: Offset from start of dma buffer to overlay.
507 * @src: Source rect, must be within the defined area above.
508 * @dst: Destination rect, x and y may be negative.
510 * Argument to the DRM_VMW_CONTROL_STREAM Ioctl.
513 struct drm_vmw_control_stream_arg {
514 uint32_t stream_id;
515 uint32_t enabled;
517 uint32_t flags;
518 uint32_t color_key;
520 uint32_t handle;
521 uint32_t offset;
522 int32_t format;
523 uint32_t size;
524 uint32_t width;
525 uint32_t height;
526 uint32_t pitch[3];
528 uint32_t pad64;
529 struct drm_vmw_rect src;
530 struct drm_vmw_rect dst;
533 /*************************************************************************/
535 * DRM_VMW_CURSOR_BYPASS - Give extra information about cursor bypass.
539 #define DRM_VMW_CURSOR_BYPASS_ALL (1 << 0)
540 #define DRM_VMW_CURSOR_BYPASS_FLAGS (1)
543 * struct drm_vmw_cursor_bypass_arg
545 * @flags: Flags.
546 * @crtc_id: Crtc id, only used if DMR_CURSOR_BYPASS_ALL isn't passed.
547 * @xpos: X position of cursor.
548 * @ypos: Y position of cursor.
549 * @xhot: X hotspot.
550 * @yhot: Y hotspot.
552 * Argument to the DRM_VMW_CURSOR_BYPASS Ioctl.
555 struct drm_vmw_cursor_bypass_arg {
556 uint32_t flags;
557 uint32_t crtc_id;
558 int32_t xpos;
559 int32_t ypos;
560 int32_t xhot;
561 int32_t yhot;
564 /*************************************************************************/
566 * DRM_VMW_CLAIM_STREAM - Claim a single stream.
570 * struct drm_vmw_context_arg
572 * @stream_id: Device unique context ID.
574 * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
575 * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
578 struct drm_vmw_stream_arg {
579 uint32_t stream_id;
580 uint32_t pad64;
583 /*************************************************************************/
585 * DRM_VMW_UNREF_STREAM - Unclaim a stream.
587 * Return a single stream that was claimed by this process. Also makes
588 * sure that the stream has been stopped.
591 /*************************************************************************/
593 * DRM_VMW_UPDATE_LAYOUT - Update layout
595 * Updates the preferred modes and connection status for connectors. The
596 * command conisits of one drm_vmw_update_layout_arg pointing out a array
597 * of num_outputs drm_vmw_rect's.
601 * struct drm_vmw_update_layout_arg
603 * @num_outputs: number of active
604 * @rects: pointer to array of drm_vmw_rect
606 * Input argument to the DRM_VMW_UPDATE_LAYOUT Ioctl.
609 struct drm_vmw_update_layout_arg {
610 uint32_t num_outputs;
611 uint32_t pad64;
612 uint64_t rects;
615 #endif