staging: gma500: turn on psb SDVO
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / staging / gma500 / psb_ttm_placement_user.h
blob8b7068b5444161727c77f8693ff30ac0174a75f3
1 /**************************************************************************
3 * Copyright 2006-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA
4 * All Rights Reserved.
5 * Copyright (c) 2009 VMware, Inc., Palo Alto, CA., USA
6 * All Rights Reserved.
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License,
10 * version 2, as published by the Free Software Foundation.
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
21 **************************************************************************/
23 * Authors
24 * Thomas Hellström <thomas-at-tungstengraphics-dot-com>
27 #ifndef _TTM_PLACEMENT_USER_H_
28 #define _TTM_PLACEMENT_USER_H_
30 #if !defined(__KERNEL__) && !defined(_KERNEL)
31 #include <stdint.h>
32 #else
33 #include <linux/kernel.h>
34 #endif
36 #include "ttm/ttm_placement.h"
38 #define TTM_PLACEMENT_MAJOR 0
39 #define TTM_PLACEMENT_MINOR 1
40 #define TTM_PLACEMENT_PL 0
41 #define TTM_PLACEMENT_DATE "080819"
43 /**
44 * struct ttm_pl_create_req
46 * @size: The buffer object size.
47 * @placement: Flags that indicate initial acceptable
48 * placement.
49 * @page_alignment: Required alignment in pages.
51 * Input to the TTM_BO_CREATE ioctl.
54 struct ttm_pl_create_req {
55 uint64_t size;
56 uint32_t placement;
57 uint32_t page_alignment;
60 /**
61 * struct ttm_pl_create_ub_req
63 * @size: The buffer object size.
64 * @user_address: User-space address of the memory area that
65 * should be used to back the buffer object cast to 64-bit.
66 * @placement: Flags that indicate initial acceptable
67 * placement.
68 * @page_alignment: Required alignment in pages.
70 * Input to the TTM_BO_CREATE_UB ioctl.
73 struct ttm_pl_create_ub_req {
74 uint64_t size;
75 uint64_t user_address;
76 uint32_t placement;
77 uint32_t page_alignment;
80 /**
81 * struct ttm_pl_rep
83 * @gpu_offset: The current offset into the memory region used.
84 * This can be used directly by the GPU if there are no
85 * additional GPU mapping procedures used by the driver.
87 * @bo_size: Actual buffer object size.
89 * @map_handle: Offset into the device address space.
90 * Used for map, seek, read, write. This will never change
91 * during the lifetime of an object.
93 * @placement: Flag indicating the placement status of
94 * the buffer object using the TTM_PL flags above.
96 * @sync_object_arg: Used for user-space synchronization and
97 * depends on the synchronization model used. If fences are
98 * used, this is the buffer_object::fence_type_mask
100 * Output from the TTM_PL_CREATE and TTM_PL_REFERENCE, and
101 * TTM_PL_SETSTATUS ioctls.
104 struct ttm_pl_rep {
105 uint64_t gpu_offset;
106 uint64_t bo_size;
107 uint64_t map_handle;
108 uint32_t placement;
109 uint32_t handle;
110 uint32_t sync_object_arg;
111 uint32_t pad64;
115 * struct ttm_pl_setstatus_req
117 * @set_placement: Placement flags to set.
119 * @clr_placement: Placement flags to clear.
121 * @handle: The object handle
123 * Input to the TTM_PL_SETSTATUS ioctl.
126 struct ttm_pl_setstatus_req {
127 uint32_t set_placement;
128 uint32_t clr_placement;
129 uint32_t handle;
130 uint32_t pad64;
134 * struct ttm_pl_reference_req
136 * @handle: The object to put a reference on.
138 * Input to the TTM_PL_REFERENCE and the TTM_PL_UNREFERENCE ioctls.
141 struct ttm_pl_reference_req {
142 uint32_t handle;
143 uint32_t pad64;
147 * ACCESS mode flags for SYNCCPU.
149 * TTM_SYNCCPU_MODE_READ will guarantee that the GPU is not
150 * writing to the buffer.
152 * TTM_SYNCCPU_MODE_WRITE will guarantee that the GPU is not
153 * accessing the buffer.
155 * TTM_SYNCCPU_MODE_NO_BLOCK makes sure the call does not wait
156 * for GPU accesses to finish but return -EBUSY.
158 * TTM_SYNCCPU_MODE_TRYCACHED Try to place the buffer in cacheable
159 * memory while synchronized for CPU.
162 #define TTM_PL_SYNCCPU_MODE_READ TTM_ACCESS_READ
163 #define TTM_PL_SYNCCPU_MODE_WRITE TTM_ACCESS_WRITE
164 #define TTM_PL_SYNCCPU_MODE_NO_BLOCK (1 << 2)
165 #define TTM_PL_SYNCCPU_MODE_TRYCACHED (1 << 3)
168 * struct ttm_pl_synccpu_arg
170 * @handle: The object to synchronize.
172 * @access_mode: access mode indicated by the
173 * TTM_SYNCCPU_MODE flags.
175 * @op: indicates whether to grab or release the
176 * buffer for cpu usage.
178 * Input to the TTM_PL_SYNCCPU ioctl.
181 struct ttm_pl_synccpu_arg {
182 uint32_t handle;
183 uint32_t access_mode;
184 enum {
185 TTM_PL_SYNCCPU_OP_GRAB,
186 TTM_PL_SYNCCPU_OP_RELEASE
187 } op;
188 uint32_t pad64;
192 * Waiting mode flags for the TTM_BO_WAITIDLE ioctl.
194 * TTM_WAITIDLE_MODE_LAZY: Allow for sleeps during polling
195 * wait.
197 * TTM_WAITIDLE_MODE_NO_BLOCK: Don't block waiting for GPU,
198 * but return -EBUSY if the buffer is busy.
201 #define TTM_PL_WAITIDLE_MODE_LAZY (1 << 0)
202 #define TTM_PL_WAITIDLE_MODE_NO_BLOCK (1 << 1)
205 * struct ttm_waitidle_arg
207 * @handle: The object to synchronize.
209 * @mode: wait mode indicated by the
210 * TTM_SYNCCPU_MODE flags.
212 * Argument to the TTM_BO_WAITIDLE ioctl.
215 struct ttm_pl_waitidle_arg {
216 uint32_t handle;
217 uint32_t mode;
220 union ttm_pl_create_arg {
221 struct ttm_pl_create_req req;
222 struct ttm_pl_rep rep;
225 union ttm_pl_reference_arg {
226 struct ttm_pl_reference_req req;
227 struct ttm_pl_rep rep;
230 union ttm_pl_setstatus_arg {
231 struct ttm_pl_setstatus_req req;
232 struct ttm_pl_rep rep;
235 union ttm_pl_create_ub_arg {
236 struct ttm_pl_create_ub_req req;
237 struct ttm_pl_rep rep;
241 * Ioctl offsets.
244 #define TTM_PL_CREATE 0x00
245 #define TTM_PL_REFERENCE 0x01
246 #define TTM_PL_UNREF 0x02
247 #define TTM_PL_SYNCCPU 0x03
248 #define TTM_PL_WAITIDLE 0x04
249 #define TTM_PL_SETSTATUS 0x05
250 #define TTM_PL_CREATE_UB 0x06
252 #endif