Add the struct member to track write only objects, and display them in
our debugfs.

Signed-off-by: Ben Widawsky <b...@bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_debugfs.c |   18 +++++++++++++-----
 drivers/gpu/drm/i915/i915_drv.h     |    2 ++
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
b/drivers/gpu/drm/i915/i915_debugfs.c
index 3c395a5..b0f1964 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -138,12 +138,14 @@ describe_obj(struct seq_file *m, struct 
drm_i915_gem_object *obj)
        if (obj->gtt_space != NULL)
                seq_printf(m, " (gtt offset: %08x, size: %08x)",
                           obj->gtt_offset, (unsigned int)obj->gtt_space->size);
-       if (obj->pin_mappable || obj->fault_mappable) {
-               char s[3], *t = s;
+       if (obj->pin_mappable || obj->fault_mappable || obj->cpu_write_only) {
+               char s[4], *t = s;
                if (obj->pin_mappable)
                        *t++ = 'p';
                if (obj->fault_mappable)
                        *t++ = 'f';
+               if (obj->cpu_write_only)
+                       *t++ = 'w';
                *t = '\0';
                seq_printf(m, " (%s mappable)", s);
        }
@@ -224,8 +226,8 @@ static int i915_gem_object_info(struct seq_file *m, void* 
data)
        struct drm_info_node *node = (struct drm_info_node *) m->private;
        struct drm_device *dev = node->minor->dev;
        struct drm_i915_private *dev_priv = dev->dev_private;
-       u32 count, mappable_count;
-       size_t size, mappable_size;
+       u32 count, mappable_count, womap_count;
+       size_t size, mappable_size, womap_size;
        struct drm_i915_gem_object *obj;
        int ret;
 
@@ -263,7 +265,7 @@ static int i915_gem_object_info(struct seq_file *m, void* 
data)
        seq_printf(m, "  %u [%u] freed objects, %zu [%zu] bytes\n",
                   count, mappable_count, size, mappable_size);
 
-       size = count = mappable_size = mappable_count = 0;
+       size = count = mappable_size = mappable_count = womap_count = 
womap_size = 0;
        list_for_each_entry(obj, &dev_priv->mm.gtt_list, gtt_list) {
                if (obj->fault_mappable) {
                        size += obj->gtt_space->size;
@@ -273,11 +275,17 @@ static int i915_gem_object_info(struct seq_file *m, void* 
data)
                        mappable_size += obj->gtt_space->size;
                        ++mappable_count;
                }
+               if (obj->cpu_write_only) {
+                       womap_size += obj->gtt_space->size;
+                       ++womap_count;
+               }
        }
        seq_printf(m, "%u pinned mappable objects, %zu bytes\n",
                   mappable_count, mappable_size);
        seq_printf(m, "%u fault mappable objects, %zu bytes\n",
                   count, size);
+       seq_printf(m, "%u write-only mappable objects, %zu bytes\n",
+                  womap_count, womap_size);
 
        seq_printf(m, "%zu [%zu] gtt total\n",
                   dev_priv->mm.gtt_total, dev_priv->mm.mappable_gtt_total);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index cee396c..c960763 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -883,6 +883,8 @@ struct drm_i915_gem_object {
         * reaches 0, dev_priv->pending_flip_queue will be woken up.
         */
        atomic_t pending_flip;
+
+       int cpu_write_only;
 };
 
 #define to_intel_bo(x) container_of(x, struct drm_i915_gem_object, base)
-- 
1.7.6.1

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

Reply via email to