summaryrefslogtreecommitdiffstats
path: root/include/drm/ttm
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2018-10-19 09:06:06 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-11-05 14:21:20 -0500
commit62b53b37e4b1500d4eb4624a44ad861cf8d3cd18 (patch)
tree0193d438cbb744c1c423415145ca8d695cdf34c6 /include/drm/ttm
parent56b3d20413587fab6a790cfc8bc075ca94bc8ed9 (diff)
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/ttm')
-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 {
398 * @swap_lru: Lru list of buffer objects used for swapping. 398 * @swap_lru: Lru list of buffer objects used for swapping.
399 */ 399 */
400 400
401struct ttm_bo_global { 401extern struct ttm_bo_global {
402 402
403 /** 403 /**
404 * Constant after init. 404 * Constant after init.
@@ -410,8 +410,9 @@ struct ttm_bo_global {
410 spinlock_t lru_lock; 410 spinlock_t lru_lock;
411 411
412 /** 412 /**
413 * Protected by device_list_mutex. 413 * Protected by ttm_global_mutex.
414 */ 414 */
415 unsigned int use_count;
415 struct list_head device_list; 416 struct list_head device_list;
416 417
417 /** 418 /**
@@ -423,7 +424,7 @@ struct ttm_bo_global {
423 * Internal protection. 424 * Internal protection.
424 */ 425 */
425 atomic_t bo_count; 426 atomic_t bo_count;
426}; 427} ttm_bo_glob;
427 428
428 429
429#define TTM_NUM_MEM_TYPES 8 430#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);
568void ttm_bo_mem_put_locked(struct ttm_buffer_object *bo, 569void ttm_bo_mem_put_locked(struct ttm_buffer_object *bo,
569 struct ttm_mem_reg *mem); 570 struct ttm_mem_reg *mem);
570 571
571void ttm_bo_global_release(struct ttm_bo_global *glob); 572void ttm_bo_global_release(void);
572int ttm_bo_global_init(struct ttm_bo_global *glob); 573int ttm_bo_global_init(void);
573 574
574int ttm_bo_device_release(struct ttm_bo_device *bdev); 575int ttm_bo_device_release(struct ttm_bo_device *bdev);
575 576
@@ -906,7 +907,7 @@ struct ttm_bo_global_ref {
906 */ 907 */
907static inline int ttm_bo_global_ref_init(struct drm_global_reference *ref) 908static inline int ttm_bo_global_ref_init(struct drm_global_reference *ref)
908{ 909{
909 return ttm_bo_global_init(ref->object); 910 return ttm_bo_global_init();
910} 911}
911 912
912/** 913/**
@@ -920,7 +921,7 @@ static inline int ttm_bo_global_ref_init(struct drm_global_reference *ref)
920 */ 921 */
921static inline void ttm_bo_global_ref_release(struct drm_global_reference *ref) 922static inline void ttm_bo_global_ref_release(struct drm_global_reference *ref)
922{ 923{
923 ttm_bo_global_release(ref->object); 924 ttm_bo_global_release();
924} 925}
925 926
926#endif 927#endif