summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorBen Gamari <bgamari@gmail.com>2009-02-18 04:08:51 +0300
committerEric Anholt <eric@anholt.net>2009-03-28 01:12:03 +0300
commit433e12f78b68a8069f54956edf766bb21394c197 (patch)
tree4d95338d13eb90a73451eb3618295b84d0c6e039 /drivers/gpu
parent2017263e9e72974610179beaa85c4498b9c4b7a4 (diff)
downloadlinux-433e12f78b68a8069f54956edf766bb21394c197.tar.xz
drm/i915: Consolidate gem object list dumping
Here we eliminate a few functions in favor of using a single function to dump from all of the object lists. Signed-Off-By: Ben Gamari <bgamari@gmail.com> Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/i915_gem_debugfs.c86
1 files changed, 28 insertions, 58 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_debugfs.c b/drivers/gpu/drm/i915/i915_gem_debugfs.c
index dd2b0edb9963..4fc845cee804 100644
--- a/drivers/gpu/drm/i915/i915_gem_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_gem_debugfs.c
@@ -37,69 +37,38 @@
#if defined(CONFIG_DEBUG_FS)
-static int i915_gem_active_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;
- drm_i915_private_t *dev_priv = dev->dev_private;
- struct drm_i915_gem_object *obj_priv;
-
- seq_printf(m, "Active:\n");
- list_for_each_entry(obj_priv, &dev_priv->mm.active_list,
- list)
- {
- struct drm_gem_object *obj = obj_priv->obj;
- if (obj->name) {
- seq_printf(m, " %p(%d): %08x %08x %d\n",
- obj, obj->name,
- obj->read_domains, obj->write_domain,
- obj_priv->last_rendering_seqno);
- } else {
- seq_printf(m, " %p: %08x %08x %d\n",
- obj,
- obj->read_domains, obj->write_domain,
- obj_priv->last_rendering_seqno);
- }
- }
- return 0;
-}
+#define ACTIVE_LIST 1
+#define FLUSHING_LIST 2
+#define INACTIVE_LIST 3
-static int i915_gem_flushing_info(struct seq_file *m, void *data)
+static int i915_gem_object_list_info(struct seq_file *m, void *data)
{
struct drm_info_node *node = (struct drm_info_node *) m->private;
+ uintptr_t list = (uintptr_t) node->info_ent->data;
+ struct list_head *head;
struct drm_device *dev = node->minor->dev;
drm_i915_private_t *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj_priv;
- seq_printf(m, "Flushing:\n");
- list_for_each_entry(obj_priv, &dev_priv->mm.flushing_list,
- list)
- {
- struct drm_gem_object *obj = obj_priv->obj;
- if (obj->name) {
- seq_printf(m, " %p(%d): %08x %08x %d\n",
- obj, obj->name,
- obj->read_domains, obj->write_domain,
- obj_priv->last_rendering_seqno);
- } else {
- seq_printf(m, " %p: %08x %08x %d\n", obj,
- obj->read_domains, obj->write_domain,
- obj_priv->last_rendering_seqno);
- }
+ switch (list) {
+ case ACTIVE_LIST:
+ seq_printf(m, "Active:\n");
+ head = &dev_priv->mm.active_list;
+ break;
+ case INACTIVE_LIST:
+ seq_printf(m, "Inctive:\n");
+ head = &dev_priv->mm.inactive_list;
+ break;
+ case FLUSHING_LIST:
+ seq_printf(m, "Flushing:\n");
+ head = &dev_priv->mm.flushing_list;
+ break;
+ default:
+ DRM_INFO("Ooops, unexpected list\n");
+ return 0;
}
- return 0;
-}
-static int i915_gem_inactive_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;
- drm_i915_private_t *dev_priv = dev->dev_private;
- struct drm_i915_gem_object *obj_priv;
-
- seq_printf(m, "Inactive:\n");
- list_for_each_entry(obj_priv, &dev_priv->mm.inactive_list,
- list)
+ list_for_each_entry(obj_priv, head, list)
{
struct drm_gem_object *obj = obj_priv->obj;
if (obj->name) {
@@ -108,7 +77,8 @@ static int i915_gem_inactive_info(struct seq_file *m, void *data)
obj->read_domains, obj->write_domain,
obj_priv->last_rendering_seqno);
} else {
- seq_printf(m, " %p: %08x %08x %d\n", obj,
+ seq_printf(m, " %p: %08x %08x %d\n",
+ obj,
obj->read_domains, obj->write_domain,
obj_priv->last_rendering_seqno);
}
@@ -203,9 +173,9 @@ static int i915_hws_info(struct seq_file *m, void *data)
}
static struct drm_info_list i915_gem_debugfs_list[] = {
- {"i915_gem_active", i915_gem_active_info, 0},
- {"i915_gem_flushing", i915_gem_flushing_info, 0},
- {"i915_gem_inactive", i915_gem_inactive_info, 0},
+ {"i915_gem_active", i915_gem_object_list_info, 0, (void *) ACTIVE_LIST},
+ {"i915_gem_flushing", i915_gem_object_list_info, 0, (void *) FLUSHING_LIST},
+ {"i915_gem_inactive", i915_gem_object_list_info, 0, (void *) INACTIVE_LIST},
{"i915_gem_request", i915_gem_request_info, 0},
{"i915_gem_seqno", i915_gem_seqno_info, 0},
{"i915_gem_interrupt", i915_interrupt_info, 0},