diff options
author | Tejas Upadhyay <tejas.upadhyay@intel.com> | 2023-09-15 21:09:01 +0300 |
---|---|---|
committer | Rodrigo Vivi <rodrigo.vivi@intel.com> | 2023-12-21 19:41:15 +0300 |
commit | 0845233388f8a26d00acf9bf230cfd4f36aa4c30 (patch) | |
tree | 633f5e320f7c3d0b15410f9bdf732c899d5c1326 /drivers/gpu/drm/xe/xe_bo.h | |
parent | 303fb1165765e1629e2a82bd1ebbea676c86b33e (diff) | |
download | linux-0845233388f8a26d00acf9bf230cfd4f36aa4c30.tar.xz |
drm/xe: Implement fdinfo memory stats printing
Use the newly added drm_print_memory_stats helper to show memory
utilisation of our objects in drm/driver specific fdinfo output.
To collect the stats we walk the per memory regions object lists
and accumulate object size into the respective drm_memory_stats
categories.
Objects with multiple possible placements are reported in multiple
regions for total and shared sizes, while other categories are
counted only for the currently active region.
V4:
- Remove rcu lock - Auld/Thomas
- take refcnt only if its non-zero - Auld
- DMA_RESV_USAGE_BOOKKEEP covers all fences - Auld
- covert to xe_bo for public objects
V3:
- dont use xe_bo_get/put, not needed
- use designated initializer - Jani
- use list_for_each_entry_rcu
- Fix Checkpatch err - CI
V2:
- Use static initializer for mem_type - Himal/Jani
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Signed-off-by: Tejas Upadhyay <tejas.upadhyay@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'drivers/gpu/drm/xe/xe_bo.h')
-rw-r--r-- | drivers/gpu/drm/xe/xe_bo.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/gpu/drm/xe/xe_bo.h b/drivers/gpu/drm/xe/xe_bo.h index d22b2ae7db72..23f1b9e74e71 100644 --- a/drivers/gpu/drm/xe/xe_bo.h +++ b/drivers/gpu/drm/xe/xe_bo.h @@ -6,6 +6,8 @@ #ifndef _XE_BO_H_ #define _XE_BO_H_ +#include <drm/ttm/ttm_tt.h> + #include "xe_bo_types.h" #include "xe_macros.h" #include "xe_vm_types.h" @@ -247,6 +249,15 @@ static inline size_t xe_bo_ccs_pages_start(struct xe_bo *bo) return PAGE_ALIGN(bo->ttm.base.size); } +static inline bool xe_bo_has_pages(struct xe_bo *bo) +{ + if ((bo->ttm.ttm && ttm_tt_is_populated(bo->ttm.ttm)) || + xe_bo_is_vram(bo)) + return true; + + return false; +} + void __xe_bo_release_dummy(struct kref *kref); /** |