Subversion Repositories Kolibri OS

Rev

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

Rev 5056 Rev 5270
Line 206... Line 206...
206
	 * an implementation can and must use either a mutex or a spinlock to
206
	 * an implementation can and must use either a mutex or a spinlock to
207
	 * protect any data structures managing the space.
207
	 * protect any data structures managing the space.
208
	 */
208
	 */
209
	int  (*get_node)(struct ttm_mem_type_manager *man,
209
	int  (*get_node)(struct ttm_mem_type_manager *man,
210
			 struct ttm_buffer_object *bo,
210
			 struct ttm_buffer_object *bo,
211
			 struct ttm_placement *placement,
211
			 const struct ttm_place *place,
212
			 uint32_t flags,
-
 
213
			 struct ttm_mem_reg *mem);
212
			 struct ttm_mem_reg *mem);
Line 214... Line 213...
214
 
213
 
215
	/**
214
	/**
216
	 * struct ttm_mem_type_manager member put_node
215
	 * struct ttm_mem_type_manager member put_node
Line 311... Line 310...
311
 * structure.
310
 * structure.
312
 * @evict_flags: Callback to obtain placement flags when a buffer is evicted.
311
 * @evict_flags: Callback to obtain placement flags when a buffer is evicted.
313
 * @move: Callback for a driver to hook in accelerated functions to
312
 * @move: Callback for a driver to hook in accelerated functions to
314
 * move a buffer.
313
 * move a buffer.
315
 * If set to NULL, a potentially slow memcpy() move is used.
314
 * If set to NULL, a potentially slow memcpy() move is used.
316
 * @sync_obj_signaled: See ttm_fence_api.h
-
 
317
 * @sync_obj_wait: See ttm_fence_api.h
-
 
318
 * @sync_obj_flush: See ttm_fence_api.h
-
 
319
 * @sync_obj_unref: See ttm_fence_api.h
-
 
320
 * @sync_obj_ref: See ttm_fence_api.h
-
 
321
 */
315
 */
Line 322... Line 316...
322
 
316
 
323
struct ttm_bo_driver {
317
struct ttm_bo_driver {
324
	/**
318
	/**
Line 417... Line 411...
417
	 * This function should return 0 if access is granted, -EPERM otherwise.
411
	 * This function should return 0 if access is granted, -EPERM otherwise.
418
	 */
412
	 */
419
	int (*verify_access) (struct ttm_buffer_object *bo,
413
	int (*verify_access) (struct ttm_buffer_object *bo,
420
			      struct file *filp);
414
			      struct file *filp);
Line 421... Line -...
421
 
-
 
422
	/**
-
 
423
	 * In case a driver writer dislikes the TTM fence objects,
-
 
424
	 * the driver writer can replace those with sync objects of
-
 
425
	 * his / her own. If it turns out that no driver writer is
-
 
426
	 * using these. I suggest we remove these hooks and plug in
-
 
427
	 * fences directly. The bo driver needs the following functionality:
-
 
428
	 * See the corresponding functions in the fence object API
-
 
429
	 * documentation.
-
 
430
	 */
-
 
431
 
-
 
432
	bool (*sync_obj_signaled) (void *sync_obj);
-
 
433
	int (*sync_obj_wait) (void *sync_obj,
-
 
434
			      bool lazy, bool interruptible);
-
 
435
	int (*sync_obj_flush) (void *sync_obj);
-
 
436
	void (*sync_obj_unref) (void **sync_obj);
-
 
437
	void *(*sync_obj_ref) (void *sync_obj);
-
 
438
 
415
 
439
	/* hook to notify driver about a driver move so it
416
	/* hook to notify driver about a driver move so it
440
	 * can do tiling things */
417
	 * can do tiling things */
441
	void (*move_notify)(struct ttm_buffer_object *bo,
418
	void (*move_notify)(struct ttm_buffer_object *bo,
442
			    struct ttm_mem_reg *new_mem);
419
			    struct ttm_mem_reg *new_mem);
Line 520... Line 497...
520
/**
497
/**
521
 * struct ttm_bo_device - Buffer object driver device-specific data.
498
 * struct ttm_bo_device - Buffer object driver device-specific data.
522
 *
499
 *
523
 * @driver: Pointer to a struct ttm_bo_driver struct setup by the driver.
500
 * @driver: Pointer to a struct ttm_bo_driver struct setup by the driver.
524
 * @man: An array of mem_type_managers.
501
 * @man: An array of mem_type_managers.
525
 * @fence_lock: Protects the synchronizing members on *all* bos belonging
-
 
526
 * to this device.
-
 
527
 * @vma_manager: Address space manager
502
 * @vma_manager: Address space manager
528
 * lru_lock: Spinlock that protects the buffer+device lru lists and
503
 * lru_lock: Spinlock that protects the buffer+device lru lists and
529
 * ddestroy lists.
504
 * ddestroy lists.
530
 * @val_seq: Current validation sequence.
505
 * @val_seq: Current validation sequence.
531
 * @dev_mapping: A pointer to the struct address_space representing the
506
 * @dev_mapping: A pointer to the struct address_space representing the
Line 541... Line 516...
541
	 */
516
	 */
542
	struct list_head device_list;
517
	struct list_head device_list;
543
	struct ttm_bo_global *glob;
518
	struct ttm_bo_global *glob;
544
	struct ttm_bo_driver *driver;
519
	struct ttm_bo_driver *driver;
545
	struct ttm_mem_type_manager man[TTM_NUM_MEM_TYPES];
520
	struct ttm_mem_type_manager man[TTM_NUM_MEM_TYPES];
546
	spinlock_t fence_lock;
-
 
Line 547... Line 521...
547
 
521
 
548
	/*
522
	/*
549
	 * Protected by internal locks.
523
	 * Protected by internal locks.
550
	 */
524
	 */
Line 1020... Line 994...
1020
 
994
 
1021
/**
995
/**
1022
 * ttm_bo_move_accel_cleanup.
996
 * ttm_bo_move_accel_cleanup.
1023
 *
997
 *
1024
 * @bo: A pointer to a struct ttm_buffer_object.
998
 * @bo: A pointer to a struct ttm_buffer_object.
1025
 * @sync_obj: A sync object that signals when moving is complete.
999
 * @fence: A fence object that signals when moving is complete.
1026
 * @evict: This is an evict move. Don't return until the buffer is idle.
1000
 * @evict: This is an evict move. Don't return until the buffer is idle.
1027
 * @no_wait_gpu: Return immediately if the GPU is busy.
1001
 * @no_wait_gpu: Return immediately if the GPU is busy.
1028
 * @new_mem: struct ttm_mem_reg indicating where to move.
1002
 * @new_mem: struct ttm_mem_reg indicating where to move.
1029
 *
1003
 *
Line 1034... Line 1008...
1034
 * destroyed when the move is complete. This will help pipeline
1008
 * destroyed when the move is complete. This will help pipeline
1035
 * buffer moves.
1009
 * buffer moves.
1036
 */
1010
 */
Line 1037... Line 1011...
1037
 
1011
 
1038
extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
1012
extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
1039
				     void *sync_obj,
1013
				     struct fence *fence,
1040
				     bool evict, bool no_wait_gpu,
1014
				     bool evict, bool no_wait_gpu,
1041
				     struct ttm_mem_reg *new_mem);
1015
				     struct ttm_mem_reg *new_mem);
1042
/**
1016
/**
1043
 * ttm_io_prot
1017
 * ttm_io_prot