Good to know, mostly for debugging purposes.

Signed-off-by: Matthew Auld <matthew.a...@intel.com>
Cc: Joonas Lahtinen <joonas.lahti...@linux.intel.com>
Cc: Chris Wilson <ch...@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 42 +++++++++++++++++++++++++++++++++----
 1 file changed, 38 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
b/drivers/gpu/drm/i915/i915_debugfs.c
index ea50c4a1efae..ba5ef95286a5 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -117,6 +117,26 @@ static u64 i915_gem_obj_total_ggtt_size(struct 
drm_i915_gem_object *obj)
        return size;
 }
 
+static const char *stringify_page_sizes(unsigned int page_sizes)
+{
+       switch (page_sizes) {
+       case I915_GTT_PAGE_SIZE_4K:
+               return "4K";
+       case I915_GTT_PAGE_SIZE_64K:
+               return "64K";
+       case I915_GTT_PAGE_SIZE_2M:
+               return "2M";
+       case I915_GTT_PAGE_SIZE_1G:
+               return "1G";
+       default:
+               /* mixed-mode? */
+               if (page_sizes)
+                       return "M";
+
+               return "";
+       }
+}
+
 static void
 describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
 {
@@ -154,9 +174,10 @@ describe_obj(struct seq_file *m, struct 
drm_i915_gem_object *obj)
                if (!drm_mm_node_allocated(&vma->node))
                        continue;
 
-               seq_printf(m, " (%sgtt offset: %08llx, size: %08llx",
+               seq_printf(m, " (%sgtt offset: %08llx, size: %08llx, pages: %s",
                           i915_vma_is_ggtt(vma) ? "g" : "pp",
-                          vma->node.start, vma->node.size);
+                          vma->node.start, vma->node.size,
+                          stringify_page_sizes(vma->page_sizes.gtt));
                if (i915_vma_is_ggtt(vma)) {
                        switch (vma->ggtt_view.type) {
                        case I915_GGTT_VIEW_NORMAL:
@@ -401,8 +422,8 @@ static int i915_gem_object_info(struct seq_file *m, void 
*data)
        struct drm_i915_private *dev_priv = node_to_i915(m->private);
        struct drm_device *dev = &dev_priv->drm;
        struct i915_ggtt *ggtt = &dev_priv->ggtt;
-       u32 count, mapped_count, purgeable_count, dpy_count;
-       u64 size, mapped_size, purgeable_size, dpy_size;
+       u32 count, mapped_count, purgeable_count, dpy_count, huge_count;
+       u64 size, mapped_size, purgeable_size, dpy_size, huge_size;
        struct drm_i915_gem_object *obj;
        struct drm_file *file;
        int ret;
@@ -418,6 +439,7 @@ static int i915_gem_object_info(struct seq_file *m, void 
*data)
        size = count = 0;
        mapped_size = mapped_count = 0;
        purgeable_size = purgeable_count = 0;
+       huge_size = huge_count = 0;
        list_for_each_entry(obj, &dev_priv->mm.unbound_list, global_link) {
                size += obj->base.size;
                ++count;
@@ -431,6 +453,11 @@ static int i915_gem_object_info(struct seq_file *m, void 
*data)
                        mapped_count++;
                        mapped_size += obj->base.size;
                }
+
+               if (obj->mm.page_sizes.sg > I915_GTT_PAGE_SIZE) {
+                       huge_count++;
+                       huge_size += obj->base.size;
+               }
        }
        seq_printf(m, "%u unbound objects, %llu bytes\n", count, size);
 
@@ -453,6 +480,11 @@ static int i915_gem_object_info(struct seq_file *m, void 
*data)
                        mapped_count++;
                        mapped_size += obj->base.size;
                }
+
+               if (obj->mm.page_sizes.sg > I915_GTT_PAGE_SIZE) {
+                       huge_count++;
+                       huge_size += obj->base.size;
+               }
        }
        seq_printf(m, "%u bound objects, %llu bytes\n",
                   count, size);
@@ -460,6 +492,8 @@ static int i915_gem_object_info(struct seq_file *m, void 
*data)
                   purgeable_count, purgeable_size);
        seq_printf(m, "%u mapped objects, %llu bytes\n",
                   mapped_count, mapped_size);
+       seq_printf(m, "%u huge-paged objects, %llu bytes\n",
+                  huge_count, huge_size);
        seq_printf(m, "%u display objects (pinned), %llu bytes\n",
                   dpy_count, dpy_size);
 
-- 
2.13.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to