Subversion Repositories Kolibri OS

Rev

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

Rev 4065 Rev 4103
Line 518... Line 518...
518
 *
518
 *
519
 * @driver: Pointer to a struct ttm_bo_driver struct setup by the driver.
519
 * @driver: Pointer to a struct ttm_bo_driver struct setup by the driver.
520
 * @man: An array of mem_type_managers.
520
 * @man: An array of mem_type_managers.
521
 * @fence_lock: Protects the synchronizing members on *all* bos belonging
521
 * @fence_lock: Protects the synchronizing members on *all* bos belonging
522
 * to this device.
522
 * to this device.
523
 * @addr_space_mm: Range manager for the device address space.
523
 * @vma_manager: Address space manager
524
 * lru_lock: Spinlock that protects the buffer+device lru lists and
524
 * lru_lock: Spinlock that protects the buffer+device lru lists and
525
 * ddestroy lists.
525
 * ddestroy lists.
526
 * @val_seq: Current validation sequence.
526
 * @val_seq: Current validation sequence.
527
 * @dev_mapping: A pointer to the struct address_space representing the
527
 * @dev_mapping: A pointer to the struct address_space representing the
528
 * device address space.
528
 * device address space.
Line 772... Line 772...
772
extern void ttm_mem_io_free_vm(struct ttm_buffer_object *bo);
772
extern void ttm_mem_io_free_vm(struct ttm_buffer_object *bo);
773
extern int ttm_mem_io_lock(struct ttm_mem_type_manager *man,
773
extern int ttm_mem_io_lock(struct ttm_mem_type_manager *man,
774
			   bool interruptible);
774
			   bool interruptible);
775
extern void ttm_mem_io_unlock(struct ttm_mem_type_manager *man);
775
extern void ttm_mem_io_unlock(struct ttm_mem_type_manager *man);
Line -... Line 776...
-
 
776
 
-
 
777
extern void ttm_bo_del_sub_from_lru(struct ttm_buffer_object *bo);
-
 
778
extern void ttm_bo_add_to_lru(struct ttm_buffer_object *bo);
-
 
779
 
-
 
780
/**
-
 
781
 * ttm_bo_reserve_nolru:
-
 
782
 *
-
 
783
 * @bo: A pointer to a struct ttm_buffer_object.
-
 
784
 * @interruptible: Sleep interruptible if waiting.
-
 
785
 * @no_wait: Don't sleep while trying to reserve, rather return -EBUSY.
-
 
786
 * @use_ticket: If @bo is already reserved, Only sleep waiting for
-
 
787
 * it to become unreserved if @ticket->stamp is older.
-
 
788
 *
-
 
789
 * Will not remove reserved buffers from the lru lists.
-
 
790
 * Otherwise identical to ttm_bo_reserve.
-
 
791
 *
-
 
792
 * Returns:
-
 
793
 * -EDEADLK: The reservation may cause a deadlock.
-
 
794
 * Release all buffer reservations, wait for @bo to become unreserved and
-
 
795
 * try again. (only if use_sequence == 1).
-
 
796
 * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by
-
 
797
 * a signal. Release all buffer reservations and return to user-space.
-
 
798
 * -EBUSY: The function needed to sleep, but @no_wait was true
-
 
799
 * -EALREADY: Bo already reserved using @ticket. This error code will only
-
 
800
 * be returned if @use_ticket is set to true.
-
 
801
 */
-
 
802
static inline int ttm_bo_reserve_nolru(struct ttm_buffer_object *bo,
-
 
803
				       bool interruptible,
-
 
804
				       bool no_wait, bool use_ticket,
-
 
805
				       struct ww_acquire_ctx *ticket)
-
 
806
{
-
 
807
	int ret = 0;
-
 
808
/*
-
 
809
	if (no_wait) {
-
 
810
		bool success;
-
 
811
		if (WARN_ON(ticket))
-
 
812
			return -EBUSY;
-
 
813
 
-
 
814
		success = ww_mutex_trylock(&bo->resv->lock);
-
 
815
		return success ? 0 : -EBUSY;
-
 
816
	}
-
 
817
 
-
 
818
	if (interruptible)
-
 
819
		ret = ww_mutex_lock_interruptible(&bo->resv->lock, ticket);
-
 
820
	else
-
 
821
		ret = ww_mutex_lock(&bo->resv->lock, ticket);
-
 
822
	if (ret == -EINTR)
-
 
823
		return -ERESTARTSYS;
-
 
824
*/
-
 
825
	return ret;
Line 776... Line 826...
776
 
826
}
777
 
827
 
778
/**
828
/**
779
 * ttm_bo_reserve:
829
 * ttm_bo_reserve:
Line 882... Line 932...
882
	if (!(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) {
932
	if (!(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) {
883
		spin_lock(&bo->glob->lru_lock);
933
		spin_lock(&bo->glob->lru_lock);
884
		ttm_bo_add_to_lru(bo);
934
		ttm_bo_add_to_lru(bo);
885
		spin_unlock(&bo->glob->lru_lock);
935
		spin_unlock(&bo->glob->lru_lock);
886
	}
936
	}
887
	ww_mutex_unlock(&bo->resv->lock);
937
//   ww_mutex_unlock(&bo->resv->lock);
888
}
938
}
Line 889... Line 939...
889
 
939
 
890
/**
940
/**
891
 * ttm_bo_unreserve
941
 * ttm_bo_unreserve