mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
drm/ttm: add common accounting to the resource mgr v3
It makes sense to have this in the common manager for debugging and accounting of how much resources are used. v2: cleanup kerneldoc a bit v3: drop the atomic, update counter under lock instead Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Huang Rui <ray.huang@amd.com> (v1) Reviewed-by: Matthew Auld <matthew.auld@intel.com> Tested-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Link: https://patchwork.freedesktop.org/patch/msgid/20220214093439.2989-2-christian.koenig@amd.com
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/dma-buf-map.h>
|
||||
#include <linux/dma-fence.h>
|
||||
#include <drm/drm_print.h>
|
||||
@@ -130,10 +131,15 @@ struct ttm_resource_manager {
|
||||
struct dma_fence *move;
|
||||
|
||||
/*
|
||||
* Protected by the global->lru_lock.
|
||||
* Protected by the bdev->lru_lock.
|
||||
*/
|
||||
|
||||
struct list_head lru[TTM_MAX_BO_PRIORITY];
|
||||
|
||||
/**
|
||||
* @usage: How much of the resources are used, protected by the
|
||||
* bdev->lru_lock.
|
||||
*/
|
||||
uint64_t usage;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -283,6 +289,7 @@ void ttm_resource_manager_init(struct ttm_resource_manager *man,
|
||||
int ttm_resource_manager_evict_all(struct ttm_device *bdev,
|
||||
struct ttm_resource_manager *man);
|
||||
|
||||
uint64_t ttm_resource_manager_usage(struct ttm_resource_manager *man);
|
||||
void ttm_resource_manager_debug(struct ttm_resource_manager *man,
|
||||
struct drm_printer *p);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user