[Intel-gfx] [PATCH] Move proc/debugfs info functions into separate files

Ben Gamari bgamari at gmail.com
Thu Jan 15 01:27:42 CET 2009


---
 drivers/gpu/drm/Makefile      |    2 +-
 drivers/gpu/drm/drm_debugfs.c |   61 +-------
 drivers/gpu/drm/drm_info.c    |  351 +++++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_info.h    |   13 ++
 drivers/gpu/drm/drm_proc.c    |  314 +------------------------------------
 5 files changed, 367 insertions(+), 374 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_info.c
 create mode 100644 drivers/gpu/drm/drm_info.h

diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 2aeaf02..a473ed8 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -11,7 +11,7 @@ drm-y       :=	drm_auth.o drm_bufs.o drm_cache.o \
 		drm_agpsupport.o drm_scatter.o ati_pcigart.o drm_pci.o \
 		drm_sysfs.o drm_hashtab.o drm_sman.o drm_mm.o \
 		drm_crtc.o drm_crtc_helper.o drm_modes.o drm_edid.o \
-		drm_debugfs.o
+		drm_debugfs.o drm_info.o
 
 drm-$(CONFIG_COMPAT) += drm_ioc32.o
 
diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index 1e52da8..e6f0725 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -1,69 +1,10 @@
 #include <linux/debugfs.h>
 #include <linux/seq_file.h>
 #include "drmP.h"
+#include "drm_info.h"
 
 #if defined(CONFIG_DRM_DEBUGFS)
 
-#if DRM_DEBUG_CODE
-
-static int drm__vma_info(struct seq_file *m, void *data)
-{
-	struct drm_minor *minor = (struct drm_minor *) m->private;
-	struct drm_device *dev = minor->dev;
-	struct drm_vma_entry *pt;
-	struct vm_area_struct *vma;
-#if defined(__i386__)
-	unsigned int pgprot;
-#endif
-
-	seq_printf(m, "vma use count: %d, high_memory = %p, 0x%08lx\n",
-		   atomic_read(&dev->vma_count),
-		   high_memory, virt_to_phys(high_memory));
-	list_for_each_entry(pt, &dev->vmalist, head) {
-		if (!(vma = pt->vma))
-			continue;
-		seq_printf(m,
-			   "\n%5d 0x%08lx-0x%08lx %c%c%c%c%c%c 0x%08lx000",
-			   pt->pid, vma->vm_start, vma->vm_end,
-			   vma->vm_flags & VM_READ ? 'r' : '-',
-			   vma->vm_flags & VM_WRITE ? 'w' : '-',
-			   vma->vm_flags & VM_EXEC ? 'x' : '-',
-			   vma->vm_flags & VM_MAYSHARE ? 's' : 'p',
-			   vma->vm_flags & VM_LOCKED ? 'l' : '-',
-			   vma->vm_flags & VM_IO ? 'i' : '-',
-			   vma->vm_pgoff);
-
-#if defined(__i386__)
-		pgprot = pgprot_val(vma->vm_page_prot);
-		seq_printf(m, " %c%c%c%c%c%c%c%c%c",
-			   pgprot & _PAGE_PRESENT ? 'p' : '-',
-			   pgprot & _PAGE_RW ? 'w' : 'r',
-			   pgprot & _PAGE_USER ? 'u' : 's',
-			   pgprot & _PAGE_PWT ? 't' : 'b',
-			   pgprot & _PAGE_PCD ? 'u' : 'c',
-			   pgprot & _PAGE_ACCESSED ? 'a' : '-',
-			   pgprot & _PAGE_DIRTY ? 'd' : '-',
-			   pgprot & _PAGE_PSE ? 'm' : 'k',
-			   pgprot & _PAGE_GLOBAL ? 'g' : 'l');
-#endif
-		seq_printf(m, "\n");
-	}
-	return 0;
-}
-
-static int drm_vma_info(struct seq_file *m, void *data)
-{
-	struct drm_minor *minor = (struct drm_minor *) m->private;
-	struct drm_device *dev = minor->dev;
-	int ret;
-
-	mutex_lock(&dev->struct_mutex);
-	ret = drm__vma_info(m, data);
-	mutex_unlock(&dev->struct_mutex);
-	return ret;
-}
-#endif
-
 /***************************************************
  * Initialization, etc.
  **************************************************/
diff --git a/drivers/gpu/drm/drm_info.c b/drivers/gpu/drm/drm_info.c
new file mode 100644
index 0000000..fbc300f
--- /dev/null
+++ b/drivers/gpu/drm/drm_info.c
@@ -0,0 +1,351 @@
+#include <linux/seq_file.h>
+#include "drmP.h"
+#include "drm_info.h"
+
+/**
+ * Called when "/proc/dri/.../name" is read.
+ *
+ * Prints the device name together with the bus id if available.
+ */
+int drm_name_info(struct seq_file *m, void *data)
+{
+	struct drm_minor *minor = (struct drm_minor *) m->private;
+	struct drm_master *master = minor->master;
+	struct drm_device *dev = minor->dev;
+
+	if (!master)
+		return 0;
+
+	if (master->unique) {
+		seq_printf(m, "%s %s %s\n",
+				dev->driver->pci_driver.name,
+				pci_name(dev->pdev), master->unique);
+	} else {
+		seq_printf(m, "%s %s\n", dev->driver->pci_driver.name,
+				pci_name(dev->pdev));
+	}
+
+	return 0;
+}
+
+/**
+ * Called when "/proc/dri/.../vm" is read.
+ *
+ * Prints information about all mappings in drm_device::maplist.
+ */
+static void drm__vm_info(struct seq_file *m, void *data)
+{
+	struct drm_minor *minor = (struct drm_minor *) m->private;
+	struct drm_device *dev = minor->dev;
+	struct drm_map *map;
+	struct drm_map_list *r_list;
+
+	/* Hardcoded from _DRM_FRAME_BUFFER,
+	   _DRM_REGISTERS, _DRM_SHM, _DRM_AGP, and
+	   _DRM_SCATTER_GATHER and _DRM_CONSISTENT */
+	const char *types[] = { "FB", "REG", "SHM", "AGP", "SG", "PCI" };
+	const char *type;
+	int i;
+
+	seq_printf(m, "slot	 offset	      size type flags	 address mtrr\n\n");
+	i = 0;
+	list_for_each_entry(r_list, &dev->maplist, head) {
+		map = r_list->map;
+		if (!map)
+			continue;
+		if (map->type < 0 || map->type > 5)
+			type = "??";
+		else
+			type = types[map->type];
+
+		seq_printf(m, "%4d 0x%08lx 0x%08lx %4.4s  0x%02x 0x%08lx ",
+				i,
+				map->offset,
+				map->size, type, map->flags,
+				(unsigned long) r_list->user_token);
+		if (map->mtrr < 0) {
+			seq_printf(m, "none\n");
+		} else {
+			seq_printf(m, "%4d\n", map->mtrr);
+		}
+		i++;
+	}
+}
+
+/**
+ * Simply calls _vm_info() while holding the drm_device::struct_mutex lock.
+ */
+int drm_vm_info(struct seq_file *m, void *data)
+{
+	struct drm_minor *minor = (struct drm_minor *) m->private;
+	struct drm_device *dev = minor->dev;
+
+	mutex_lock(&dev->struct_mutex);
+	drm__vm_info(m, data);
+	mutex_unlock(&dev->struct_mutex);
+	return 0;
+}
+
+/**
+ * Called when "/proc/dri/.../queues" is read.
+ */
+static void drm__queues_info(struct seq_file *m, void *data)
+{
+	struct drm_minor *minor = (struct drm_minor *) m->private;
+	struct drm_device *dev = minor->dev;
+	int i;
+	struct drm_queue *q;
+
+	seq_printf(m, "  ctx/flags   use   fin"
+			"   blk/rw/rwf  wait    flushed	   queued"
+			"      locks\n\n");
+	for (i = 0; i < dev->queue_count; i++) {
+		q = dev->queuelist[i];
+		atomic_inc(&q->use_count);
+		seq_printf(m,   "%5d/0x%03x %5d %5d"
+				" %5d/%c%c/%c%c%c %5Zd\n",
+				i,
+				q->flags,
+				atomic_read(&q->use_count),
+				atomic_read(&q->finalization),
+				atomic_read(&q->block_count),
+				atomic_read(&q->block_read) ? 'r' : '-',
+				atomic_read(&q->block_write) ? 'w' : '-',
+				waitqueue_active(&q->read_queue) ? 'r' : '-',
+				waitqueue_active(&q->write_queue) ? 'w' : '-',
+				waitqueue_active(&q->flush_queue) ? 'f' : '-',
+				DRM_BUFCOUNT(&q->waitlist));
+		atomic_dec(&q->use_count);
+	}
+}
+
+/**
+ * Simply calls _queues_info() while holding the drm_device::struct_mutex lock.
+ */
+int drm_queues_info(struct seq_file *m, void *data)
+{
+	struct drm_minor *minor = (struct drm_minor *) m->private;
+	struct drm_device *dev = minor->dev;
+
+	mutex_lock(&dev->struct_mutex);
+	drm__queues_info(m, data);
+	mutex_unlock(&dev->struct_mutex);
+	return 0;
+}
+
+/**
+ * Called when "/proc/dri/.../bufs" is read.
+ */
+static void drm__bufs_info(struct seq_file *m, void *data)
+{
+	struct drm_minor *minor = (struct drm_minor *) m->private;
+	struct drm_device *dev = minor->dev;
+	struct drm_device_dma *dma = dev->dma;
+	int i;
+
+	if (!dma)
+		return;
+
+	seq_printf(m, " o     size count  free	 segs pages    kB\n\n");
+	for (i = 0; i <= DRM_MAX_ORDER; i++) {
+		if (dma->bufs[i].buf_count)
+			seq_printf(m, "%2d %8d %5d %5d %5d %5d %5ld\n",
+					i,
+					dma->bufs[i].buf_size,
+					dma->bufs[i].buf_count,
+					atomic_read(&dma->bufs[i].freelist.count),
+					dma->bufs[i].seg_count,
+					dma->bufs[i].seg_count * (1 << dma->bufs[i].page_order),
+					(dma->bufs[i].seg_count * (1 << dma->bufs[i].page_order))
+					* PAGE_SIZE / 1024);
+	}
+	seq_printf(m, "\n");
+	for (i = 0; i < dma->buf_count; i++) {
+		if (i && !(i % 32))
+			seq_printf(m, "\n");
+		seq_printf(m, " %d", dma->buflist[i]->list);
+	}
+	seq_printf(m, "\n");
+}
+
+/**
+ * Simply calls _bufs_info() while holding the drm_device::struct_mutex lock.
+ */
+int drm_bufs_info(struct seq_file *m, void *data)
+{
+	struct drm_minor *minor = (struct drm_minor *) m->private;
+	struct drm_device *dev = minor->dev;
+
+	mutex_lock(&dev->struct_mutex);
+	drm__bufs_info(m, data);
+	mutex_unlock(&dev->struct_mutex);
+	return 0;
+}
+
+/**
+ * Called when "/proc/dri/.../vblank" is read.
+ */
+static void drm__vblank_info(struct seq_file *m, void *data)
+{
+	struct drm_minor *minor = (struct drm_minor *) data;
+	struct drm_device *dev = minor->dev;
+	int crtc;
+
+	for (crtc = 0; crtc < dev->num_crtcs; crtc++) {
+		seq_printf(m, "CRTC %d enable:     %d\n",
+			       crtc, atomic_read(&dev->vblank_refcount[crtc]));
+		seq_printf(m, "CRTC %d counter:    %d\n",
+			       crtc, drm_vblank_count(dev, crtc));
+		seq_printf(m, "CRTC %d last wait:  %d\n",
+			       crtc, dev->last_vblank_wait[crtc]);
+		seq_printf(m, "CRTC %d in modeset: %d\n",
+			       crtc, dev->vblank_inmodeset[crtc]);
+	}
+}
+
+/**
+ * Simply calls _vblank_info() while holding the drm_device::struct_mutex lock.
+ */
+int drm_vblank_info(struct seq_file *m, void *data)
+{
+	struct drm_minor *minor = (struct drm_minor *) data;
+	struct drm_device *dev = minor->dev;
+
+	mutex_lock(&dev->struct_mutex);
+	drm__vblank_info(m, data);
+	mutex_unlock(&dev->struct_mutex);
+	return 0;
+}
+
+/**
+ * Called when "/proc/dri/.../clients" is read.
+ *
+ */
+static void drm__clients_info(struct seq_file *m, void *data)
+{
+	struct drm_minor *minor = (struct drm_minor *) m->private;
+	struct drm_device *dev = minor->dev;
+	struct drm_file *priv;
+
+	seq_printf(m, "a dev	pid    uid	magic	  ioctls\n\n");
+	list_for_each_entry(priv, &dev->filelist, lhead) {
+		seq_printf(m, "%c %3d %5d %5d %10u %10lu\n",
+				priv->authenticated ? 'y' : 'n',
+				priv->minor->index,
+				priv->pid,
+				priv->uid, priv->magic, priv->ioctl_count);
+	}
+}
+
+/**
+ * Simply calls _clients_info() while holding the drm_device::struct_mutex lock.
+ */
+int drm_clients_info(struct seq_file *m, void* data)
+{
+	struct drm_minor *minor = (struct drm_minor *) m->private;
+	struct drm_device *dev = minor->dev;
+
+	mutex_lock(&dev->struct_mutex);
+	drm__clients_info(m, data);
+	mutex_unlock(&dev->struct_mutex);
+	return 0;
+}
+
+static int drm_gem_one_name_info(int id, void *ptr, void *data)
+{
+	struct drm_gem_object *obj = ptr;
+	struct seq_file *m = data;
+
+	seq_printf(m, "name %d size %zd\n", obj->name, obj->size);
+
+	seq_printf(m, "%6d %8zd %7d %8d\n",
+			obj->name, obj->size,
+			atomic_read(&obj->handlecount.refcount),
+			atomic_read(&obj->refcount.refcount));
+	return 0;
+}
+
+int drm_gem_name_info(struct seq_file *m, void *data)
+{
+	struct drm_minor *minor = (struct drm_minor *) m->private;
+	struct drm_device *dev = minor->dev;
+
+	seq_printf(m, "  name     size handles refcount\n");
+	idr_for_each(&dev->object_name_idr, drm_gem_one_name_info, m);
+	return 0;
+}
+
+int drm_gem_object_info(struct seq_file *m, void* data)
+{
+	struct drm_minor *minor = (struct drm_minor *) m->private;
+	struct drm_device *dev = minor->dev;
+
+	seq_printf(m, "%d objects\n", atomic_read(&dev->object_count));
+	seq_printf(m, "%d object bytes\n", atomic_read(&dev->object_memory));
+	seq_printf(m, "%d pinned\n", atomic_read(&dev->pin_count));
+	seq_printf(m, "%d pin bytes\n", atomic_read(&dev->pin_memory));
+	seq_printf(m, "%d gtt bytes\n", atomic_read(&dev->gtt_memory));
+	seq_printf(m, "%d gtt total\n", dev->gtt_total);
+	return 0;
+}
+
+#if DRM_DEBUG_CODE
+
+static int drm__vma_info(struct seq_file *m, void *data)
+{
+	struct drm_minor *minor = (struct drm_minor *) m->private;
+	struct drm_device *dev = minor->dev;
+	struct drm_vma_entry *pt;
+	struct vm_area_struct *vma;
+#if defined(__i386__)
+	unsigned int pgprot;
+#endif
+
+	seq_printf(m, "vma use count: %d, high_memory = %p, 0x%08lx\n",
+		   atomic_read(&dev->vma_count),
+		   high_memory, virt_to_phys(high_memory));
+	list_for_each_entry(pt, &dev->vmalist, head) {
+		if (!(vma = pt->vma))
+			continue;
+		seq_printf(m,
+			   "\n%5d 0x%08lx-0x%08lx %c%c%c%c%c%c 0x%08lx000",
+			   pt->pid, vma->vm_start, vma->vm_end,
+			   vma->vm_flags & VM_READ ? 'r' : '-',
+			   vma->vm_flags & VM_WRITE ? 'w' : '-',
+			   vma->vm_flags & VM_EXEC ? 'x' : '-',
+			   vma->vm_flags & VM_MAYSHARE ? 's' : 'p',
+			   vma->vm_flags & VM_LOCKED ? 'l' : '-',
+			   vma->vm_flags & VM_IO ? 'i' : '-',
+			   vma->vm_pgoff);
+
+#if defined(__i386__)
+		pgprot = pgprot_val(vma->vm_page_prot);
+		seq_printf(m, " %c%c%c%c%c%c%c%c%c",
+			   pgprot & _PAGE_PRESENT ? 'p' : '-',
+			   pgprot & _PAGE_RW ? 'w' : 'r',
+			   pgprot & _PAGE_USER ? 'u' : 's',
+			   pgprot & _PAGE_PWT ? 't' : 'b',
+			   pgprot & _PAGE_PCD ? 'u' : 'c',
+			   pgprot & _PAGE_ACCESSED ? 'a' : '-',
+			   pgprot & _PAGE_DIRTY ? 'd' : '-',
+			   pgprot & _PAGE_PSE ? 'm' : 'k',
+			   pgprot & _PAGE_GLOBAL ? 'g' : 'l');
+#endif
+		seq_printf(m, "\n");
+	}
+	return 0;
+}
+
+int drm_vma_info(struct seq_file *m, void *data)
+{
+	struct drm_minor *minor = (struct drm_minor *) m->private;
+	struct drm_device *dev = minor->dev;
+	int ret;
+
+	mutex_lock(&dev->struct_mutex);
+	ret = drm__vma_info(m, data);
+	mutex_unlock(&dev->struct_mutex);
+	return ret;
+}
+#endif
+
diff --git a/drivers/gpu/drm/drm_info.h b/drivers/gpu/drm/drm_info.h
new file mode 100644
index 0000000..c123291
--- /dev/null
+++ b/drivers/gpu/drm/drm_info.h
@@ -0,0 +1,13 @@
+int drm_name_info(struct seq_file *m, void *data);
+int drm_vm_info(struct seq_file *m, void *data);
+int drm_queues_info(struct seq_file *m, void *data);
+int drm_bufs_info(struct seq_file *m, void *data);
+int drm_vblank_info(struct seq_file *m, void *data);
+int drm_clients_info(struct seq_file *m, void* data);
+int drm_gem_name_info(struct seq_file *m, void *data);
+int drm_gem_object_info(struct seq_file *m, void* data);
+
+#if DRM_DEBUG_CODE
+int drm_vma_info(struct seq_file *m, void *data);
+#endif
+
diff --git a/drivers/gpu/drm/drm_proc.c b/drivers/gpu/drm/drm_proc.c
index b949e89..235ac29 100644
--- a/drivers/gpu/drm/drm_proc.c
+++ b/drivers/gpu/drm/drm_proc.c
@@ -39,319 +39,7 @@
 
 #include <linux/seq_file.h>
 #include "drmP.h"
-
-
-/**
- * Called when "/proc/dri/.../name" is read.
- *
- * Prints the device name together with the bus id if available.
- */
-static int drm_name_info(struct seq_file *m, void *data)
-{
-	struct drm_minor *minor = (struct drm_minor *) m->private;
-	struct drm_master *master = minor->master;
-	struct drm_device *dev = minor->dev;
-
-	if (!master)
-		return 0;
-
-	if (master->unique) {
-		seq_printf(m, "%s %s %s\n",
-				dev->driver->pci_driver.name,
-				pci_name(dev->pdev), master->unique);
-	} else {
-		seq_printf(m, "%s %s\n", dev->driver->pci_driver.name,
-				pci_name(dev->pdev));
-	}
-
-	return 0;
-}
-
-/**
- * Called when "/proc/dri/.../vm" is read.
- *
- * Prints information about all mappings in drm_device::maplist.
- */
-static void drm__vm_info(struct seq_file *m, void *data)
-{
-	struct drm_minor *minor = (struct drm_minor *) m->private;
-	struct drm_device *dev = minor->dev;
-	struct drm_map *map;
-	struct drm_map_list *r_list;
-
-	/* Hardcoded from _DRM_FRAME_BUFFER,
-	   _DRM_REGISTERS, _DRM_SHM, _DRM_AGP, and
-	   _DRM_SCATTER_GATHER and _DRM_CONSISTENT */
-	const char *types[] = { "FB", "REG", "SHM", "AGP", "SG", "PCI" };
-	const char *type;
-	int i;
-
-	seq_printf(m, "slot	 offset	      size type flags	 address mtrr\n\n");
-	i = 0;
-	list_for_each_entry(r_list, &dev->maplist, head) {
-		map = r_list->map;
-		if (!map)
-			continue;
-		if (map->type < 0 || map->type > 5)
-			type = "??";
-		else
-			type = types[map->type];
-
-		seq_printf(m, "%4d 0x%08lx 0x%08lx %4.4s  0x%02x 0x%08lx ",
-				i,
-				map->offset,
-				map->size, type, map->flags,
-				(unsigned long) r_list->user_token);
-		if (map->mtrr < 0) {
-			seq_printf(m, "none\n");
-		} else {
-			seq_printf(m, "%4d\n", map->mtrr);
-		}
-		i++;
-	}
-}
-
-/**
- * Simply calls _vm_info() while holding the drm_device::struct_mutex lock.
- */
-static int drm_vm_info(struct seq_file *m, void *data)
-{
-	struct drm_minor *minor = (struct drm_minor *) m->private;
-	struct drm_device *dev = minor->dev;
-
-	mutex_lock(&dev->struct_mutex);
-	drm__vm_info(m, data);
-	mutex_unlock(&dev->struct_mutex);
-	return 0;
-}
-
-/**
- * Called when "/proc/dri/.../queues" is read.
- */
-static void drm__queues_info(struct seq_file *m, void *data)
-{
-	struct drm_minor *minor = (struct drm_minor *) m->private;
-	struct drm_device *dev = minor->dev;
-	int i;
-	struct drm_queue *q;
-
-	seq_printf(m, "  ctx/flags   use   fin"
-			"   blk/rw/rwf  wait    flushed	   queued"
-			"      locks\n\n");
-	for (i = 0; i < dev->queue_count; i++) {
-		q = dev->queuelist[i];
-		atomic_inc(&q->use_count);
-		seq_printf(m,   "%5d/0x%03x %5d %5d"
-				" %5d/%c%c/%c%c%c %5Zd\n",
-				i,
-				q->flags,
-				atomic_read(&q->use_count),
-				atomic_read(&q->finalization),
-				atomic_read(&q->block_count),
-				atomic_read(&q->block_read) ? 'r' : '-',
-				atomic_read(&q->block_write) ? 'w' : '-',
-				waitqueue_active(&q->read_queue) ? 'r' : '-',
-				waitqueue_active(&q->write_queue) ? 'w' : '-',
-				waitqueue_active(&q->flush_queue) ? 'f' : '-',
-				DRM_BUFCOUNT(&q->waitlist));
-		atomic_dec(&q->use_count);
-	}
-}
-
-/**
- * Simply calls _queues_info() while holding the drm_device::struct_mutex lock.
- */
-static int drm_queues_info(struct seq_file *m, void *data)
-{
-	struct drm_minor *minor = (struct drm_minor *) m->private;
-	struct drm_device *dev = minor->dev;
-
-	mutex_lock(&dev->struct_mutex);
-	drm__queues_info(m, data);
-	mutex_unlock(&dev->struct_mutex);
-	return 0;
-}
-
-/**
- * Called when "/proc/dri/.../bufs" is read.
- */
-static void drm__bufs_info(struct seq_file *m, void *data)
-{
-	struct drm_minor *minor = (struct drm_minor *) m->private;
-	struct drm_device *dev = minor->dev;
-	struct drm_device_dma *dma = dev->dma;
-	int i;
-
-	if (!dma)
-		return;
-
-	seq_printf(m, " o     size count  free	 segs pages    kB\n\n");
-	for (i = 0; i <= DRM_MAX_ORDER; i++) {
-		if (dma->bufs[i].buf_count)
-			seq_printf(m, "%2d %8d %5d %5d %5d %5d %5ld\n",
-					i,
-					dma->bufs[i].buf_size,
-					dma->bufs[i].buf_count,
-					atomic_read(&dma->bufs[i].freelist.count),
-					dma->bufs[i].seg_count,
-					dma->bufs[i].seg_count * (1 << dma->bufs[i].page_order),
-					(dma->bufs[i].seg_count * (1 << dma->bufs[i].page_order))
-					* PAGE_SIZE / 1024);
-	}
-	seq_printf(m, "\n");
-	for (i = 0; i < dma->buf_count; i++) {
-		if (i && !(i % 32))
-			seq_printf(m, "\n");
-		seq_printf(m, " %d", dma->buflist[i]->list);
-	}
-	seq_printf(m, "\n");
-}
-
-/**
- * Simply calls _bufs_info() while holding the drm_device::struct_mutex lock.
- */
-static int drm_bufs_info(struct seq_file *m, void *data)
-{
-	struct drm_minor *minor = (struct drm_minor *) m->private;
-	struct drm_device *dev = minor->dev;
-
-	mutex_lock(&dev->struct_mutex);
-	drm__bufs_info(m, data);
-	mutex_unlock(&dev->struct_mutex);
-	return 0;
-}
-
-/**
- * Called when "/proc/dri/.../vblank" is read.
- *
- * \param buf output buffer.
- * \param start start of output data.
- * \param offset requested start offset.
- * \param request requested number of bytes.
- * \param eof whether there is no more data to return.
- * \param data private data.
- * \return number of written bytes.
- */
-static int drm__vblank_info(char *buf, char **start, off_t offset, int request,
-			  int *eof, void *data)
-{
-	struct drm_minor *minor = (struct drm_minor *) data;
-	struct drm_device *dev = minor->dev;
-	int len = 0;
-	int crtc;
-
-	if (offset > DRM_PROC_LIMIT) {
-		*eof = 1;
-		return 0;
-	}
-
-	*start = &buf[offset];
-	*eof = 0;
-
-	for (crtc = 0; crtc < dev->num_crtcs; crtc++) {
-		DRM_PROC_PRINT("CRTC %d enable:     %d\n",
-			       crtc, atomic_read(&dev->vblank_refcount[crtc]));
-		DRM_PROC_PRINT("CRTC %d counter:    %d\n",
-			       crtc, drm_vblank_count(dev, crtc));
-		DRM_PROC_PRINT("CRTC %d last wait:  %d\n",
-			       crtc, dev->last_vblank_wait[crtc]);
-		DRM_PROC_PRINT("CRTC %d in modeset: %d\n",
-			       crtc, dev->vblank_inmodeset[crtc]);
-	}
-
-	if (len > request + offset)
-		return request;
-	*eof = 1;
-	return len - offset;
-}
-
-/**
- * Simply calls _vblank_info() while holding the drm_device::struct_mutex lock.
- */
-static int drm_vblank_info(char *buf, char **start, off_t offset, int request,
-			 int *eof, void *data)
-{
-	struct drm_minor *minor = (struct drm_minor *) data;
-	struct drm_device *dev = minor->dev;
-	int ret;
-
-	mutex_lock(&dev->struct_mutex);
-	ret = drm__vblank_info(buf, start, offset, request, eof, data);
-	mutex_unlock(&dev->struct_mutex);
-	return ret;
-}
-
-/**
- * Called when "/proc/dri/.../clients" is read.
- *
- */
-static void drm__clients_info(struct seq_file *m, void *data)
-{
-	struct drm_minor *minor = (struct drm_minor *) m->private;
-	struct drm_device *dev = minor->dev;
-	struct drm_file *priv;
-
-	seq_printf(m, "a dev	pid    uid	magic	  ioctls\n\n");
-	list_for_each_entry(priv, &dev->filelist, lhead) {
-		seq_printf(m, "%c %3d %5d %5d %10u %10lu\n",
-				priv->authenticated ? 'y' : 'n',
-				priv->minor->index,
-				priv->pid,
-				priv->uid, priv->magic, priv->ioctl_count);
-	}
-}
-
-/**
- * Simply calls _clients_info() while holding the drm_device::struct_mutex lock.
- */
-static int drm_clients_info(struct seq_file *m, void* data)
-{
-	struct drm_minor *minor = (struct drm_minor *) m->private;
-	struct drm_device *dev = minor->dev;
-
-	mutex_lock(&dev->struct_mutex);
-	drm__clients_info(m, data);
-	mutex_unlock(&dev->struct_mutex);
-	return 0;
-}
-
-static int drm_gem_one_name_info(int id, void *ptr, void *data)
-{
-	struct drm_gem_object *obj = ptr;
-	struct seq_file *m = data;
-
-	seq_printf(m, "name %d size %zd\n", obj->name, obj->size);
-
-	seq_printf(m, "%6d %8zd %7d %8d\n",
-			obj->name, obj->size,
-			atomic_read(&obj->handlecount.refcount),
-			atomic_read(&obj->refcount.refcount));
-	return 0;
-}
-
-static int drm_gem_name_info(struct seq_file *m, void *data)
-{
-	struct drm_minor *minor = (struct drm_minor *) m->private;
-	struct drm_device *dev = minor->dev;
-
-	seq_printf(m, "  name     size handles refcount\n");
-	idr_for_each(&dev->object_name_idr, drm_gem_one_name_info, m);
-	return 0;
-}
-
-static int drm_gem_object_info(struct seq_file *m, void* data)
-{
-	struct drm_minor *minor = (struct drm_minor *) m->private;
-	struct drm_device *dev = minor->dev;
-
-	seq_printf(m, "%d objects\n", atomic_read(&dev->object_count));
-	seq_printf(m, "%d object bytes\n", atomic_read(&dev->object_memory));
-	seq_printf(m, "%d pinned\n", atomic_read(&dev->pin_count));
-	seq_printf(m, "%d pin bytes\n", atomic_read(&dev->pin_memory));
-	seq_printf(m, "%d gtt bytes\n", atomic_read(&dev->gtt_memory));
-	seq_printf(m, "%d gtt total\n", dev->gtt_total);
-	return 0;
-}
+#include "drm_info.h"
 
 
 /***************************************************
-- 
1.6.0.6




More information about the Intel-gfx mailing list