Subversion Repositories Kolibri OS

Rev

Rev 1630 | Rev 3262 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1630 Rev 2003
Line 51... Line 51...
51
	 * Populate the backend with ttm pages. Depending on the backend,
51
	 * Populate the backend with ttm pages. Depending on the backend,
52
	 * it may or may not copy the @pages array.
52
	 * it may or may not copy the @pages array.
53
	 */
53
	 */
54
	int (*populate) (struct ttm_backend *backend,
54
	int (*populate) (struct ttm_backend *backend,
55
			 unsigned long num_pages, struct page **pages,
55
			 unsigned long num_pages, struct page **pages,
56
			 struct page *dummy_read_page);
56
			 struct page *dummy_read_page,
-
 
57
			 dma_addr_t *dma_addrs);
57
	/**
58
	/**
58
	 * struct ttm_backend_func member clear
59
	 * struct ttm_backend_func member clear
59
	 *
60
	 *
60
	 * @backend: Pointer to a struct ttm_backend.
61
	 * @backend: Pointer to a struct ttm_backend.
61
	 *
62
	 *
Line 111... Line 112...
111
	struct ttm_bo_device *bdev;
112
	struct ttm_bo_device *bdev;
112
	uint32_t flags;
113
	uint32_t flags;
113
	struct ttm_backend_func *func;
114
	struct ttm_backend_func *func;
114
};
115
};
Line 115... Line -...
115
 
-
 
116
#define TTM_PAGE_FLAG_VMALLOC         (1 << 0)
116
 
117
#define TTM_PAGE_FLAG_USER            (1 << 1)
117
#define TTM_PAGE_FLAG_USER            (1 << 1)
118
#define TTM_PAGE_FLAG_USER_DIRTY      (1 << 2)
118
#define TTM_PAGE_FLAG_USER_DIRTY      (1 << 2)
119
#define TTM_PAGE_FLAG_WRITE           (1 << 3)
119
#define TTM_PAGE_FLAG_WRITE           (1 << 3)
120
#define TTM_PAGE_FLAG_SWAPPED         (1 << 4)
120
#define TTM_PAGE_FLAG_SWAPPED         (1 << 4)
121
#define TTM_PAGE_FLAG_PERSISTANT_SWAP (1 << 5)
121
#define TTM_PAGE_FLAG_PERSISTENT_SWAP (1 << 5)
122
#define TTM_PAGE_FLAG_ZERO_ALLOC      (1 << 6)
122
#define TTM_PAGE_FLAG_ZERO_ALLOC      (1 << 6)
Line 123... Line 123...
123
#define TTM_PAGE_FLAG_DMA32           (1 << 7)
123
#define TTM_PAGE_FLAG_DMA32           (1 << 7)
124
 
124
 
Line 145... Line 145...
145
 * @tsk: The task for user ttm.
145
 * @tsk: The task for user ttm.
146
 * @start: virtual address for user ttm.
146
 * @start: virtual address for user ttm.
147
 * @swap_storage: Pointer to shmem struct file for swap storage.
147
 * @swap_storage: Pointer to shmem struct file for swap storage.
148
 * @caching_state: The current caching state of the pages.
148
 * @caching_state: The current caching state of the pages.
149
 * @state: The current binding state of the pages.
149
 * @state: The current binding state of the pages.
-
 
150
 * @dma_address: The DMA (bus) addresses of the pages (if TTM_PAGE_FLAG_DMA32)
150
 *
151
 *
151
 * This is a structure holding the pages, caching- and aperture binding
152
 * This is a structure holding the pages, caching- and aperture binding
152
 * status for a buffer object that isn't backed by fixed (VRAM / AGP)
153
 * status for a buffer object that isn't backed by fixed (VRAM / AGP)
153
 * memory.
154
 * memory.
154
 */
155
 */
Line 169... Line 170...
169
	enum {
170
	enum {
170
		tt_bound,
171
		tt_bound,
171
		tt_unbound,
172
		tt_unbound,
172
		tt_unpopulated,
173
		tt_unpopulated,
173
	} state;
174
	} state;
-
 
175
	dma_addr_t *dma_address;
174
};
176
};
Line 175... Line 177...
175
 
177
 
176
#define TTM_MEMTYPE_FLAG_FIXED         (1 << 0)	/* Fixed (on-card) PCI memory */
178
#define TTM_MEMTYPE_FLAG_FIXED         (1 << 0)	/* Fixed (on-card) PCI memory */
177
#define TTM_MEMTYPE_FLAG_MAPPABLE      (1 << 1)	/* Memory mappable */
-
 
178
#define TTM_MEMTYPE_FLAG_NEEDS_IOREMAP (1 << 2)	/* Fixed memory needs ioremap
-
 
179
						   before kernel access. */
179
#define TTM_MEMTYPE_FLAG_MAPPABLE      (1 << 1)	/* Memory mappable */
Line 180... Line 180...
180
#define TTM_MEMTYPE_FLAG_CMA           (1 << 3)	/* Can't map aperture */
180
#define TTM_MEMTYPE_FLAG_CMA           (1 << 3)	/* Can't map aperture */
181
 
181
 
182
/**
182
/**
Line 186... Line 186...
186
 * @use_type: The memory type is enabled.
186
 * @use_type: The memory type is enabled.
187
 * @flags: TTM_MEMTYPE_XX flags identifying the traits of the memory
187
 * @flags: TTM_MEMTYPE_XX flags identifying the traits of the memory
188
 * managed by this memory type.
188
 * managed by this memory type.
189
 * @gpu_offset: If used, the GPU offset of the first managed page of
189
 * @gpu_offset: If used, the GPU offset of the first managed page of
190
 * fixed memory or the first managed location in an aperture.
190
 * fixed memory or the first managed location in an aperture.
191
 * @io_offset: The io_offset of the first managed page of IO memory or
-
 
192
 * the first managed location in an aperture. For TTM_MEMTYPE_FLAG_CMA
-
 
193
 * memory, this should be set to NULL.
-
 
194
 * @io_size: The size of a managed IO region (fixed memory or aperture).
-
 
195
 * @io_addr: Virtual kernel address if the io region is pre-mapped. For
-
 
196
 * TTM_MEMTYPE_FLAG_NEEDS_IOREMAP there is no pre-mapped io map and
-
 
197
 * @io_addr should be set to NULL.
-
 
198
 * @size: Size of the managed region.
191
 * @size: Size of the managed region.
199
 * @available_caching: A mask of available caching types, TTM_PL_FLAG_XX,
192
 * @available_caching: A mask of available caching types, TTM_PL_FLAG_XX,
200
 * as defined in ttm_placement_common.h
193
 * as defined in ttm_placement_common.h
201
 * @default_caching: The default caching policy used for a buffer object
194
 * @default_caching: The default caching policy used for a buffer object
202
 * placed in this memory type if the user doesn't provide one.
195
 * placed in this memory type if the user doesn't provide one.
203
 * @manager: The range manager used for this memory type. FIXME: If the aperture
196
 * @func: structure pointer implementing the range manager. See above
-
 
197
 * @priv: Driver private closure for @func.
204
 * has a page size different from the underlying system, the granularity
198
 * @io_reserve_mutex: Mutex optionally protecting shared io_reserve structures
205
 * of this manager should take care of this. But the range allocating code
199
 * @use_io_reserve_lru: Use an lru list to try to unreserve io_mem_regions
-
 
200
 * reserved by the TTM vm system.
-
 
201
 * @io_reserve_lru: Optional lru list for unreserving io mem regions.
-
 
202
 * @io_reserve_fastpath: Only use bdev::driver::io_mem_reserve to obtain
206
 * in ttm_bo.c needs to be modified for this.
203
 * static information. bdev::driver::io_mem_free is never used.
207
 * @lru: The lru list for this memory type.
204
 * @lru: The lru list for this memory type.
208
 *
205
 *
209
 * This structure is used to identify and manage memory types for a device.
206
 * This structure is used to identify and manage memory types for a device.
210
 * It's set up by the ttm_bo_driver::init_mem_type method.
207
 * It's set up by the ttm_bo_driver::init_mem_type method.
211
 */
208
 */
Line -... Line 209...
-
 
209
 
-
 
210
 
212
 
211
 
-
 
212
struct ttm_mem_type_manager {
Line 213... Line 213...
213
struct ttm_mem_type_manager {
213
	struct ttm_bo_device *bdev;
214
 
214
 
215
	/*
215
	/*
Line 216... Line 216...
216
	 * No protection. Constant from start.
216
	 * No protection. Constant from start.
217
	 */
217
	 */
218
 
218
 
219
	bool has_type;
219
	bool has_type;
220
	bool use_type;
-
 
221
	uint32_t flags;
-
 
222
	unsigned long gpu_offset;
-
 
223
	unsigned long io_offset;
220
	bool use_type;
224
	unsigned long io_size;
221
	uint32_t flags;
225
	void *io_addr;
222
	unsigned long gpu_offset;
-
 
223
	uint64_t size;
-
 
224
	uint32_t available_caching;
-
 
225
	uint32_t default_caching;
-
 
226
	const struct ttm_mem_type_manager_func *func;
-
 
227
	void *priv;
-
 
228
	struct mutex io_reserve_mutex;
-
 
229
	bool use_io_reserve_lru;
-
 
230
	bool io_reserve_fastpath;
-
 
231
 
-
 
232
	/*
-
 
233
	 * Protected by @io_reserve_mutex:
Line 226... Line 234...
226
	uint64_t size;
234
	 */
227
	uint32_t available_caching;
235
 
228
	uint32_t default_caching;
-
 
229
 
-
 
230
	/*
236
	struct list_head io_reserve_lru;
Line 231... Line -...
231
	 * Protected by the bdev->lru_lock.
-
 
232
	 * TODO: Consider one lru_lock per ttm_mem_type_manager.
237
 
233
	 * Plays ill with list removal, though.
238
	/*
Line 234... Line 239...
234
	 */
239
	 * Protected by the global->lru_lock.
235
 
240
	 */