]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/debugfs: hook up ttm_resource_manager_debug
authorMatthew Auld <matthew.auld@intel.com>
Thu, 19 Aug 2021 09:34:19 +0000 (10:34 +0100)
committerMatthew Auld <matthew.auld@intel.com>
Fri, 20 Aug 2021 08:40:23 +0000 (09:40 +0100)
This should give a more complete view of the various bits of internal
resource manager state, for device local-memory.

v2(Thomas):
   - Move the region printing into a nice helper

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210819093419.295636-2-matthew.auld@intel.com
drivers/gpu/drm/i915/i915_debugfs.c
drivers/gpu/drm/i915/intel_memory_region.c
drivers/gpu/drm/i915/intel_memory_region.h

index 6c83da3956b97ad7a29a301adf651334870e2f32..2829df0aa65c2a810f8b0183659336aaed1e1ee1 100644 (file)
@@ -238,6 +238,7 @@ i915_debugfs_describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
 static int i915_gem_object_info(struct seq_file *m, void *data)
 {
        struct drm_i915_private *i915 = node_to_i915(m->private);
+       struct drm_printer p = drm_seq_file_printer(m);
        struct intel_memory_region *mr;
        enum intel_region_id id;
 
@@ -246,8 +247,7 @@ static int i915_gem_object_info(struct seq_file *m, void *data)
                   atomic_read(&i915->mm.free_count),
                   i915->mm.shrink_memory);
        for_each_memory_region(mr, i915, id)
-               seq_printf(m, "%s: total:%pa, available:%pa bytes\n",
-                          mr->name, &mr->total, &mr->avail);
+               intel_memory_region_debug(mr, &p);
 
        return 0;
 }
index 779eb2fa90b6a7e0bc37f4a25173484990c38c8a..e7f7e662775089ce7f3d79fa2ae598a402040a0f 100644 (file)
@@ -78,6 +78,18 @@ int intel_memory_region_reserve(struct intel_memory_region *mem,
        return i915_ttm_buddy_man_reserve(man, offset, size);
 }
 
+void intel_memory_region_debug(struct intel_memory_region *mr,
+                              struct drm_printer *printer)
+{
+       drm_printf(printer, "%s: ", mr->name);
+
+       if (mr->region_private)
+               ttm_resource_manager_debug(mr->region_private, printer);
+       else
+               drm_printf(printer, "total:%pa, available:%pa bytes\n",
+                          &mr->total, &mr->avail);
+}
+
 struct intel_memory_region *
 intel_memory_region_create(struct drm_i915_private *i915,
                           resource_size_t start,
index 1f2b96efa69db3c3d8d5ec2fe4c9a96bf70b5f10..3feae3353d33c549f7271a10e8943b551b691dea 100644 (file)
@@ -15,6 +15,7 @@
 
 struct drm_i915_private;
 struct drm_i915_gem_object;
+struct drm_printer;
 struct intel_memory_region;
 struct sg_table;
 struct ttm_resource;
@@ -127,6 +128,9 @@ int intel_memory_region_reserve(struct intel_memory_region *mem,
                                resource_size_t offset,
                                resource_size_t size);
 
+void intel_memory_region_debug(struct intel_memory_region *mr,
+                              struct drm_printer *printer);
+
 struct intel_memory_region *
 i915_gem_ttm_system_setup(struct drm_i915_private *i915,
                          u16 type, u16 instance);