summaryrefslogtreecommitdiffstats
path: root/include/drm
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2020-09-15 10:21:15 +1000
committerDave Airlie <airlied@redhat.com>2020-09-16 09:33:24 +1000
commit7eec915138279d7a83ff8f219846bf7c8ae637c1 (patch)
treeed3ff19a6a2f97dc13b16034819d257a84f07e29 /include/drm
parent9c3006a4cc1b165652a07727caf7926054f9aa9f (diff)
downloadlinux-7eec915138279d7a83ff8f219846bf7c8ae637c1.tar.bz2
drm/ttm/tt: add wrappers to set tt state.
This adds 2 getters and 4 setters, however unbound and populated are currently the same thing, this will change, it also drops a BUG_ON that seems not that useful. Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200915024007.67163-2-airlied@gmail.com
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/ttm/ttm_tt.h32
1 files changed, 31 insertions, 1 deletions
diff --git a/include/drm/ttm/ttm_tt.h b/include/drm/ttm/ttm_tt.h
index 146544ba1c10..86ae759ff018 100644
--- a/include/drm/ttm/ttm_tt.h
+++ b/include/drm/ttm/ttm_tt.h
@@ -74,9 +74,39 @@ struct ttm_tt {
tt_bound,
tt_unbound,
tt_unpopulated,
- } state;
+ } _state;
};
+static inline bool ttm_tt_is_populated(struct ttm_tt *tt)
+{
+ return tt->_state != tt_unpopulated;
+}
+
+static inline bool ttm_tt_is_bound(struct ttm_tt *tt)
+{
+ return tt->_state == tt_bound;
+}
+
+static inline void ttm_tt_set_unpopulated(struct ttm_tt *tt)
+{
+ tt->_state = tt_unpopulated;
+}
+
+static inline void ttm_tt_set_populated(struct ttm_tt *tt)
+{
+ tt->_state = tt_unbound;
+}
+
+static inline void ttm_tt_set_unbound(struct ttm_tt *tt)
+{
+ tt->_state = tt_unbound;
+}
+
+static inline void ttm_tt_set_bound(struct ttm_tt *tt)
+{
+ tt->_state = tt_bound;
+}
+
/**
* struct ttm_dma_tt
*