aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2013-02-07 23:02:32 -0500
committerDave Airlie <airlied@redhat.com>2013-02-07 23:02:32 -0500
commitb9e5071386007729110e86fd2c55c687085624e3 (patch)
tree4720ecd2ee9be3f8c46e71d75119219db1692507 /include/drm
parent85a7ce67f3ebfd5975ffd1febcabfe4999ca911d (diff)
parentcc4c0c4de3c775be22072ec3251f2e581b63d9a0 (diff)
Merge branch 'for-airlied' of git://people.freedesktop.org/~mlankhorst/linux into drm-next
TTM reservations changes, preparing for new reservation mutex system. * 'for-airlied' of git://people.freedesktop.org/~mlankhorst/linux: drm/ttm: unexport ttm_bo_wait_unreserved drm/nouveau: use ttm_bo_reserve_slowpath in validate_init, v2 drm/ttm: use ttm_bo_reserve_slowpath_nolru in ttm_eu_reserve_buffers, v2 drm/ttm: add ttm_bo_reserve_slowpath drm/ttm: cleanup ttm_eu_reserve_buffers handling drm/ttm: remove lru_lock around ttm_bo_reserve drm/nouveau: increase reservation sequence every retry drm/vmwgfx: always use ttm_bo_is_reserved
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/ttm/ttm_bo_driver.h61
1 files changed, 34 insertions, 27 deletions
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index e3a43a47d78c..0fbd046e7c93 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -790,16 +790,7 @@ extern void ttm_mem_io_unlock(struct ttm_mem_type_manager *man);
790 * to make room for a buffer already reserved. (Buffers are reserved before 790 * to make room for a buffer already reserved. (Buffers are reserved before
791 * they are evicted). The following algorithm prevents such deadlocks from 791 * they are evicted). The following algorithm prevents such deadlocks from
792 * occurring: 792 * occurring:
793 * 1) Buffers are reserved with the lru spinlock held. Upon successful 793 * Processes attempting to reserve multiple buffers other than for eviction,
794 * reservation they are removed from the lru list. This stops a reserved buffer
795 * from being evicted. However the lru spinlock is released between the time
796 * a buffer is selected for eviction and the time it is reserved.
797 * Therefore a check is made when a buffer is reserved for eviction, that it
798 * is still the first buffer in the lru list, before it is removed from the
799 * list. @check_lru == 1 forces this check. If it fails, the function returns
800 * -EINVAL, and the caller should then choose a new buffer to evict and repeat
801 * the procedure.
802 * 2) Processes attempting to reserve multiple buffers other than for eviction,
803 * (typically execbuf), should first obtain a unique 32-bit 794 * (typically execbuf), should first obtain a unique 32-bit
804 * validation sequence number, 795 * validation sequence number,
805 * and call this function with @use_sequence == 1 and @sequence == the unique 796 * and call this function with @use_sequence == 1 and @sequence == the unique
@@ -830,9 +821,39 @@ extern int ttm_bo_reserve(struct ttm_buffer_object *bo,
830 bool interruptible, 821 bool interruptible,
831 bool no_wait, bool use_sequence, uint32_t sequence); 822 bool no_wait, bool use_sequence, uint32_t sequence);
832 823
824/**
825 * ttm_bo_reserve_slowpath_nolru:
826 * @bo: A pointer to a struct ttm_buffer_object.
827 * @interruptible: Sleep interruptible if waiting.
828 * @sequence: Set (@bo)->sequence to this value after lock
829 *
830 * This is called after ttm_bo_reserve returns -EAGAIN and we backed off
831 * from all our other reservations. Because there are no other reservations
832 * held by us, this function cannot deadlock any more.
833 *
834 * Will not remove reserved buffers from the lru lists.
835 * Otherwise identical to ttm_bo_reserve_slowpath.
836 */
837extern int ttm_bo_reserve_slowpath_nolru(struct ttm_buffer_object *bo,
838 bool interruptible,
839 uint32_t sequence);
840
833 841
834/** 842/**
835 * ttm_bo_reserve_locked: 843 * ttm_bo_reserve_slowpath:
844 * @bo: A pointer to a struct ttm_buffer_object.
845 * @interruptible: Sleep interruptible if waiting.
846 * @sequence: Set (@bo)->sequence to this value after lock
847 *
848 * This is called after ttm_bo_reserve returns -EAGAIN and we backed off
849 * from all our other reservations. Because there are no other reservations
850 * held by us, this function cannot deadlock any more.
851 */
852extern int ttm_bo_reserve_slowpath(struct ttm_buffer_object *bo,
853 bool interruptible, uint32_t sequence);
854
855/**
856 * ttm_bo_reserve_nolru:
836 * 857 *
837 * @bo: A pointer to a struct ttm_buffer_object. 858 * @bo: A pointer to a struct ttm_buffer_object.
838 * @interruptible: Sleep interruptible if waiting. 859 * @interruptible: Sleep interruptible if waiting.
@@ -840,9 +861,7 @@ extern int ttm_bo_reserve(struct ttm_buffer_object *bo,
840 * @use_sequence: If @bo is already reserved, Only sleep waiting for 861 * @use_sequence: If @bo is already reserved, Only sleep waiting for
841 * it to become unreserved if @sequence < (@bo)->sequence. 862 * it to become unreserved if @sequence < (@bo)->sequence.
842 * 863 *
843 * Must be called with struct ttm_bo_global::lru_lock held, 864 * Will not remove reserved buffers from the lru lists.
844 * and will not remove reserved buffers from the lru lists.
845 * The function may release the LRU spinlock if it needs to sleep.
846 * Otherwise identical to ttm_bo_reserve. 865 * Otherwise identical to ttm_bo_reserve.
847 * 866 *
848 * Returns: 867 * Returns:
@@ -855,7 +874,7 @@ extern int ttm_bo_reserve(struct ttm_buffer_object *bo,
855 * -EDEADLK: Bo already reserved using @sequence. This error code will only 874 * -EDEADLK: Bo already reserved using @sequence. This error code will only
856 * be returned if @use_sequence is set to true. 875 * be returned if @use_sequence is set to true.
857 */ 876 */
858extern int ttm_bo_reserve_locked(struct ttm_buffer_object *bo, 877extern int ttm_bo_reserve_nolru(struct ttm_buffer_object *bo,
859 bool interruptible, 878 bool interruptible,
860 bool no_wait, bool use_sequence, 879 bool no_wait, bool use_sequence,
861 uint32_t sequence); 880 uint32_t sequence);
@@ -879,18 +898,6 @@ extern void ttm_bo_unreserve(struct ttm_buffer_object *bo);
879 */ 898 */
880extern void ttm_bo_unreserve_locked(struct ttm_buffer_object *bo); 899extern void ttm_bo_unreserve_locked(struct ttm_buffer_object *bo);
881 900
882/**
883 * ttm_bo_wait_unreserved
884 *
885 * @bo: A pointer to a struct ttm_buffer_object.
886 *
887 * Wait for a struct ttm_buffer_object to become unreserved.
888 * This is typically used in the execbuf code to relax cpu-usage when
889 * a potential deadlock condition backoff.
890 */
891extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo,
892 bool interruptible);
893
894/* 901/*
895 * ttm_bo_util.c 902 * ttm_bo_util.c
896 */ 903 */