summaryrefslogtreecommitdiffstats
path: root/include/drm
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2018-10-19 15:06:06 +0200
committerAlex Deucher <alexander.deucher@amd.com>2018-11-05 14:21:20 -0500
commit62b53b37e4b1500d4eb4624a44ad861cf8d3cd18 (patch)
tree0193d438cbb744c1c423415145ca8d695cdf34c6 /include/drm
parent56b3d20413587fab6a790cfc8bc075ca94bc8ed9 (diff)
downloadlinux-62b53b37e4b1500d4eb4624a44ad861cf8d3cd18.tar.bz2
drm/ttm: use a static ttm_bo_global instance
As the name says we only need one global instance of ttm_bo_global. Just use a single exported instance which is save to initialize multiple times. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/ttm/ttm_bo_driver.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 9cec8835b88f..26be74939f10 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -398,7 +398,7 @@ struct ttm_bo_driver {
* @swap_lru: Lru list of buffer objects used for swapping.
*/
-struct ttm_bo_global {
+extern struct ttm_bo_global {
/**
* Constant after init.
@@ -410,8 +410,9 @@ struct ttm_bo_global {
spinlock_t lru_lock;
/**
- * Protected by device_list_mutex.
+ * Protected by ttm_global_mutex.
*/
+ unsigned int use_count;
struct list_head device_list;
/**
@@ -423,7 +424,7 @@ struct ttm_bo_global {
* Internal protection.
*/
atomic_t bo_count;
-};
+} ttm_bo_glob;
#define TTM_NUM_MEM_TYPES 8
@@ -568,8 +569,8 @@ void ttm_bo_mem_put(struct ttm_buffer_object *bo, struct ttm_mem_reg *mem);
void ttm_bo_mem_put_locked(struct ttm_buffer_object *bo,
struct ttm_mem_reg *mem);
-void ttm_bo_global_release(struct ttm_bo_global *glob);
-int ttm_bo_global_init(struct ttm_bo_global *glob);
+void ttm_bo_global_release(void);
+int ttm_bo_global_init(void);
int ttm_bo_device_release(struct ttm_bo_device *bdev);
@@ -906,7 +907,7 @@ struct ttm_bo_global_ref {
*/
static inline int ttm_bo_global_ref_init(struct drm_global_reference *ref)
{
- return ttm_bo_global_init(ref->object);
+ return ttm_bo_global_init();
}
/**
@@ -920,7 +921,7 @@ static inline int ttm_bo_global_ref_init(struct drm_global_reference *ref)
*/
static inline void ttm_bo_global_ref_release(struct drm_global_reference *ref)
{
- ttm_bo_global_release(ref->object);
+ ttm_bo_global_release();
}
#endif