Re: 2.6.34-rc5: Reported regressions from 2.6.33

2010-04-21 Thread Ben Gamari
On Tue, 20 Apr 2010 05:15:57 +0200 (CEST), Rafael J. Wysocki r...@sisk.pl 
wrote:
 This message contains a list of some regressions from 2.6.33,
 for which there are no fixes in the mainline known to the tracking team.
 If any of them have been fixed already, please let us know.
 
 If you know of any other unresolved regressions from 2.6.33, please let us
 know either and we'll add them to the list.  Also, please let us know
 if any of the entries below are invalid.
 

I have recently reported this suspend regression on my Dell laptop hardware.

References: http://lkml.org/lkml/2010/4/18/20
Bug-report: https://bugzilla.kernel.org/show_bug.cgi?id=15820

Thanks,

- Ben

--
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


Re: [linux-pm] [PATH] i915: Read outside array bounds

2009-07-28 Thread Ben Gamari
On Tue, Jul 28, 2009 at 02:50:03PM -0700, Andrew Morton wrote:
 (cc jbarnes)
 
 This looks rather correct and the original code looked rather wrong.
 
 Someone please tell me that this might fix one of our splendid number
 of i915 bugs :(
 
Unfortunately, according to the docs we were just scribbling over
reserved regions. It seems possible but unlikely that this would cause
any major issues. Never know though.

- Ben

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH 2/3] Move i915 proc files to seq_file

2009-02-17 Thread Ben Gamari
This patch ports the i915 proc files to use the seq_file interface.
Also, we move these files into debugfs.

Signed-off-by: Ben Gamari bgam...@gmail.com
---
 drivers/gpu/drm/i915/Makefile   |2 +-
 drivers/gpu/drm/i915/i915_drv.c |6 +-
 drivers/gpu/drm/i915/i915_drv.h |6 +-
 drivers/gpu/drm/i915/i915_gem_debugfs.c |  202 +++
 drivers/gpu/drm/i915/i915_gem_proc.c|  334 ---
 5 files changed, 211 insertions(+), 339 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/i915_gem_debugfs.c
 delete mode 100644 drivers/gpu/drm/i915/i915_gem_proc.c

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 793cba3..51c5a05 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -7,7 +7,7 @@ i915-y := i915_drv.o i915_dma.o i915_irq.o i915_mem.o \
   i915_suspend.o \
  i915_gem.o \
  i915_gem_debug.o \
- i915_gem_proc.o \
+ i915_gem_debugfs.o \
  i915_gem_tiling.o \
  intel_display.o \
  intel_crt.o \
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index a31cbdb..9cf8937 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -125,8 +125,10 @@ static struct drm_driver driver = {
.get_reg_ofs = drm_core_get_reg_ofs,
.master_create = i915_master_create,
.master_destroy = i915_master_destroy,
-   .proc_init = i915_gem_proc_init,
-   .proc_cleanup = i915_gem_proc_cleanup,
+#if defined(CONFIG_DEBUG_FS)
+   .debugfs_init = i915_gem_debugfs_init,
+   .debugfs_cleanup = i915_gem_debugfs_cleanup,
+#endif
.gem_init_object = i915_gem_init_object,
.gem_free_object = i915_gem_free_object,
.gem_vm_ops = i915_gem_vm_ops,
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 135a08f..04361a1 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -599,8 +599,6 @@ int i915_gem_get_tiling(struct drm_device *dev, void *data,
 int i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv);
 void i915_gem_load(struct drm_device *dev);
-int i915_gem_proc_init(struct drm_minor *minor);
-void i915_gem_proc_cleanup(struct drm_minor *minor);
 int i915_gem_init_object(struct drm_gem_object *obj);
 void i915_gem_free_object(struct drm_gem_object *obj);
 int i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment);
@@ -643,6 +641,10 @@ void i915_gem_dump_object(struct drm_gem_object *obj, int 
len,
  const char *where, uint32_t mark);
 void i915_dump_lru(struct drm_device *dev, const char *where);
 
+/* i915_debugfs.c */
+int i915_gem_debugfs_init(struct drm_minor *minor);
+void i915_gem_debugfs_cleanup(struct drm_minor *minor);
+
 /* i915_suspend.c */
 extern int i915_save_state(struct drm_device *dev);
 extern int i915_restore_state(struct drm_device *dev);
diff --git a/drivers/gpu/drm/i915/i915_gem_debugfs.c 
b/drivers/gpu/drm/i915/i915_gem_debugfs.c
new file mode 100644
index 000..7ad49d7
--- /dev/null
+++ b/drivers/gpu/drm/i915/i915_gem_debugfs.c
@@ -0,0 +1,202 @@
+#include linux/seq_file.h
+#include drmP.h
+#include drm.h
+#include i915_drm.h
+#include i915_drv.h
+
+#define DRM_I915_RING_DEBUG 1
+
+
+#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;
+}
+
+static int i915_gem_flushing_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, Flushing:\n);
+   list_for_each_entry(obj_priv, dev_priv-mm.flushing_list,
+   list

[PATCH 1/3] Convert proc files to seq_file and introduce debugfs

2009-02-17 Thread Ben Gamari
The old mechanism to formatting proc files is extremely ugly. The
seq_file API was designed specifically for cases like this and greatly
simplifies the process.

Also, most of the files in /proc really don't belong there. This patch
introduces the infrastructure for putting these into debugfs and exposes
all of the proc files in debugfs as well.

Signed-off-by: Ben Gamari bgam...@gmail.com
---
 drivers/gpu/drm/Makefile  |3 +-
 drivers/gpu/drm/drm_debugfs.c |  242 ++
 drivers/gpu/drm/drm_drv.c |   12 +-
 drivers/gpu/drm/drm_info.c|  325 +++
 drivers/gpu/drm/drm_proc.c|  719 ++---
 drivers/gpu/drm/drm_stub.c|   15 +-
 include/drm/drmP.h|   77 +-
 7 files changed, 777 insertions(+), 616 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_debugfs.c
 create mode 100644 drivers/gpu/drm/drm_info.c

diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 30022c4..4ec5061 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -10,7 +10,8 @@ drm-y   :=drm_auth.o drm_bufs.o drm_cache.o \
drm_lock.o drm_memory.o drm_proc.o drm_stub.o drm_vm.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_crtc.o drm_crtc_helper.o drm_modes.o drm_edid.o \
+   drm_info.o drm_debugfs.o
 
 drm-$(CONFIG_COMPAT) += drm_ioc32.o
 
diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
new file mode 100644
index 000..5efcaac
--- /dev/null
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -0,0 +1,242 @@
+/**
+ * \file drm_debugfs.c
+ * debugfs support for DRM
+ *
+ * \author Ben Gamari bgam...@gmail.com
+ */
+
+/*
+ * Created: Sun Dec 21 13:08:50 2008 by bgam...@gmail.com
+ *
+ * Copyright 2008 Ben Gamari bgam...@gmail.com
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the Software),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include linux/debugfs.h
+#include linux/seq_file.h
+#include drmP.h
+
+#if defined(CONFIG_DEBUG_FS)
+
+/***
+ * Initialization, etc.
+ **/
+
+static struct drm_info_list drm_debugfs_list[] = {
+   {name, drm_name_info, 0},
+   {vm, drm_vm_info, 0},
+   {clients, drm_clients_info, 0},
+   {queues, drm_queues_info, 0},
+   {bufs, drm_bufs_info, 0},
+   {gem_names, drm_gem_name_info, DRIVER_GEM},
+   {gem_objects, drm_gem_object_info, DRIVER_GEM},
+#if DRM_DEBUG_CODE
+   {vma, drm_vma_info, 0},
+#endif
+};
+#define DRM_DEBUGFS_ENTRIES ARRAY_SIZE(drm_debugfs_list)
+
+
+static int drm_debugfs_open(struct inode *inode, struct file *file)
+{
+   struct drm_info_node *node =
+   (struct drm_info_node *) inode-i_private;
+
+   return single_open(file, node-info_ent-show, node);
+}
+
+
+static const struct file_operations drm_debugfs_fops = {
+   .owner = THIS_MODULE,
+   .open = drm_debugfs_open,
+   .read = seq_read,
+   .llseek = seq_lseek,
+   .release = single_release,
+};
+
+
+/**
+ * Initialize a given set of debugfs files for a device
+ *
+ * \param files The array of files to create
+ * \param count The number of files given
+ * \param root DRI debugfs dir entry.
+ * \param minor device minor number
+ * \return Zero on success, non-zero on failure
+ *
+ * Create a given set of debugfs files represented by an array of
+ * gdm_debugfs_lists in the given root directory.
+ */
+int drm_debugfs_create_files(struct drm_info_list *files, int count,
+struct dentry *root, struct drm_minor *minor)
+{
+   struct drm_device *dev = minor-dev;
+   struct dentry *ent;
+   struct drm_info_node *tmp;
+   char name[64];
+   int i, ret;
+
+   for (i = 0

[PATCH final] DRM proc file handling rework

2009-02-17 Thread Ben Gamari

Hey all, 

Hopefully this will be the last time I pollute the lists with this patchset.
From the look of the diffstat, this cleanup went pretty well. We managed to
introduce support for debugfs while both eliminating large portions of code and
standardizing the interface for drm proc/debugfs file management. I have had no
stability issues in my testing and everything should now have the appropriate
signed-off-by tags. Thanks again to everyone who has helped with review and
feedback on this code,

- Ben


 drivers/gpu/drm/Makefile|3 +-
 drivers/gpu/drm/drm_debugfs.c   |  242 +++
 drivers/gpu/drm/drm_drv.c   |   12 +-
 drivers/gpu/drm/drm_info.c  |  325 ++
 drivers/gpu/drm/drm_proc.c  |  719 +--
 drivers/gpu/drm/drm_stub.c  |   15 +-
 drivers/gpu/drm/i915/Makefile   |2 +-
 drivers/gpu/drm/i915/i915_drv.c |6 +-
 drivers/gpu/drm/i915/i915_drv.h |6 +-
 drivers/gpu/drm/i915/i915_gem_debugfs.c |  170 
 drivers/gpu/drm/i915/i915_gem_proc.c|  334 --
 include/drm/drmP.h  |   77 -
 12 files changed, 956 insertions(+), 955 deletions(-)

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH 3/3] Consolidate gem object list dumping

2009-02-17 Thread Ben Gamari
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 bgam...@gmail.com
---
 drivers/gpu/drm/i915/i915_gem_debugfs.c |   84 ++-
 1 files changed, 26 insertions(+), 58 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_debugfs.c 
b/drivers/gpu/drm/i915/i915_gem_debugfs.c
index 7ad49d7..9928df4 100644
--- a/drivers/gpu/drm/i915/i915_gem_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_gem_debugfs.c
@@ -9,69 +9,36 @@
 
 #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;
+#define ACTIVE_LIST1
+#define FLUSHING_LIST  2
+#define INACTIVE_LIST  3
 
-   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;
-}
-
-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:
+   head = dev_priv-mm.active_list;
+   break;
+   case INACTIVE_LIST:
+   head = dev_priv-mm.inactive_list;
+   break;
+   case FLUSHING_LIST:
+   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)
+   seq_printf(m, Active:\n);
+   list_for_each_entry(obj_priv, head, list)
{
struct drm_gem_object *obj = obj_priv-obj;
if (obj-name) {
@@ -80,7 +47,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);
}
@@ -177,9 +145,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

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

2009-01-14 Thread Ben Gamari
---
 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 2714479..fc03a45 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_DEBUG_FS)
 
-#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 000..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;
+   

[PATCH] Proc to debugfs migration

2009-01-14 Thread Ben Gamari

Hey everyone,

Here is my procfs cleanup patchset. As you can see, the first two 
patches attempt to clean up the existing proc file creation code and 
port the files' implementations to the seq_file interface. The remaining
patches focus on implementing a similar system for debugfs files.

Feedback has generally indicated that while removing drm information 
from /proc is a worthwhile goal, we need to provide a transition period
in which we can keep this information available in both debugfs and 
/proc. The refactoring with seq_file made this almost trivial, requiring
only that I move the file implementations to a combined file which both
the proc and debugfs code can link against. I declared these symbols in
a new header file (drm_info.h) and while I haven't seen any precedent 
for this in the drm code, I did want to keep from lengthening drmP.h any
more than it already is, especially given these symbols are only 
referred to in two places. It is my thought that eventually the proc 
file code will be pulled out anyways and we'll be able to merge 
drm_info.[ch] back into drm_debugfs.c. Let me know if anyone has an 
issue with this.

Anyways, I think most of it is pretty straightforward. Please pardon the
less-than-stellar organization of the patchset, I did my best to santize it
but rebasing while moving whole files around seems to be quite tedious. I
think that the patch set is pretty much ready for merge. I've been running it
for several weeks now without incident. Let me know what you think,

- Ben


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH] declare debugfs init/cleanup hooks

2009-01-14 Thread Ben Gamari
---
 drivers/gpu/drm/i915/i915_drv.h |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 9158a94..ff6f1e5 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -611,6 +611,10 @@ void i915_gem_dump_object(struct drm_gem_object *obj, int 
len,
  const char *where, uint32_t mark);
 void i915_dump_lru(struct drm_device *dev, const char *where);
 
+/* i915_debugfs.c */
+int i915_gem_debugfs_init(struct drm_minor *minor);
+void i915_gem_debugfs_cleanup(struct drm_minor *minor);
+
 /* i915_suspend.c */
 extern int i915_save_state(struct drm_device *dev);
 extern int i915_restore_state(struct drm_device *dev);
-- 
1.6.0.5


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH] add i915 debugfs implementation

2009-01-14 Thread Ben Gamari
Port old i915-specific proc file entries to debugfs
---
 drivers/gpu/drm/i915/Makefile   |1 +
 drivers/gpu/drm/i915/i915_drv.c |4 +
 drivers/gpu/drm/i915/i915_drv.h |4 +
 drivers/gpu/drm/i915/i915_gem_debugfs.c |  205 +++
 4 files changed, 214 insertions(+), 0 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/i915_gem_debugfs.c

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 6d037ca..5b3bd5e 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -7,6 +7,7 @@ i915-y := i915_drv.o i915_dma.o i915_irq.o i915_mem.o \
   i915_suspend.o \
  i915_gem.o \
  i915_gem_debug.o \
+ i915_gem_debugfs.o \
  i915_gem_tiling.o \
  intel_display.o \
  intel_crt.o \
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 8b85bd7..bb9ac66 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -124,6 +124,10 @@ static struct drm_driver driver = {
.get_reg_ofs = drm_core_get_reg_ofs,
.master_create = i915_master_create,
.master_destroy = i915_master_destroy,
+#if defined(CONFIG_DEBUG_FS)
+   .debugfs_init = i915_gem_debugfs_init,
+   .debugfs_cleanup = i915_gem_debugfs_cleanup,
+#endif
.gem_init_object = i915_gem_init_object,
.gem_free_object = i915_gem_free_object,
.gem_vm_ops = i915_gem_vm_ops,
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 8cad114..75ffa17 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -613,6 +613,10 @@ void i915_gem_dump_object(struct drm_gem_object *obj, int 
len,
  const char *where, uint32_t mark);
 void i915_dump_lru(struct drm_device *dev, const char *where);
 
+/* i915_debugfs.c */
+int i915_gem_debugfs_init(struct drm_minor *minor);
+void i915_gem_debugfs_cleanup(struct drm_minor *minor);
+
 /* i915_suspend.c */
 extern int i915_save_state(struct drm_device *dev);
 extern int i915_restore_state(struct drm_device *dev);
diff --git a/drivers/gpu/drm/i915/i915_gem_debugfs.c 
b/drivers/gpu/drm/i915/i915_gem_debugfs.c
new file mode 100644
index 000..ccc6d5f
--- /dev/null
+++ b/drivers/gpu/drm/i915/i915_gem_debugfs.c
@@ -0,0 +1,205 @@
+#include linux/seq_file.h
+#include drmP.h
+#include drm.h
+#include i915_drm.h
+#include i915_drv.h
+
+#define DRM_I915_RING_DEBUG 1
+
+
+#if defined(CONFIG_DEBUG_FS)
+
+static int i915_gem_active_info(struct seq_file *m, void *data)
+{
+   struct drm_minor *minor = (struct drm_minor *) m-private;
+   struct drm_device *dev = 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;
+}
+
+static int i915_gem_flushing_info(struct seq_file *m, void *data)
+{
+   struct drm_minor *minor = (struct drm_minor *) m-private;
+   struct drm_device *dev = 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);
+   }
+   }
+   return 0;
+}
+
+static int i915_gem_inactive_info(struct seq_file *m, void *data)
+{
+   struct drm_minor *minor = (struct drm_minor *) m-private;
+   struct drm_device *dev = minor-dev;
+   drm_i915_private_t *dev_priv = dev-dev_private;
+   struct 

[PATCH] add former proc files to debugfs as well

2009-01-14 Thread Ben Gamari
---
 drivers/gpu/drm/drm_debugfs.c |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index fc03a45..e523069 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -10,6 +10,14 @@
  **/
 
 static struct drm_debugfs_list drm_debugfs_list[] = {
+   {name, drm_name_info, 0},
+   /*{mem, drm_mem_info, 0},*/
+   {vm, drm_vm_info, 0},
+   {clients, drm_clients_info, 0},
+   {queues, drm_queues_info, 0},
+   {bufs, drm_bufs_info, 0},
+   {gem_names, drm_gem_name_info, DRIVER_GEM},
+   {gem_objects, drm_gem_object_info, DRIVER_GEM},
 #if DRM_DEBUG_CODE
{vma, drm_vma_info, 0},
 #endif
-- 
1.6.0.6


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH] remove i915 proc hooks

2009-01-14 Thread Ben Gamari
These are going into debugfs. There is no reason why they need to be in
proc.
---
 drivers/gpu/drm/i915/Makefile|1 -
 drivers/gpu/drm/i915/i915_drv.c  |2 -
 drivers/gpu/drm/i915/i915_drv.h  |2 -
 drivers/gpu/drm/i915/i915_gem_proc.c |  334 --
 4 files changed, 0 insertions(+), 339 deletions(-)
 delete mode 100644 drivers/gpu/drm/i915/i915_gem_proc.c

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index dd57a5b..6d037ca 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -7,7 +7,6 @@ i915-y := i915_drv.o i915_dma.o i915_irq.o i915_mem.o \
   i915_suspend.o \
  i915_gem.o \
  i915_gem_debug.o \
- i915_gem_proc.o \
  i915_gem_tiling.o \
  intel_display.o \
  intel_crt.o \
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index f8b3df0..8b85bd7 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -124,8 +124,6 @@ static struct drm_driver driver = {
.get_reg_ofs = drm_core_get_reg_ofs,
.master_create = i915_master_create,
.master_destroy = i915_master_destroy,
-   .proc_init = i915_gem_proc_init,
-   .proc_cleanup = i915_gem_proc_cleanup,
.gem_init_object = i915_gem_init_object,
.gem_free_object = i915_gem_free_object,
.gem_vm_ops = i915_gem_vm_ops,
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 4756e5c..8cad114 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -577,8 +577,6 @@ int i915_gem_get_tiling(struct drm_device *dev, void *data,
 int i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv);
 void i915_gem_load(struct drm_device *dev);
-int i915_gem_proc_init(struct drm_minor *minor);
-void i915_gem_proc_cleanup(struct drm_minor *minor);
 int i915_gem_init_object(struct drm_gem_object *obj);
 void i915_gem_free_object(struct drm_gem_object *obj);
 int i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment);
diff --git a/drivers/gpu/drm/i915/i915_gem_proc.c 
b/drivers/gpu/drm/i915/i915_gem_proc.c
deleted file mode 100644
index 4d1b9de..000
--- a/drivers/gpu/drm/i915/i915_gem_proc.c
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * Copyright © 2008 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the Software),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- *
- * Authors:
- *Eric Anholt e...@anholt.net
- *Keith Packard kei...@keithp.com
- *
- */
-
-#include drmP.h
-#include drm.h
-#include i915_drm.h
-#include i915_drv.h
-
-static int i915_gem_active_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;
-   drm_i915_private_t *dev_priv = dev-dev_private;
-   struct drm_i915_gem_object *obj_priv;
-   int len = 0;
-
-   if (offset  DRM_PROC_LIMIT) {
-   *eof = 1;
-   return 0;
-   }
-
-   *start = buf[offset];
-   *eof = 0;
-   DRM_PROC_PRINT(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) {
-   DRM_PROC_PRINT(%p(%d): %08x %08x %d\n,
-  obj, obj-name,
-  obj-read_domains, obj-write_domain,
-  obj_priv-last_rendering_seqno);
-   } else {
-   DRM_PROC_PRINT(   %p: %08x %08x %d\n,
-  obj,
-  obj-read_domains, obj-write_domain,
- 

[PATCH] add debugfs hooks to drm_driver struct

2009-01-14 Thread Ben Gamari
---
 include/drm/drmP.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 3f45fb7..c318736 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -765,6 +765,8 @@ struct drm_driver {
 
int (*proc_init)(struct drm_minor *minor);
void (*proc_cleanup)(struct drm_minor *minor);
+   int (*debugfs_init)(struct drm_minor *minor);
+   void (*debugfs_cleanup)(struct drm_minor *minor);
 
/**
 * Driver-specific constructor for drm_gem_objects, to set up
-- 
1.6.0.6


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH] add debugfs declarations

2009-01-14 Thread Ben Gamari
add drm_debugfs_node stuct, drm_debugfs_root, debugfs entries to
drm_minor. Also add debugfs function declarations
---
 include/drm/drmP.h |   36 
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index efa7935..3f45fb7 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -800,6 +800,27 @@ struct drm_driver {
 #define DRM_MINOR_CONTROL 2
 #define DRM_MINOR_RENDER 3
 
+
+/**
+ * debugfs node list. This structure represents a debugfs file to
+ * be created by the drm core
+ */
+struct drm_debugfs_list {
+const char *name; /** file name */
+int (*show)(struct seq_file*, void*); /** show callback*/
+u32 driver_features; /** Required driver features for this entry */
+};
+
+/**
+ * debugfs node structure. This structure represents a debugfs file.
+ */
+struct drm_debugfs_node {
+struct list_head list;
+struct drm_minor *minor;
+struct drm_debugfs_list *debugfs_ent;
+struct dentry *dent;  
+};
+
 /**
  * proc node list. This structure represents a debugfs file to
  * be created by the drm core
@@ -831,6 +852,8 @@ struct drm_minor {
 
struct proc_dir_entry *proc_root;  /** proc directory entry */
struct drm_proc_node proc_nodes;
+   struct dentry *debugfs_root;
+   struct drm_debugfs_node debugfs_nodes;
 
struct drm_master *master; /* currently active master for this node */
struct list_head master_list;
@@ -1289,6 +1312,7 @@ extern unsigned int drm_debug;
 
 extern struct class *drm_class;
 extern struct proc_dir_entry *drm_proc_root;
+extern struct dentry *drm_debugfs_root;
 
 extern struct idr drm_minors_idr;
 
@@ -1299,6 +1323,18 @@ extern int drm_proc_init(struct drm_minor *minor, int 
minor_id,
 struct proc_dir_entry *root);
 extern int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry 
*root);
 
+/* Debugfs support */
+#if defined(CONFIG_DEBUG_FS)
+extern int drm_debugfs_init(struct drm_minor *minor, int minor_id,
+struct dentry *root);
+extern int drm_debugfs_create_files(struct drm_debugfs_list *files, int count,
+struct dentry *root,
+struct drm_minor *minor);
+extern int drm_debugfs_remove_files(struct drm_debugfs_list *files, int count,
+struct drm_minor *minor);
+extern int drm_debugfs_cleanup(struct drm_minor *minor);
+#endif
+
/* Scatter Gather Support (drm_scatter.h) */
 extern void drm_sg_cleanup(struct drm_sg_mem * entry);
 extern int drm_sg_alloc_ioctl(struct drm_device *dev, void *data,
-- 
1.6.0.6


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH] remove declarations of proc hooks

2009-01-14 Thread Ben Gamari
---
 drivers/gpu/drm/i915/i915_drv.h |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 467572a..9158a94 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -575,8 +575,6 @@ int i915_gem_get_tiling(struct drm_device *dev, void *data,
 int i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv);
 void i915_gem_load(struct drm_device *dev);
-int i915_gem_proc_init(struct drm_minor *minor);
-void i915_gem_proc_cleanup(struct drm_minor *minor);
 int i915_gem_init_object(struct drm_gem_object *obj);
 void i915_gem_free_object(struct drm_gem_object *obj);
 int i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment);
-- 
1.6.0.5


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH] add proc structure definitions to header

2009-01-14 Thread Ben Gamari
---
 drivers/gpu/drm/drm_stub.c |2 +-
 include/drm/drmP.h |   24 +++-
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index 5ca132a..566847d 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -313,7 +313,7 @@ static int drm_get_minor(struct drm_device *dev, struct 
drm_minor **minor, int t
goto err_mem;
}
} else
-   new_minor-dev_root = NULL;
+   new_minor-proc_root = NULL;
 
ret = drm_sysfs_device_add(new_minor);
if (ret) {
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index afb7858..efa7935 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -801,6 +801,25 @@ struct drm_driver {
 #define DRM_MINOR_RENDER 3
 
 /**
+ * proc node list. This structure represents a debugfs file to
+ * be created by the drm core
+ */
+struct drm_proc_list {
+const char *name; /** file name */
+int (*show)(struct seq_file*, void*); /** show callback*/
+u32 driver_features; /** Required driver features for this entry */
+};
+
+/**
+ * proc node structure. This structure represents a proc file.
+ */
+struct drm_proc_node {
+struct list_head list;
+struct drm_minor *minor;
+struct drm_proc_list *proc_ent;
+};
+
+/**
  * DRM minor structure. This structure represents a drm minor number.
  */
 struct drm_minor {
@@ -809,7 +828,10 @@ struct drm_minor {
dev_t device;   /** Device number for mknod */
struct device kdev; /** Linux device */
struct drm_device *dev;
-   struct proc_dir_entry *dev_root;  /** proc directory entry */
+
+   struct proc_dir_entry *proc_root;  /** proc directory entry */
+   struct drm_proc_node proc_nodes;
+
struct drm_master *master; /* currently active master for this node */
struct list_head master_list;
struct drm_mode_group mode_group;
-- 
1.6.0.6


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH] remove last remnants of i915 proc implementations

2009-01-14 Thread Ben Gamari
---
 drivers/gpu/drm/i915/Makefile|1 -
 drivers/gpu/drm/i915/i915_gem_proc.c |  334 --
 2 files changed, 0 insertions(+), 335 deletions(-)
 delete mode 100644 drivers/gpu/drm/i915/i915_gem_proc.c

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index dd57a5b..6d037ca 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -7,7 +7,6 @@ i915-y := i915_drv.o i915_dma.o i915_irq.o i915_mem.o \
   i915_suspend.o \
  i915_gem.o \
  i915_gem_debug.o \
- i915_gem_proc.o \
  i915_gem_tiling.o \
  intel_display.o \
  intel_crt.o \
diff --git a/drivers/gpu/drm/i915/i915_gem_proc.c 
b/drivers/gpu/drm/i915/i915_gem_proc.c
deleted file mode 100644
index 4d1b9de..000
--- a/drivers/gpu/drm/i915/i915_gem_proc.c
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * Copyright © 2008 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the Software),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- *
- * Authors:
- *Eric Anholt e...@anholt.net
- *Keith Packard kei...@keithp.com
- *
- */
-
-#include drmP.h
-#include drm.h
-#include i915_drm.h
-#include i915_drv.h
-
-static int i915_gem_active_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;
-   drm_i915_private_t *dev_priv = dev-dev_private;
-   struct drm_i915_gem_object *obj_priv;
-   int len = 0;
-
-   if (offset  DRM_PROC_LIMIT) {
-   *eof = 1;
-   return 0;
-   }
-
-   *start = buf[offset];
-   *eof = 0;
-   DRM_PROC_PRINT(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) {
-   DRM_PROC_PRINT(%p(%d): %08x %08x %d\n,
-  obj, obj-name,
-  obj-read_domains, obj-write_domain,
-  obj_priv-last_rendering_seqno);
-   } else {
-   DRM_PROC_PRINT(   %p: %08x %08x %d\n,
-  obj,
-  obj-read_domains, obj-write_domain,
-  obj_priv-last_rendering_seqno);
-   }
-   }
-   if (len  request + offset)
-   return request;
-   *eof = 1;
-   return len - offset;
-}
-
-static int i915_gem_flushing_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;
-   drm_i915_private_t *dev_priv = dev-dev_private;
-   struct drm_i915_gem_object *obj_priv;
-   int len = 0;
-
-   if (offset  DRM_PROC_LIMIT) {
-   *eof = 1;
-   return 0;
-   }
-
-   *start = buf[offset];
-   *eof = 0;
-   DRM_PROC_PRINT(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) {
-   DRM_PROC_PRINT(%p(%d): %08x %08x %d\n,
-  obj, obj-name,
-  obj-read_domains, obj-write_domain,
-  obj_priv-last_rendering_seqno);
-   } else {
-   DRM_PROC_PRINT(   %p: %08x %08x %d\n, obj,
-  obj-read_domains, obj-write_domain,
-  obj_priv-last_rendering_seqno);
-   }
-   }
-   

[PATCH] create/remove debugfs roots during driver init/cleanup

2009-01-14 Thread Ben Gamari
---
 drivers/gpu/drm/drm_drv.c |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index febb517..9b74efb 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -46,9 +46,11 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include linux/debugfs.h
 #include drmP.h
 #include drm_core.h
 
+
 static int drm_version(struct drm_device *dev, void *data,
   struct drm_file *file_priv);
 
@@ -378,6 +380,13 @@ static int __init drm_core_init(void)
goto err_p3;
}
 
+drm_debugfs_root = debugfs_create_dir(dri, NULL);
+if (!drm_debugfs_root) {
+DRM_ERROR(Cannot create /debugfs/dri\n);
+ret = -1;
+goto err_p3;
+}
+
drm_mem_init();
 
DRM_INFO(Initialized %s %d.%d.%d %s\n,
@@ -396,6 +405,7 @@ err_p1:
 static void __exit drm_core_exit(void)
 {
remove_proc_entry(dri, NULL);
+   debugfs_remove(drm_debugfs_root);
drm_sysfs_destroy();
 
unregister_chrdev(DRM_MAJOR, drm);
-- 
1.6.0.6


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH] add debugfs declarations

2009-01-14 Thread Ben Gamari
add drm_debugfs_node stuct, drm_debugfs_root, debugfs entries to
drm_minor. Also add debugfs function declarations
---
 include/drm/drmP.h |   36 
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index efa7935..8933f9d 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -800,6 +800,27 @@ struct drm_driver {
 #define DRM_MINOR_CONTROL 2
 #define DRM_MINOR_RENDER 3
 
+
+/**
+ * debugfs node list. This structure represents a debugfs file to
+ * be created by the drm core
+ */
+struct drm_debugfs_list {
+const char *name; /** file name */
+int (*show)(struct seq_file*, void*); /** show callback*/
+u32 driver_features; /** Required driver features for this entry */
+};
+
+/**
+ * debugfs node structure. This structure represents a debugfs file.
+ */
+struct drm_debugfs_node {
+struct list_head list;
+struct drm_minor *minor;
+struct drm_debugfs_list *debugfs_ent;
+struct dentry *dent;  
+};
+
 /**
  * proc node list. This structure represents a debugfs file to
  * be created by the drm core
@@ -831,6 +852,8 @@ struct drm_minor {
 
struct proc_dir_entry *proc_root;  /** proc directory entry */
struct drm_proc_node proc_nodes;
+   struct dentry *debugfs_root;
+   struct drm_debugfs_node debugfs_nodes;
 
struct drm_master *master; /* currently active master for this node */
struct list_head master_list;
@@ -1289,6 +1312,7 @@ extern unsigned int drm_debug;
 
 extern struct class *drm_class;
 extern struct proc_dir_entry *drm_proc_root;
+extern struct dentry *drm_debugfs_root;
 
 extern struct idr drm_minors_idr;
 
@@ -1299,6 +1323,18 @@ extern int drm_proc_init(struct drm_minor *minor, int 
minor_id,
 struct proc_dir_entry *root);
 extern int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry 
*root);
 
+/* Debugfs support */
+#if defined(CONFIG_DRM_DEBUGFS)
+extern int drm_debugfs_init(struct drm_minor *minor, int minor_id,
+struct dentry *root);
+extern int drm_debugfs_create_files(struct drm_debugfs_list *files, int count,
+struct dentry *root,
+struct drm_minor *minor);
+extern int drm_debugfs_remove_files(struct drm_debugfs_list *files, int count,
+struct drm_minor *minor);
+extern int drm_debugfs_cleanup(struct drm_minor *minor);
+#endif
+
/* Scatter Gather Support (drm_scatter.h) */
 extern void drm_sg_cleanup(struct drm_sg_mem * entry);
 extern int drm_sg_alloc_ioctl(struct drm_device *dev, void *data,
-- 
1.6.0.6


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH] add debugfs init hooks

2009-01-14 Thread Ben Gamari
---
 drivers/gpu/drm/drm_stub.c |   12 
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index 566847d..eb5d100 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -50,6 +50,7 @@ struct idr drm_minors_idr;
 
 struct class *drm_class;
 struct proc_dir_entry *drm_proc_root;
+struct dentry *drm_debugfs_root;
 
 static int drm_minor_get_id(struct drm_device *dev, int type)
 {
@@ -315,6 +316,14 @@ static int drm_get_minor(struct drm_device *dev, struct 
drm_minor **minor, int t
} else
new_minor-proc_root = NULL;
 
+#if defined(CONFIG_DRM_DEBUGFS)
+ret = drm_debugfs_init(new_minor, minor_id, drm_debugfs_root);
+if (ret) {
+DRM_ERROR(DRM: Failed to initialize /debugfs/dri.\n);
+goto err_g2;
+}
+#endif
+
ret = drm_sysfs_device_add(new_minor);
if (ret) {
printk(KERN_ERR
@@ -451,6 +460,9 @@ int drm_put_minor(struct drm_minor **minor_p)
 
if (minor-type == DRM_MINOR_LEGACY)
drm_proc_cleanup(minor, drm_proc_root);
+#if defined(CONFIG_DRM_DEBUGFS)
+drm_debugfs_cleanup(minor);
+#endif
drm_sysfs_device_remove(minor);
 
idr_remove(drm_minors_idr, minor-index);
-- 
1.6.0.6


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH] add debugfs file implementations

2009-01-14 Thread Ben Gamari
---
 drivers/gpu/drm/drm_debugfs.c |  268 +
 1 files changed, 268 insertions(+), 0 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_debugfs.c

diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
new file mode 100644
index 000..1e52da8
--- /dev/null
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -0,0 +1,268 @@
+#include linux/debugfs.h
+#include linux/seq_file.h
+#include drmP.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.
+ **/
+
+static struct drm_debugfs_list drm_debugfs_list[] = {
+#if DRM_DEBUG_CODE
+   {vma, drm_vma_info, 0},
+#endif
+};
+
+#define DRM_DEBUGFS_ENTRIES ARRAY_SIZE(drm_debugfs_list)
+
+
+static int drm_debugfs_open(struct inode *inode, struct file *file)
+{
+   struct drm_debugfs_node *node =
+   (struct drm_debugfs_node *) inode-i_private;
+   return single_open(file, node-debugfs_ent-show, node-minor);
+}
+
+
+static struct file_operations drm_debugfs_fops = {
+   .owner = THIS_MODULE,
+   .open = drm_debugfs_open,
+   .read = seq_read,
+   .llseek = seq_lseek,
+   .release = single_release,
+};
+
+
+/**
+ * Initialize a given set of debugfs files for a device
+ *
+ * \param files The array of files to create
+ * \param count The number of files given
+ * \param root DRI debugfs dir entry.
+ * \param minor device minor number
+ * \return Zero on success, non-zero on failure
+ *
+ * Create a given set of debugfs files represented by an array of
+ * gdm_debugfs_lists in the given root directory.
+ */
+int drm_debugfs_create_files(struct drm_debugfs_list *files, int count,
+struct dentry *root, struct drm_minor *minor)
+{
+   struct drm_device *dev = minor-dev;
+   struct dentry *ent;
+   struct drm_debugfs_node *tmp;
+   char name[64];
+   int i, ret;
+
+   for (i = 0; i  count; i++) {
+   u32 features = files[i].driver_features;
+
+   if (features != 0 
+   (dev-driver-driver_features  features) != features)
+   continue;
+
+   tmp =
+   (struct drm_debugfs_node *)
+   drm_alloc(sizeof(struct drm_debugfs_node),
+ _DRM_DRIVER);
+   ent =
+   debugfs_create_file(files[i].name, S_IFREG | S_IRUGO,
+   root, tmp, drm_debugfs_fops);
+   if (!ent) {
+   DRM_ERROR(Cannot create /debugfs/dri/%s/%s\n,
+ name, files[i].name);

[PATCH] Add drm core debugfs implementation

2009-01-14 Thread Ben Gamari
---
 drivers/gpu/drm/drm_debugfs.c |  268 +
 drivers/gpu/drm/drm_stub.c|   13 ++
 2 files changed, 281 insertions(+), 0 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_debugfs.c

diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
new file mode 100644
index 000..2714479
--- /dev/null
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -0,0 +1,268 @@
+#include linux/debugfs.h
+#include linux/seq_file.h
+#include drmP.h
+
+#if defined(CONFIG_DEBUG_FS)
+
+#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.
+ **/
+
+static struct drm_debugfs_list drm_debugfs_list[] = {
+#if DRM_DEBUG_CODE
+   {vma, drm_vma_info, 0},
+#endif
+};
+
+#define DRM_DEBUGFS_ENTRIES ARRAY_SIZE(drm_debugfs_list)
+
+
+static int drm_debugfs_open(struct inode *inode, struct file *file)
+{
+   struct drm_debugfs_node *node =
+   (struct drm_debugfs_node *) inode-i_private;
+   return single_open(file, node-debugfs_ent-show, node-minor);
+}
+
+
+static struct file_operations drm_debugfs_fops = {
+   .owner = THIS_MODULE,
+   .open = drm_debugfs_open,
+   .read = seq_read,
+   .llseek = seq_lseek,
+   .release = single_release,
+};
+
+
+/**
+ * Initialize a given set of debugfs files for a device
+ *
+ * \param files The array of files to create
+ * \param count The number of files given
+ * \param root DRI debugfs dir entry.
+ * \param minor device minor number
+ * \return Zero on success, non-zero on failure
+ *
+ * Create a given set of debugfs files represented by an array of
+ * gdm_debugfs_lists in the given root directory.
+ */
+int drm_debugfs_create_files(struct drm_debugfs_list *files, int count,
+struct dentry *root, struct drm_minor *minor)
+{
+   struct drm_device *dev = minor-dev;
+   struct dentry *ent;
+   struct drm_debugfs_node *tmp;
+   char name[64];
+   int i, ret;
+
+   for (i = 0; i  count; i++) {
+   u32 features = files[i].driver_features;
+
+   if (features != 0 
+   (dev-driver-driver_features  features) != features)
+   continue;
+
+   tmp =
+   (struct drm_debugfs_node *)
+   drm_alloc(sizeof(struct drm_debugfs_node),
+ _DRM_DRIVER);
+   ent =
+   debugfs_create_file(files[i].name, S_IFREG | S_IRUGO,
+   root, tmp, drm_debugfs_fops);
+   if (!ent) {
+   DRM_ERROR(Cannot create /debugfs/dri/%s/%s\n,
+ 

[PATCH] add debugfs sources to Makefile

2009-01-14 Thread Ben Gamari
---
 drivers/gpu/drm/Makefile |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 30022c4..2aeaf02 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -10,7 +10,8 @@ drm-y   :=drm_auth.o drm_bufs.o drm_cache.o \
drm_lock.o drm_memory.o drm_proc.o drm_stub.o drm_vm.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_crtc.o drm_crtc_helper.o drm_modes.o drm_edid.o \
+   drm_debugfs.o
 
 drm-$(CONFIG_COMPAT) += drm_ioc32.o
 
-- 
1.6.0.6


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH] Implement gem object search by gtt offset

2009-01-14 Thread Ben Gamari
When dumping a batch buffer, we need to find its gem object so that we
may pin it. Here we look through active_list, inactive_list, and
flushing_list looking for an object with a valid and matching gtt_offset
---
 drivers/gpu/drm/i915/i915_gem_debugfs.c |   47 +--
 1 files changed, 38 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_debugfs.c 
b/drivers/gpu/drm/i915/i915_gem_debugfs.c
index 10ca9ae..e8ca71b 100644
--- a/drivers/gpu/drm/i915/i915_gem_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_gem_debugfs.c
@@ -617,7 +617,32 @@ static int dump_cmd(struct seq_file *m, uint32_t cmd, int 
count)
return ret;
 }
 
-static void dump_cmds (struct seq_file  *m,
+static struct drm_i915_gem_object* find_batch_buffer_in_list(struct list_head 
*head, uint32_t gtt_offset)
+{
+   struct drm_i915_gem_object* obj_priv;
+
+   list_for_each_entry(obj_priv, head, list) {
+   if (obj_priv-gtt_space  gtt_offset == obj_priv-gtt_offset) 
+   return obj_priv;
+   }
+   return NULL;
+}
+
+static struct drm_i915_gem_object* find_batch_buffer(struct drm_device *dev, 
uint32_t gtt_offset)
+{
+   struct drm_i915_gem_object* obj_priv;
+   drm_i915_private_t *dev_priv = dev-dev_private;
+
+   obj_priv = find_batch_buffer_in_list(dev_priv-mm.active_list, 
gtt_offset);
+   if (!obj_priv)
+   obj_priv = 
find_batch_buffer_in_list(dev_priv-mm.inactive_list, gtt_offset);
+   if (!obj_priv)
+   obj_priv = 
find_batch_buffer_in_list(dev_priv-mm.flushing_list, gtt_offset);
+   return obj_priv;
+}
+
+static void dump_cmds (struct seq_file *m,
+   struct drm_device   *dev,
volatile unsigned char  *virt,
uint32_tstart,
uint32_tstop,
@@ -646,7 +671,6 @@ static void dump_cmds (struct seq_file  *m,
if (ring == acthd)
seq_printf(m, );
 
-   DRM_INFO(\t%08x: %08x, ring, *(volatile unsigned int*) (virt 
+ ring));
if (ring == cmd) {
ptr = (volatile uint32_t *) (virt + ring);
data = *ptr;
@@ -661,13 +685,18 @@ static void dump_cmds (struct seq_file  *m,
if ( (data  batch_start_mask) == batch_start_cmd) {
uint32_t batch = ptr[1]  ~3;
uint32_t addr_type = (ptr[0]  (1  7));
+   struct drm_i915_gem_object *obj_priv = 
find_batch_buffer(dev, batch);
+
seq_printf(m, \t%08x: %08x\n, (ring + 4)  
mask, batch);
-   seq_printf(m, Batch buffer at 0x%08x (%s) 
{\n, batch, addr_type ? GfxMem : PhysMem);
-   /* TODO: Implement batch buffer dumping
-  dump_cmds(m, acthd);
-  ring = (ring + (count -1)*4)  mask;
-*/
-   seq_printf(m, }\n);
+   seq_printf(m, Batch buffer at 0x%08x (%s)\n, 
batch, addr_type ? GfxMem : PhysMem);
+   if (obj_priv) {
+   unsigned char *virt = obj_priv-obj;
+   /* TODO: Implement batch buffer dumping 
*/
+   seq_printf(m, {\n);
+   dump_cmds(m, dev, (unsigned 
char*)batch, 0, 4096, mask, acthd);
+   ring = (ring + (count -1)*4)  mask;
+   seq_printf(m, }\n);
+   }
}
cmd = (cmd + count * 4)  mask;
} else
@@ -730,7 +759,7 @@ static void dump_ring(struct seq_file *m, struct drm_device 
*dev, uint32_t acthd
break;
}
 
-   dump_cmds(m, virt, cmd, head, mask, acthd);
+   dump_cmds(m, dev, virt, cmd, head, mask, acthd);
seq_printf(m, Ring end\n);
 }
 
-- 
1.6.0.6


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[RFC] [PATCH] Ring buffer dumping

2009-01-14 Thread Ben Gamari

Hey again everyone,

Here is my latest attempt at implementing batch buffer dumping in GEM. The
patches have changed relatively little except for the fact that they now work.
At this point, reading from the debugfs file will dump not only the ring
buffer but also any batch buffers still valid and mapped into the GTT. While
my GEM knowledge is pretty limited, I think I've done everything necessary to
safely access the batch buffer object.

My one remaining concern is that we read out the batch buffer through the GTT.
Does anyone know if the GTT will stop working if the chip wedges up
(especially with something like an MMU fault)? The other option (as suggested
by keithp) is to use the non-GTT mapping. I would have done this but I just
happened to get this approach working by the time the alternative was
suggested.

Anyways, I think this patch set can still be considered to be in RFC status.
Let me know what you think. Thanks,

- Ben


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH] add proc structure definitions to header

2009-01-14 Thread Ben Gamari
---
 drivers/gpu/drm/drm_stub.c |2 +-
 include/drm/drmP.h |   24 +++-
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index 5ca132a..566847d 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -313,7 +313,7 @@ static int drm_get_minor(struct drm_device *dev, struct 
drm_minor **minor, int t
goto err_mem;
}
} else
-   new_minor-dev_root = NULL;
+   new_minor-proc_root = NULL;
 
ret = drm_sysfs_device_add(new_minor);
if (ret) {
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index afb7858..efa7935 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -801,6 +801,25 @@ struct drm_driver {
 #define DRM_MINOR_RENDER 3
 
 /**
+ * proc node list. This structure represents a debugfs file to
+ * be created by the drm core
+ */
+struct drm_proc_list {
+const char *name; /** file name */
+int (*show)(struct seq_file*, void*); /** show callback*/
+u32 driver_features; /** Required driver features for this entry */
+};
+
+/**
+ * proc node structure. This structure represents a proc file.
+ */
+struct drm_proc_node {
+struct list_head list;
+struct drm_minor *minor;
+struct drm_proc_list *proc_ent;
+};
+
+/**
  * DRM minor structure. This structure represents a drm minor number.
  */
 struct drm_minor {
@@ -809,7 +828,10 @@ struct drm_minor {
dev_t device;   /** Device number for mknod */
struct device kdev; /** Linux device */
struct drm_device *dev;
-   struct proc_dir_entry *dev_root;  /** proc directory entry */
+
+   struct proc_dir_entry *proc_root;  /** proc directory entry */
+   struct drm_proc_node proc_nodes;
+
struct drm_master *master; /* currently active master for this node */
struct list_head master_list;
struct drm_mode_group mode_group;
-- 
1.6.0.6


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH] convert proc files to seq_file

2009-01-14 Thread Ben Gamari
---
 drivers/gpu/drm/drm_proc.c |  726 
 1 files changed, 266 insertions(+), 460 deletions(-)

diff --git a/drivers/gpu/drm/drm_proc.c b/drivers/gpu/drm/drm_proc.c
index 8df849f..b949e89 100644
--- a/drivers/gpu/drm/drm_proc.c
+++ b/drivers/gpu/drm/drm_proc.c
@@ -37,216 +37,45 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include linux/seq_file.h
 #include drmP.h
 
-static int drm_name_info(char *buf, char **start, off_t offset,
-int request, int *eof, void *data);
-static int drm_vm_info(char *buf, char **start, off_t offset,
-  int request, int *eof, void *data);
-static int drm_clients_info(char *buf, char **start, off_t offset,
-   int request, int *eof, void *data);
-static int drm_queues_info(char *buf, char **start, off_t offset,
-  int request, int *eof, void *data);
-static int drm_bufs_info(char *buf, char **start, off_t offset,
-int request, int *eof, void *data);
-static int drm_vblank_info(char *buf, char **start, off_t offset,
-  int request, int *eof, void *data);
-static int drm_gem_name_info(char *buf, char **start, off_t offset,
-int request, int *eof, void *data);
-static int drm_gem_object_info(char *buf, char **start, off_t offset,
-  int request, int *eof, void *data);
-#if DRM_DEBUG_CODE
-static int drm_vma_info(char *buf, char **start, off_t offset,
-   int request, int *eof, void *data);
-#endif
-
-/**
- * Proc file list.
- */
-static struct drm_proc_list {
-   const char *name;   /** file name */
-   int (*f) (char *, char **, off_t, int, int *, void *);  /** 
proc callback*/
-   u32 driver_features; /** Required driver features for this entry */
-} drm_proc_list[] = {
-   {name, drm_name_info, 0},
-   {mem, drm_mem_info, 0},
-   {vm, drm_vm_info, 0},
-   {clients, drm_clients_info, 0},
-   {queues, drm_queues_info, 0},
-   {bufs, drm_bufs_info, 0},
-   {vblank, drm_vblank_info, 0},
-   {gem_names, drm_gem_name_info, DRIVER_GEM},
-   {gem_objects, drm_gem_object_info, DRIVER_GEM},
-#if DRM_DEBUG_CODE
-   {vma, drm_vma_info},
-#endif
-};
-
-#define DRM_PROC_ENTRIES ARRAY_SIZE(drm_proc_list)
-
-/**
- * Initialize the DRI proc filesystem for a device.
- *
- * \param dev DRM device.
- * \param minor device minor number.
- * \param root DRI proc dir entry.
- * \param dev_root resulting DRI device proc dir entry.
- * \return root entry pointer on success, or NULL on failure.
- *
- * Create the DRI proc root entry /proc/dri, the device proc root entry
- * /proc/dri/%minor%/, and each entry in proc_list as
- * /proc/dri/%minor%/%name%.
- */
-int drm_proc_init(struct drm_minor *minor, int minor_id,
- struct proc_dir_entry *root)
-{
-   struct drm_device *dev = minor-dev;
-   struct proc_dir_entry *ent;
-   int i, j, ret;
-   char name[64];
-
-   sprintf(name, %d, minor_id);
-   minor-dev_root = proc_mkdir(name, root);
-   if (!minor-dev_root) {
-   DRM_ERROR(Cannot create /proc/dri/%s\n, name);
-   return -1;
-   }
-
-   for (i = 0; i  DRM_PROC_ENTRIES; i++) {
-   u32 features = drm_proc_list[i].driver_features;
-
-   if (features != 0 
-   (dev-driver-driver_features  features) != features)
-   continue;
-
-   ent = create_proc_entry(drm_proc_list[i].name,
-   S_IFREG | S_IRUGO, minor-dev_root);
-   if (!ent) {
-   DRM_ERROR(Cannot create /proc/dri/%s/%s\n,
- name, drm_proc_list[i].name);
-   ret = -1;
-   goto fail;
-   }
-   ent-read_proc = drm_proc_list[i].f;
-   ent-data = minor;
-   }
-
-   if (dev-driver-proc_init) {
-   ret = dev-driver-proc_init(minor);
-   if (ret) {
-   DRM_ERROR(DRM: Driver failed to initialize 
- /proc/dri.\n);
-   goto fail;
-   }
-   }
-
-   return 0;
- fail:
-
-   for (j = 0; j  i; j++)
-   remove_proc_entry(drm_proc_list[i].name,
- minor-dev_root);
-   remove_proc_entry(name, root);
-   minor-dev_root = NULL;
-   return ret;
-}
-
-/**
- * Cleanup the proc filesystem resources.
- *
- * \param minor device minor number.
- * \param root DRI proc dir entry.
- * \param dev_root DRI device proc dir entry.
- * \return always zero.
- *
- * Remove all proc entries created by proc_init().
- */
-int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root)
-{
-   struct drm_device *dev = minor-dev;
-   int i;
-   char 

[PATCH] add former proc files to debugfs as well

2009-01-14 Thread Ben Gamari
---
 drivers/gpu/drm/drm_debugfs.c |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index e6f0725..e03457c 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -10,6 +10,14 @@
  **/
 
 static struct drm_debugfs_list drm_debugfs_list[] = {
+   {name, drm_name_info, 0},
+   /*{mem, drm_mem_info, 0},*/
+   {vm, drm_vm_info, 0},
+   {clients, drm_clients_info, 0},
+   {queues, drm_queues_info, 0},
+   {bufs, drm_bufs_info, 0},
+   {gem_names, drm_gem_name_info, DRIVER_GEM},
+   {gem_objects, drm_gem_object_info, DRIVER_GEM},
 #if DRM_DEBUG_CODE
{vma, drm_vma_info, 0},
 #endif
-- 
1.6.0.6


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH] Correctly implement batchbuffer dumping

2009-01-14 Thread Ben Gamari
We need to map the batch buffer before we attempt to dump it. Also,
break dumping out into a separate function to make error handling a
bit cleaner.
---
 drivers/gpu/drm/i915/i915_gem_debugfs.c |   63 --
 1 files changed, 50 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_debugfs.c 
b/drivers/gpu/drm/i915/i915_gem_debugfs.c
index e8ca71b..1386605 100644
--- a/drivers/gpu/drm/i915/i915_gem_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_gem_debugfs.c
@@ -9,6 +9,10 @@
 
 #if defined(CONFIG_DEBUG_FS)
 
+static void dump_batch_buffer(struct drm_device *dev, struct seq_file *m, 
+   uint32_t batch_offset, uint32_t mask, uint32_t acthd);
+
+
 static int i915_gem_active_info(struct seq_file *m, void *data)
 {
struct drm_minor *minor = (struct drm_minor *) m-private;
@@ -683,20 +687,14 @@ static void dump_cmds (struct seq_file*m,
 
/* check for MI_BATCH_BUFFER_START */
if ( (data  batch_start_mask) == batch_start_cmd) {
-   uint32_t batch = ptr[1]  ~3;
+   uint32_t batch_offset = ptr[1]  ~3;
uint32_t addr_type = (ptr[0]  (1  7));
-   struct drm_i915_gem_object *obj_priv = 
find_batch_buffer(dev, batch);
-
-   seq_printf(m, \t%08x: %08x\n, (ring + 4)  
mask, batch);
-   seq_printf(m, Batch buffer at 0x%08x (%s)\n, 
batch, addr_type ? GfxMem : PhysMem);
-   if (obj_priv) {
-   unsigned char *virt = obj_priv-obj;
-   /* TODO: Implement batch buffer dumping 
*/
-   seq_printf(m, {\n);
-   dump_cmds(m, dev, (unsigned 
char*)batch, 0, 4096, mask, acthd);
-   ring = (ring + (count -1)*4)  mask;
-   seq_printf(m, }\n);
-   }
+
+   seq_printf(m, \t%08x: %08x\n, (ring + 4)  
mask, batch_offset);
+   seq_printf(m, Batch buffer at 0x%08x (%s)\n, 
batch_offset, addr_type ? GfxMem : PhysMem);
+   if (addr_type)
+   dump_batch_buffer(dev, m, batch_offset, 
mask, acthd);
+   ring = (ring + (count - 1) * 4)  mask;
}
cmd = (cmd + count * 4)  mask;
} else
@@ -706,6 +704,45 @@ static void dump_cmds (struct seq_file *m,
}
 }
 
+static void dump_batch_buffer(struct drm_device *dev, struct seq_file *m, 
uint32_t batch_offset,
+   uint32_t mask, uint32_t acthd)
+{
+   drm_i915_private_t  *dev_priv = dev-dev_private;
+   struct drm_i915_gem_object *obj_priv;
+   uint32_t page_offset = (batch_offset  ~(PAGE_SIZE-1));
+   unsigned char *page;
+   unsigned char *virt;
+   int ret;
+   
+   obj_priv = find_batch_buffer(dev, batch_offset);
+   if (obj_priv == NULL) {
+   DRM_INFO(%s: Couldn't find batch buffer %08x\n, __func__, 
batch_offset);
+   return;
+   }
+
+   ret = i915_gem_object_pin(obj_priv-obj, 0);
+   if (!ret) {
+   DRM_INFO(%s: Failed to pin batch buffer %08x\n, __func__, 
batch_offset);
+   goto err_pin;
+   }
+
+   page = io_mapping_map_atomic_wc(dev_priv-mm.gtt_mapping, page_offset);
+   if (!page) {
+   DRM_INFO(%s: Failed to map batch buffer %08x\n, __func__, 
batch_offset);
+   goto err_map;
+   }
+
+   virt = (unsigned char*)(page + batch_offset - page_offset);
+   seq_printf(m, {\n);
+   dump_cmds(m, dev, virt, 0, PAGE_SIZE, mask, acthd);
+   seq_printf(m, }\n);
+
+err_map:
+   io_mapping_unmap_atomic(page);
+err_pin:
+   i915_gem_object_unpin(obj_priv-obj);
+}
+
 static int valid_chain(struct drm_device *dev, unsigned int ring, unsigned int 
end)
 {
drm_i915_private_t  *dev_priv = dev-dev_private;
-- 
1.6.0.6


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH] add memory type of batch buffer to ring dump output

2009-01-14 Thread Ben Gamari
---
 drivers/gpu/drm/i915/i915_gem_debugfs.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_debugfs.c 
b/drivers/gpu/drm/i915/i915_gem_debugfs.c
index cc91461..10ca9ae 100644
--- a/drivers/gpu/drm/i915/i915_gem_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_gem_debugfs.c
@@ -631,14 +631,12 @@ static void dump_cmds (struct seq_file  *m,
(0x3f  23) |
(0x7ff  12) |
(1  11) |
-   (1  7) |
(1  6) |
(0x3f  0));
uint32_t batch_start_cmd = ((0x0  29) |
(0x31  23) |
(0x00  12) |
(0  11) |
-   (1  7) |
(0  6) |
(0  0));
int count;
@@ -662,17 +660,19 @@ static void dump_cmds (struct seq_file  *m,
/* check for MI_BATCH_BUFFER_START */
if ( (data  batch_start_mask) == batch_start_cmd) {
uint32_t batch = ptr[1]  ~3;
+   uint32_t addr_type = (ptr[0]  (1  7));
seq_printf(m, \t%08x: %08x\n, (ring + 4)  
mask, batch);
-   seq_printf(m, Batch buffer at 0x%08x {\n, 
batch);
+   seq_printf(m, Batch buffer at 0x%08x (%s) 
{\n, batch, addr_type ? GfxMem : PhysMem);
/* TODO: Implement batch buffer dumping
   dump_cmds(m, acthd);
   ring = (ring + (count -1)*4)  mask;
-  */
+*/
seq_printf(m, }\n);
}
cmd = (cmd + count * 4)  mask;
} else
seq_printf(m, \n);
+
ring = (ring + 4)  mask;
}
 }
-- 
1.6.0.6


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


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

2009-01-14 Thread Ben Gamari
---
 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 000..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;
+  

[PATCH] add debugfs hooks to drm_driver struct

2009-01-14 Thread Ben Gamari
---
 include/drm/drmP.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 8933f9d..48a240a 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -765,6 +765,8 @@ struct drm_driver {
 
int (*proc_init)(struct drm_minor *minor);
void (*proc_cleanup)(struct drm_minor *minor);
+   int (*debugfs_init)(struct drm_minor *minor);
+   void (*debugfs_cleanup)(struct drm_minor *minor);
 
/**
 * Driver-specific constructor for drm_gem_objects, to set up
-- 
1.6.0.6


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH] add i915 debugfs implementation

2009-01-14 Thread Ben Gamari
Port old i915-specific proc file entries to debugfs
---
 drivers/gpu/drm/i915/Makefile   |1 +
 drivers/gpu/drm/i915/i915_drv.c |4 +
 drivers/gpu/drm/i915/i915_drv.h |4 +
 drivers/gpu/drm/i915/i915_gem_debugfs.c |  205 +++
 4 files changed, 214 insertions(+), 0 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/i915_gem_debugfs.c

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 6d037ca..5b3bd5e 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -7,6 +7,7 @@ i915-y := i915_drv.o i915_dma.o i915_irq.o i915_mem.o \
   i915_suspend.o \
  i915_gem.o \
  i915_gem_debug.o \
+ i915_gem_debugfs.o \
  i915_gem_tiling.o \
  intel_display.o \
  intel_crt.o \
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 8b85bd7..4ce1136 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -124,6 +124,10 @@ static struct drm_driver driver = {
.get_reg_ofs = drm_core_get_reg_ofs,
.master_create = i915_master_create,
.master_destroy = i915_master_destroy,
+#if defined(CONFIG_DRM_DEBUGFS)
+   .debugfs_init = i915_gem_debugfs_init,
+   .debugfs_cleanup = i915_gem_debugfs_cleanup,
+#endif
.gem_init_object = i915_gem_init_object,
.gem_free_object = i915_gem_free_object,
.gem_vm_ops = i915_gem_vm_ops,
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 8cad114..75ffa17 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -613,6 +613,10 @@ void i915_gem_dump_object(struct drm_gem_object *obj, int 
len,
  const char *where, uint32_t mark);
 void i915_dump_lru(struct drm_device *dev, const char *where);
 
+/* i915_debugfs.c */
+int i915_gem_debugfs_init(struct drm_minor *minor);
+void i915_gem_debugfs_cleanup(struct drm_minor *minor);
+
 /* i915_suspend.c */
 extern int i915_save_state(struct drm_device *dev);
 extern int i915_restore_state(struct drm_device *dev);
diff --git a/drivers/gpu/drm/i915/i915_gem_debugfs.c 
b/drivers/gpu/drm/i915/i915_gem_debugfs.c
new file mode 100644
index 000..5cdd217
--- /dev/null
+++ b/drivers/gpu/drm/i915/i915_gem_debugfs.c
@@ -0,0 +1,205 @@
+#include linux/seq_file.h
+#include drmP.h
+#include drm.h
+#include i915_drm.h
+#include i915_drv.h
+
+#define DRM_I915_RING_DEBUG 1
+
+
+#if defined(CONFIG_DRM_DEBUGFS)
+
+static int i915_gem_active_info(struct seq_file *m, void *data)
+{
+   struct drm_minor *minor = (struct drm_minor *) m-private;
+   struct drm_device *dev = 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;
+}
+
+static int i915_gem_flushing_info(struct seq_file *m, void *data)
+{
+   struct drm_minor *minor = (struct drm_minor *) m-private;
+   struct drm_device *dev = 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);
+   }
+   }
+   return 0;
+}
+
+static int i915_gem_inactive_info(struct seq_file *m, void *data)
+{
+   struct drm_minor *minor = (struct drm_minor *) m-private;
+   struct drm_device *dev = minor-dev;
+   drm_i915_private_t *dev_priv = dev-dev_private;
+   struct 

[PATCH] Proc to debugfs migration, 2nd attempt

2009-01-14 Thread Ben Gamari

Hey everyone,

Here is my procfs cleanup patchset. As you can see, the first two 
patches attempt to clean up the existing proc file creation code and 
port the files' implementations to the seq_file interface. The remaining
patches focus on implementing a similar system for debugfs files.

Feedback has generally indicated that while removing drm information 
from /proc is a worthwhile goal, we need to provide a transition period
in which we can keep this information available in both debugfs and 
/proc. The refactoring with seq_file made this almost trivial, requiring
only that I move the file implementations to a combined file which both
the proc and debugfs code can link against. I declared these symbols in
a new header file (drm_info.h) and while I haven't seen any precedent 
for this in the drm code, I did want to keep from lengthening drmP.h any
more than it already is, especially given these symbols are only 
referred to in two places. It is my thought that eventually the proc 
file code will be pulled out anyways and we'll be able to merge 
drm_info.[ch] back into drm_debugfs.c. Let me know if anyone has an 
issue with this.

Anyways, I think most of it is pretty straightforward. Please pardon the
less-than-stellar organization of the patchset, I did my best to santize it
but rebasing while moving whole files around seems to be quite tedious. I
think that the patch set is pretty much ready for merge. I've been running it
for several weeks now without incident. Let me know what you think,

- Ben


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH] convert proc files to seq_file

2009-01-14 Thread Ben Gamari
---
 drivers/gpu/drm/drm_proc.c |  726 
 1 files changed, 266 insertions(+), 460 deletions(-)

diff --git a/drivers/gpu/drm/drm_proc.c b/drivers/gpu/drm/drm_proc.c
index 8df849f..b949e89 100644
--- a/drivers/gpu/drm/drm_proc.c
+++ b/drivers/gpu/drm/drm_proc.c
@@ -37,216 +37,45 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include linux/seq_file.h
 #include drmP.h
 
-static int drm_name_info(char *buf, char **start, off_t offset,
-int request, int *eof, void *data);
-static int drm_vm_info(char *buf, char **start, off_t offset,
-  int request, int *eof, void *data);
-static int drm_clients_info(char *buf, char **start, off_t offset,
-   int request, int *eof, void *data);
-static int drm_queues_info(char *buf, char **start, off_t offset,
-  int request, int *eof, void *data);
-static int drm_bufs_info(char *buf, char **start, off_t offset,
-int request, int *eof, void *data);
-static int drm_vblank_info(char *buf, char **start, off_t offset,
-  int request, int *eof, void *data);
-static int drm_gem_name_info(char *buf, char **start, off_t offset,
-int request, int *eof, void *data);
-static int drm_gem_object_info(char *buf, char **start, off_t offset,
-  int request, int *eof, void *data);
-#if DRM_DEBUG_CODE
-static int drm_vma_info(char *buf, char **start, off_t offset,
-   int request, int *eof, void *data);
-#endif
-
-/**
- * Proc file list.
- */
-static struct drm_proc_list {
-   const char *name;   /** file name */
-   int (*f) (char *, char **, off_t, int, int *, void *);  /** 
proc callback*/
-   u32 driver_features; /** Required driver features for this entry */
-} drm_proc_list[] = {
-   {name, drm_name_info, 0},
-   {mem, drm_mem_info, 0},
-   {vm, drm_vm_info, 0},
-   {clients, drm_clients_info, 0},
-   {queues, drm_queues_info, 0},
-   {bufs, drm_bufs_info, 0},
-   {vblank, drm_vblank_info, 0},
-   {gem_names, drm_gem_name_info, DRIVER_GEM},
-   {gem_objects, drm_gem_object_info, DRIVER_GEM},
-#if DRM_DEBUG_CODE
-   {vma, drm_vma_info},
-#endif
-};
-
-#define DRM_PROC_ENTRIES ARRAY_SIZE(drm_proc_list)
-
-/**
- * Initialize the DRI proc filesystem for a device.
- *
- * \param dev DRM device.
- * \param minor device minor number.
- * \param root DRI proc dir entry.
- * \param dev_root resulting DRI device proc dir entry.
- * \return root entry pointer on success, or NULL on failure.
- *
- * Create the DRI proc root entry /proc/dri, the device proc root entry
- * /proc/dri/%minor%/, and each entry in proc_list as
- * /proc/dri/%minor%/%name%.
- */
-int drm_proc_init(struct drm_minor *minor, int minor_id,
- struct proc_dir_entry *root)
-{
-   struct drm_device *dev = minor-dev;
-   struct proc_dir_entry *ent;
-   int i, j, ret;
-   char name[64];
-
-   sprintf(name, %d, minor_id);
-   minor-dev_root = proc_mkdir(name, root);
-   if (!minor-dev_root) {
-   DRM_ERROR(Cannot create /proc/dri/%s\n, name);
-   return -1;
-   }
-
-   for (i = 0; i  DRM_PROC_ENTRIES; i++) {
-   u32 features = drm_proc_list[i].driver_features;
-
-   if (features != 0 
-   (dev-driver-driver_features  features) != features)
-   continue;
-
-   ent = create_proc_entry(drm_proc_list[i].name,
-   S_IFREG | S_IRUGO, minor-dev_root);
-   if (!ent) {
-   DRM_ERROR(Cannot create /proc/dri/%s/%s\n,
- name, drm_proc_list[i].name);
-   ret = -1;
-   goto fail;
-   }
-   ent-read_proc = drm_proc_list[i].f;
-   ent-data = minor;
-   }
-
-   if (dev-driver-proc_init) {
-   ret = dev-driver-proc_init(minor);
-   if (ret) {
-   DRM_ERROR(DRM: Driver failed to initialize 
- /proc/dri.\n);
-   goto fail;
-   }
-   }
-
-   return 0;
- fail:
-
-   for (j = 0; j  i; j++)
-   remove_proc_entry(drm_proc_list[i].name,
- minor-dev_root);
-   remove_proc_entry(name, root);
-   minor-dev_root = NULL;
-   return ret;
-}
-
-/**
- * Cleanup the proc filesystem resources.
- *
- * \param minor device minor number.
- * \param root DRI proc dir entry.
- * \param dev_root DRI device proc dir entry.
- * \return always zero.
- *
- * Remove all proc entries created by proc_init().
- */
-int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root)
-{
-   struct drm_device *dev = minor-dev;
-   int i;
-   char 

[PATCH] create/remove debugfs roots during driver init/cleanup

2009-01-14 Thread Ben Gamari
---
 drivers/gpu/drm/drm_drv.c |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index febb517..9b74efb 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -46,9 +46,11 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include linux/debugfs.h
 #include drmP.h
 #include drm_core.h
 
+
 static int drm_version(struct drm_device *dev, void *data,
   struct drm_file *file_priv);
 
@@ -378,6 +380,13 @@ static int __init drm_core_init(void)
goto err_p3;
}
 
+drm_debugfs_root = debugfs_create_dir(dri, NULL);
+if (!drm_debugfs_root) {
+DRM_ERROR(Cannot create /debugfs/dri\n);
+ret = -1;
+goto err_p3;
+}
+
drm_mem_init();
 
DRM_INFO(Initialized %s %d.%d.%d %s\n,
@@ -396,6 +405,7 @@ err_p1:
 static void __exit drm_core_exit(void)
 {
remove_proc_entry(dri, NULL);
+   debugfs_remove(drm_debugfs_root);
drm_sysfs_destroy();
 
unregister_chrdev(DRM_MAJOR, drm);
-- 
1.6.0.6


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


Re: [PATCH] Proc to debugfs migration

2009-01-14 Thread Ben Gamari
Bah, naturally just as I sent this out I realized that anholt sent me
comments on the last iteration of this patch set. I'll incorporate his
proposed changes and any others I receive in the next few hours and send
it out again. Sorry about the spam,

- Ben


On Wed, 2009-01-14 at 19:27 -0500, Ben Gamari wrote:
 Hey everyone,
 
 Here is my procfs cleanup patchset. As you can see, the first two 
 patches attempt to clean up the existing proc file creation code and 
 port the files' implementations to the seq_file interface. The remaining
 patches focus on implementing a similar system for debugfs files.
 
 Feedback has generally indicated that while removing drm information 
 from /proc is a worthwhile goal, we need to provide a transition period
 in which we can keep this information available in both debugfs and 
 /proc. The refactoring with seq_file made this almost trivial, requiring
 only that I move the file implementations to a combined file which both
 the proc and debugfs code can link against. I declared these symbols in
 a new header file (drm_info.h) and while I haven't seen any precedent 
 for this in the drm code, I did want to keep from lengthening drmP.h any
 more than it already is, especially given these symbols are only 
 referred to in two places. It is my thought that eventually the proc 
 file code will be pulled out anyways and we'll be able to merge 
 drm_info.[ch] back into drm_debugfs.c. Let me know if anyone has an 
 issue with this.
 
 Anyways, I think most of it is pretty straightforward. Please pardon the
 less-than-stellar organization of the patchset, I did my best to santize it
 but rebasing while moving whole files around seems to be quite tedious. I
 think that the patch set is pretty much ready for merge. I've been running it
 for several weeks now without incident. Let me know what you think,
 
 - Ben
 


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH] remove i915 proc hooks

2009-01-14 Thread Ben Gamari
These are going into debugfs. There is no reason why they need to be in
proc.
---
 drivers/gpu/drm/i915/Makefile|1 -
 drivers/gpu/drm/i915/i915_drv.c  |2 -
 drivers/gpu/drm/i915/i915_drv.h  |2 -
 drivers/gpu/drm/i915/i915_gem_proc.c |  334 --
 4 files changed, 0 insertions(+), 339 deletions(-)
 delete mode 100644 drivers/gpu/drm/i915/i915_gem_proc.c

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index dd57a5b..6d037ca 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -7,7 +7,6 @@ i915-y := i915_drv.o i915_dma.o i915_irq.o i915_mem.o \
   i915_suspend.o \
  i915_gem.o \
  i915_gem_debug.o \
- i915_gem_proc.o \
  i915_gem_tiling.o \
  intel_display.o \
  intel_crt.o \
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index f8b3df0..8b85bd7 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -124,8 +124,6 @@ static struct drm_driver driver = {
.get_reg_ofs = drm_core_get_reg_ofs,
.master_create = i915_master_create,
.master_destroy = i915_master_destroy,
-   .proc_init = i915_gem_proc_init,
-   .proc_cleanup = i915_gem_proc_cleanup,
.gem_init_object = i915_gem_init_object,
.gem_free_object = i915_gem_free_object,
.gem_vm_ops = i915_gem_vm_ops,
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 4756e5c..8cad114 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -577,8 +577,6 @@ int i915_gem_get_tiling(struct drm_device *dev, void *data,
 int i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv);
 void i915_gem_load(struct drm_device *dev);
-int i915_gem_proc_init(struct drm_minor *minor);
-void i915_gem_proc_cleanup(struct drm_minor *minor);
 int i915_gem_init_object(struct drm_gem_object *obj);
 void i915_gem_free_object(struct drm_gem_object *obj);
 int i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment);
diff --git a/drivers/gpu/drm/i915/i915_gem_proc.c 
b/drivers/gpu/drm/i915/i915_gem_proc.c
deleted file mode 100644
index 4d1b9de..000
--- a/drivers/gpu/drm/i915/i915_gem_proc.c
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * Copyright © 2008 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the Software),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- *
- * Authors:
- *Eric Anholt e...@anholt.net
- *Keith Packard kei...@keithp.com
- *
- */
-
-#include drmP.h
-#include drm.h
-#include i915_drm.h
-#include i915_drv.h
-
-static int i915_gem_active_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;
-   drm_i915_private_t *dev_priv = dev-dev_private;
-   struct drm_i915_gem_object *obj_priv;
-   int len = 0;
-
-   if (offset  DRM_PROC_LIMIT) {
-   *eof = 1;
-   return 0;
-   }
-
-   *start = buf[offset];
-   *eof = 0;
-   DRM_PROC_PRINT(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) {
-   DRM_PROC_PRINT(%p(%d): %08x %08x %d\n,
-  obj, obj-name,
-  obj-read_domains, obj-write_domain,
-  obj_priv-last_rendering_seqno);
-   } else {
-   DRM_PROC_PRINT(   %p: %08x %08x %d\n,
-  obj,
-  obj-read_domains, obj-write_domain,
- 

[PATCH] add debugfs declarations

2009-01-14 Thread Ben Gamari
---
 include/drm/drmP.h |   38 +-
 1 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index efe50b6..1484797 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -800,6 +800,27 @@ struct drm_driver {
 #define DRM_MINOR_CONTROL 2
 #define DRM_MINOR_RENDER 3
 
+
+/**
+ * debugfs node list. This structure represents a debugfs file to
+ * be created by the drm core
+ */
+struct drm_debugfs_list {
+const char *name; /** file name */
+int (*show)(struct seq_file*, void*); /** show callback*/
+u32 driver_features; /** Required driver features for this entry */
+};
+
+/**
+ * debugfs node structure. This structure represents a debugfs file.
+ */
+struct drm_debugfs_node {
+struct list_head list;
+struct drm_minor *minor;
+struct drm_debugfs_list *debugfs_ent;
+struct dentry *dent;  
+};
+
 /**
  * proc node list. This structure represents a debugfs file to
  * be created by the drm core
@@ -830,7 +851,9 @@ struct drm_minor {
struct drm_device *dev;
 
struct proc_dir_entry *proc_root;  /** proc directory entry */
-  struct drm_proc_node proc_nodes;
+   struct drm_proc_node proc_nodes;
+   struct dentry *debugfs_root;
+   struct drm_debugfs_node debugfs_nodes;
 
struct drm_master *master; /* currently active master for this node */
struct list_head master_list;
@@ -1288,6 +1311,7 @@ extern unsigned int drm_debug;
 
 extern struct class *drm_class;
 extern struct proc_dir_entry *drm_proc_root;
+extern struct dentry *drm_debugfs_root;
 
 extern struct idr drm_minors_idr;
 
@@ -1298,6 +1322,18 @@ extern int drm_proc_init(struct drm_minor *minor, int 
minor_id,
 struct proc_dir_entry *root);
 extern int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry 
*root);
 
+/* Debugfs support */
+#if defined(CONFIG_DRM_DEBUGFS)
+extern int drm_debugfs_init(struct drm_minor *minor, int minor_id,
+struct dentry *root);
+extern int drm_debugfs_create_files(struct drm_debugfs_list *files, int count,
+struct dentry *root,
+struct drm_minor *minor);
+extern int drm_debugfs_remove_files(struct drm_debugfs_list *files, int count,
+struct drm_minor *minor);
+extern int drm_debugfs_cleanup(struct drm_minor *minor);
+#endif
+
/* Scatter Gather Support (drm_scatter.h) */
 extern void drm_sg_cleanup(struct drm_sg_mem * entry);
 extern int drm_sg_alloc_ioctl(struct drm_device *dev, void *data,
-- 
1.6.0.5


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH] correct dev_root reference

2008-12-21 Thread Ben Gamari
---
 drivers/gpu/drm/drm_stub.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index 592192d..5697764 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -312,7 +312,7 @@ static int drm_get_minor(struct drm_device *dev, struct 
drm_minor **minor, int t
goto err_mem;
}
} else
-   new_minor-dev_root = NULL;
+   new_minor-proc_root = NULL;
 
ret = drm_sysfs_device_add(new_minor);
if (ret) {
-- 
1.6.0.5


--
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH] create/remove debugfs roots during driver init/cleanup

2008-12-21 Thread Ben Gamari
---
 drivers/gpu/drm/drm_drv.c |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 0b9f316..cc90440 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -46,9 +46,11 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include linux/debugfs.h
 #include drmP.h
 #include drm_core.h
 
+
 static int drm_version(struct drm_device *dev, void *data,
   struct drm_file *file_priv);
 
@@ -383,6 +385,13 @@ static int __init drm_core_init(void)
goto err_p3;
}
 
+drm_debugfs_root = debugfs_create_dir(dri, NULL);
+if (!drm_debugfs_root) {
+DRM_ERROR(Cannot create /debugfs/dri\n);
+ret = -1;
+goto err_p3;
+}
+
drm_mem_init();
 
DRM_INFO(Initialized %s %d.%d.%d %s\n,
@@ -401,6 +410,7 @@ err_p1:
 static void __exit drm_core_exit(void)
 {
remove_proc_entry(dri, NULL);
+debugfs_remove(drm_debugfs_root);
drm_sysfs_destroy();
 
unregister_chrdev(DRM_MAJOR, drm);
-- 
1.6.0.5


--
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


Rework DRM proc file handling [rev 2]

2008-12-21 Thread Ben Gamari

This is the latest patch series reworking the drm proc file handling
using seq_file. Like before, I've moved some of the debug-oriented proc
files into debugfs, especially those pertaining to i915. Moreover, the
series now has a proper git history and is split up better than the
previous behemouth. 

Still, I have yet to get batch buffer dumping
working, but it should nevertheless be stable. Let me know how it looks.
I corrected a bunch of whitespace issues so it should be mergeable (or
at least close). I'll be looking forward to hearing comments. Thanks,

  - Ben

--
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH] add debugfs sources to Makefile

2008-12-21 Thread Ben Gamari
---
 drivers/gpu/drm/Makefile |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 30022c4..2aeaf02 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -10,7 +10,8 @@ drm-y   :=drm_auth.o drm_bufs.o drm_cache.o \
drm_lock.o drm_memory.o drm_proc.o drm_stub.o drm_vm.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_crtc.o drm_crtc_helper.o drm_modes.o drm_edid.o \
+   drm_debugfs.o
 
 drm-$(CONFIG_COMPAT) += drm_ioc32.o
 
-- 
1.6.0.5


--
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH] add DRM_DEBUGFS config option to Kconfig

2008-12-21 Thread Ben Gamari
---
 drivers/gpu/drm/Kconfig |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 6903e54..fd7418a 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -16,6 +16,13 @@ menuconfig DRM
  details.  You should also select and configure AGP
  (/dev/agpgart) support.
 
+config DRM_DEBUGFS
+bool DRM debugfs file system
+depends on DEBUG_FS
+help
+  Choose this option is you wish to enable the debugfs filesystem
+  for the DRM and drivers.
+
 config DRM_TDFX
tristate 3dfx Banshee/Voodoo3+
depends on DRM  PCI
-- 
1.6.0.5


--
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH] add i915 debugfs implementation

2008-12-21 Thread Ben Gamari
---
 drivers/gpu/drm/i915/i915_gem_debugfs.c |  778 +++
 1 files changed, 778 insertions(+), 0 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/i915_gem_debugfs.c

diff --git a/drivers/gpu/drm/i915/i915_gem_debugfs.c 
b/drivers/gpu/drm/i915/i915_gem_debugfs.c
new file mode 100644
index 000..af15b22
--- /dev/null
+++ b/drivers/gpu/drm/i915/i915_gem_debugfs.c
@@ -0,0 +1,778 @@
+#include linux/seq_file.h
+#include drmP.h
+#include drm.h
+#include i915_drm.h
+#include i915_drv.h
+
+#define DRM_I915_RING_DEBUG 1
+
+
+#if defined(CONFIG_DRM_DEBUGFS)
+
+static int i915_gem_active_info(struct seq_file *m, void *data)
+{
+   struct drm_minor *minor = (struct drm_minor *) m-private;
+   struct drm_device *dev = 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;
+}
+
+static int i915_gem_flushing_info(struct seq_file *m, void *data)
+{
+   struct drm_minor *minor = (struct drm_minor *) m-private;
+   struct drm_device *dev = 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);
+   }
+   }
+   return 0;
+}
+
+static int i915_gem_inactive_info(struct seq_file *m, void *data)
+{
+   struct drm_minor *minor = (struct drm_minor *) m-private;
+   struct drm_device *dev = 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)
+   {
+   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;
+}
+
+static int i915_gem_request_info(struct seq_file *m, void *data)
+{
+   struct drm_minor *minor = (struct drm_minor *) m-private;
+   struct drm_device *dev = minor-dev;
+   drm_i915_private_t *dev_priv = dev-dev_private;
+   struct drm_i915_gem_request *gem_request;
+
+   seq_printf(m, Request:\n);
+   list_for_each_entry(gem_request, dev_priv-mm.request_list,
+   list)
+   {
+   seq_printf(m, %d @ %d\n,
+   gem_request-seqno,
+   (int) (jiffies - gem_request-emitted_jiffies));
+   }
+   return 0;
+}
+
+static int i915_gem_seqno_info(struct seq_file *m, void *data)
+{
+   struct drm_minor *minor = (struct drm_minor *) m-private;
+   struct drm_device *dev = minor-dev;
+   drm_i915_private_t *dev_priv = dev-dev_private;
+
+   if (dev_priv-hw_status_page != NULL) {
+   seq_printf(m, Current sequence: %d\n,
+   i915_get_gem_seqno(dev));
+   } else {
+   seq_printf(m, Current sequence: hws uninitialized\n);
+   }
+   

[PATCH] add proc structure definitions to header

2008-12-21 Thread Ben Gamari
---
 include/drm/drmP.h |   24 +++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 7802c80..efe50b6 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -801,6 +801,25 @@ struct drm_driver {
 #define DRM_MINOR_RENDER 3
 
 /**
+ * proc node list. This structure represents a debugfs file to
+ * be created by the drm core
+ */
+struct drm_proc_list {
+const char *name; /** file name */
+int (*show)(struct seq_file*, void*); /** show callback*/
+u32 driver_features; /** Required driver features for this entry */
+};
+
+/**
+ * proc node structure. This structure represents a proc file.
+ */
+struct drm_proc_node {
+struct list_head list;
+struct drm_minor *minor;
+struct drm_proc_list *proc_ent;
+};
+
+/**
  * DRM minor structure. This structure represents a drm minor number.
  */
 struct drm_minor {
@@ -809,7 +828,10 @@ struct drm_minor {
dev_t device;   /** Device number for mknod */
struct device kdev; /** Linux device */
struct drm_device *dev;
-   struct proc_dir_entry *dev_root;  /** proc directory entry */
+
+   struct proc_dir_entry *proc_root;  /** proc directory entry */
+  struct drm_proc_node proc_nodes;
+
struct drm_master *master; /* currently active master for this node */
struct list_head master_list;
struct drm_mode_group mode_group;
-- 
1.6.0.5


--
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH] remove i915 proc hooks

2008-12-21 Thread Ben Gamari
---
 drivers/gpu/drm/i915/i915_drv.c |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index cbee41c..5f0d8c2 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -124,8 +124,6 @@ static struct drm_driver driver = {
.get_reg_ofs = drm_core_get_reg_ofs,
.master_create = i915_master_create,
.master_destroy = i915_master_destroy,
-   .proc_init = i915_gem_proc_init,
-   .proc_cleanup = i915_gem_proc_cleanup,
.gem_init_object = i915_gem_init_object,
.gem_free_object = i915_gem_free_object,
.gem_vm_ops = i915_gem_vm_ops,
-- 
1.6.0.5


--
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH] add debugfs file implementations

2008-12-21 Thread Ben Gamari
---
 drivers/gpu/drm/drm_debugfs.c |  268 +
 1 files changed, 268 insertions(+), 0 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_debugfs.c

diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
new file mode 100644
index 000..1e52da8
--- /dev/null
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -0,0 +1,268 @@
+#include linux/debugfs.h
+#include linux/seq_file.h
+#include drmP.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.
+ **/
+
+static struct drm_debugfs_list drm_debugfs_list[] = {
+#if DRM_DEBUG_CODE
+   {vma, drm_vma_info, 0},
+#endif
+};
+
+#define DRM_DEBUGFS_ENTRIES ARRAY_SIZE(drm_debugfs_list)
+
+
+static int drm_debugfs_open(struct inode *inode, struct file *file)
+{
+   struct drm_debugfs_node *node =
+   (struct drm_debugfs_node *) inode-i_private;
+   return single_open(file, node-debugfs_ent-show, node-minor);
+}
+
+
+static struct file_operations drm_debugfs_fops = {
+   .owner = THIS_MODULE,
+   .open = drm_debugfs_open,
+   .read = seq_read,
+   .llseek = seq_lseek,
+   .release = single_release,
+};
+
+
+/**
+ * Initialize a given set of debugfs files for a device
+ *
+ * \param files The array of files to create
+ * \param count The number of files given
+ * \param root DRI debugfs dir entry.
+ * \param minor device minor number
+ * \return Zero on success, non-zero on failure
+ *
+ * Create a given set of debugfs files represented by an array of
+ * gdm_debugfs_lists in the given root directory.
+ */
+int drm_debugfs_create_files(struct drm_debugfs_list *files, int count,
+struct dentry *root, struct drm_minor *minor)
+{
+   struct drm_device *dev = minor-dev;
+   struct dentry *ent;
+   struct drm_debugfs_node *tmp;
+   char name[64];
+   int i, ret;
+
+   for (i = 0; i  count; i++) {
+   u32 features = files[i].driver_features;
+
+   if (features != 0 
+   (dev-driver-driver_features  features) != features)
+   continue;
+
+   tmp =
+   (struct drm_debugfs_node *)
+   drm_alloc(sizeof(struct drm_debugfs_node),
+ _DRM_DRIVER);
+   ent =
+   debugfs_create_file(files[i].name, S_IFREG | S_IRUGO,
+   root, tmp, drm_debugfs_fops);
+   if (!ent) {
+   DRM_ERROR(Cannot create /debugfs/dri/%s/%s\n,
+ name, files[i].name);

[PATCH] convert proc files to seq_file

2008-12-21 Thread Ben Gamari
---
 drivers/gpu/drm/drm_proc.c |  723 
 1 files changed, 264 insertions(+), 459 deletions(-)

diff --git a/drivers/gpu/drm/drm_proc.c b/drivers/gpu/drm/drm_proc.c
index 7dbaa1a..40e320e 100644
--- a/drivers/gpu/drm/drm_proc.c
+++ b/drivers/gpu/drm/drm_proc.c
@@ -37,213 +37,45 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include linux/seq_file.h
 #include drmP.h
 
-static int drm_name_info(char *buf, char **start, off_t offset,
-int request, int *eof, void *data);
-static int drm_vm_info(char *buf, char **start, off_t offset,
-  int request, int *eof, void *data);
-static int drm_clients_info(char *buf, char **start, off_t offset,
-   int request, int *eof, void *data);
-static int drm_queues_info(char *buf, char **start, off_t offset,
-  int request, int *eof, void *data);
-static int drm_bufs_info(char *buf, char **start, off_t offset,
-int request, int *eof, void *data);
-static int drm_gem_name_info(char *buf, char **start, off_t offset,
-int request, int *eof, void *data);
-static int drm_gem_object_info(char *buf, char **start, off_t offset,
-  int request, int *eof, void *data);
-#if DRM_DEBUG_CODE
-static int drm_vma_info(char *buf, char **start, off_t offset,
-   int request, int *eof, void *data);
-#endif
-
-/**
- * Proc file list.
- */
-static struct drm_proc_list {
-   const char *name;   /** file name */
-   int (*f) (char *, char **, off_t, int, int *, void *);  /** 
proc callback*/
-   u32 driver_features; /** Required driver features for this entry */
-} drm_proc_list[] = {
-   {name, drm_name_info, 0},
-   {mem, drm_mem_info, 0},
-   {vm, drm_vm_info, 0},
-   {clients, drm_clients_info, 0},
-   {queues, drm_queues_info, 0},
-   {bufs, drm_bufs_info, 0},
-   {gem_names, drm_gem_name_info, DRIVER_GEM},
-   {gem_objects, drm_gem_object_info, DRIVER_GEM},
-#if DRM_DEBUG_CODE
-   {vma, drm_vma_info},
-#endif
-};
-
-#define DRM_PROC_ENTRIES ARRAY_SIZE(drm_proc_list)
-
-/**
- * Initialize the DRI proc filesystem for a device.
- *
- * \param dev DRM device.
- * \param minor device minor number.
- * \param root DRI proc dir entry.
- * \param dev_root resulting DRI device proc dir entry.
- * \return root entry pointer on success, or NULL on failure.
- *
- * Create the DRI proc root entry /proc/dri, the device proc root entry
- * /proc/dri/%minor%/, and each entry in proc_list as
- * /proc/dri/%minor%/%name%.
- */
-int drm_proc_init(struct drm_minor *minor, int minor_id,
- struct proc_dir_entry *root)
-{
-   struct drm_device *dev = minor-dev;
-   struct proc_dir_entry *ent;
-   int i, j, ret;
-   char name[64];
-
-   sprintf(name, %d, minor_id);
-   minor-dev_root = proc_mkdir(name, root);
-   if (!minor-dev_root) {
-   DRM_ERROR(Cannot create /proc/dri/%s\n, name);
-   return -1;
-   }
-
-   for (i = 0; i  DRM_PROC_ENTRIES; i++) {
-   u32 features = drm_proc_list[i].driver_features;
-
-   if (features != 0 
-   (dev-driver-driver_features  features) != features)
-   continue;
-
-   ent = create_proc_entry(drm_proc_list[i].name,
-   S_IFREG | S_IRUGO, minor-dev_root);
-   if (!ent) {
-   DRM_ERROR(Cannot create /proc/dri/%s/%s\n,
- name, drm_proc_list[i].name);
-   ret = -1;
-   goto fail;
-   }
-   ent-read_proc = drm_proc_list[i].f;
-   ent-data = minor;
-   }
-
-   if (dev-driver-proc_init) {
-   ret = dev-driver-proc_init(minor);
-   if (ret) {
-   DRM_ERROR(DRM: Driver failed to initialize 
- /proc/dri.\n);
-   goto fail;
-   }
-   }
-
-   return 0;
- fail:
-
-   for (j = 0; j  i; j++)
-   remove_proc_entry(drm_proc_list[i].name,
- minor-dev_root);
-   remove_proc_entry(name, root);
-   minor-dev_root = NULL;
-   return ret;
-}
-
-/**
- * Cleanup the proc filesystem resources.
- *
- * \param minor device minor number.
- * \param root DRI proc dir entry.
- * \param dev_root DRI device proc dir entry.
- * \return always zero.
- *
- * Remove all proc entries created by proc_init().
- */
-int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root)
-{
-   struct drm_device *dev = minor-dev;
-   int i;
-   char name[64];
-
-   if (!root || !minor-dev_root)
-   return 0;
-
-   if (dev-driver-proc_cleanup)
-   dev-driver-proc_cleanup(minor);
-
-   

Re: [i915 drm] irq 16: nobody cared with latest git kernels

2008-12-02 Thread Ben Gamari
This bug was first reported a few weeks ago and it seems still hasn't
been resolved for some. The bug report can be found here,
https://bugs.freedesktop.org/show_bug.cgi?id=18609 .

- Ben


On Tue, 2008-12-02 at 14:21 +0100, fredi ml wrote:
 Hi all,
 lately starting from kernel 2.6.28-rc6-00142-g9bd062d I'm getting this
 traces: 
 
 Dec  1 12:09:34 kotys irq 16: nobody cared (try booting with the
 irqpoll option)
 Dec  1 12:09:34 kotys Pid: 3617, comm: X Not tainted
 2.6.28-rc6-00142-g9bd062d #17
 Dec  1 12:09:34 kotys Call Trace:
 Dec  1 12:09:34 kotys IRQ  [80262a11] __report_bad_irq
 +0x3d/0x8c
 Dec  1 12:09:34 kotys [80262b73] note_interrupt+0x113/0x178
 Dec  1 12:09:34 kotys [80263271] handle_fasteoi_irq
 +0xa6/0xca
 Dec  1 12:09:34 kotys [8020d8ab] do_IRQ+0x7b/0xec
 Dec  1 12:09:34 kotys [8020b9f6] ret_from_intr+0x0/0xa
 Dec  1 12:09:34 kotys EOI 3handlers:
 Dec  1 12:09:34 kotys [a036f497] (i915_driver_irq_handler
 +0x0/0x1f5 [i915])
 Dec  1 12:09:34 kotys Disabling IRQ #16
 
 ---
 Dec  1 19:14:11 kotys irq 16: nobody cared (try booting with the
 irqpoll option)
 Dec  1 19:14:11 kotys Pid: 4042, comm: firefox Not tainted
 2.6.28-rc6-00184-gd9d060a #18
 Dec  1 19:14:11 kotys Call Trace:
 Dec  1 19:14:11 kotys IRQ  [80262a11] __report_bad_irq
 +0x3d/0x8c
 Dec  1 19:14:11 kotys [80262b73] note_interrupt+0x113/0x178
 Dec  1 19:14:11 kotys [80263271] handle_fasteoi_irq
 +0xa6/0xca
 Dec  1 19:14:11 kotys [8020d8ab] do_IRQ+0x7b/0xec
 Dec  1 19:14:11 kotys [8020b9f6] ret_from_intr+0x0/0xa
 Dec  1 19:14:11 kotys EOI 3handlers:
 Dec  1 19:14:11 kotys [a036c497] (i915_driver_irq_handler
 +0x0/0x1f5 [i915])
 Dec  1 19:14:11 kotys Disabling IRQ #16
 
 
 Dec  2 13:31:23 kotys Pid: 6512, comm: ebuild Not tainted 2.6.28-rc7
 #19
 Dec  2 13:31:23 kotys Call Trace:
 Dec  2 13:31:23 kotys IRQ  [80262a0d] __report_bad_irq
 +0x3d/0x8c
 Dec  2 13:31:23 kotys [80262b6f] note_interrupt+0x113/0x178
 Dec  2 13:31:23 kotys [8026326d] handle_fasteoi_irq
 +0xa6/0xca
 Dec  2 13:31:23 kotys [8020d8ab] do_IRQ+0x7b/0xec
 Dec  2 13:31:23 kotys [8020b9f6] ret_from_intr+0x0/0xa
 Dec  2 13:31:23 kotys EOI 3handlers:
 Dec  2 13:31:23 kotys [a036b497] (i915_driver_irq_handler
 +0x0/0x1f5 [i915])
 Dec  2 13:31:23 kotys Disabling IRQ #16
 
 
 Actually now that i notice all the log seems the same except the
 kernel version that's from git. After this traces interrupt 16 is not
 incrteasing in /proc/interrupts anymore (as suggested by the last log
 line) and Xorg is all slugish, barely usable. Noticing that there were
 modifications on the i915 driver i waited till now to report this but
 none of the last patches got rid of this issue so here is the log.
 Right now i booted adding irqpoll on the command line and i see in
 dmesg this one:
 
 Kernel command line: root=/dev/sda2 rootflags=data=writeback irqpoll
 Misrouted IRQ fixup and polling support enabled
 This may significantly impact system performance
 
 Though everything seems normal for now. The trace happens usually when
 the system is under load but it's not that predictable so for now i
 cant tell if using irqpoll is avoiding hitting this issue. I'll let
 you know if it happens again.
 Just ask for info or whatever patches to test ecc. is needed, i'll be
 glad to help.
 And of course thank you guys for your work.
 
 Frederik
 
 -
 This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
 Build the coolest Linux based applications with Moblin SDK  win great prizes
 Grand prize is a trip for two to an Open Source event anywhere in the world
 http://moblin-contest.org/redirect.php?banner_id=100url=/
 -- ___ Dri-devel mailing list 
 Dri-devel@lists.sourceforge.net 
 https://lists.sourceforge.net/lists/listinfo/dri-devel


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


Re: Status of everything?

2008-07-11 Thread Ben Gamari
On the note of GEM, would it be worth pulling down the GEM trees to play
around with and submit bugs against? Is the code in a state at all
resembling stable (can you run a moderately standard X session for more
than 10 seconds)? I'd be glad to start reporting if so. Thanks,

- Ben


On Wed, 2008-07-09 at 01:52 +0300, Daniel Stone wrote:
 Hi,
 
 On Wed, Jul 09, 2008 at 12:31:22AM +0300, Maxim Levitsky wrote:
  Last time I checked modesetting,
 
 This works.
 
  intel-batchbuffer,
 
 This works.
 
  dri2,
 
 This works.
 
  And lastly, just for a thought, maybe it is better to do one thing at 
  time, for example stabilize kernel modesetting, put it in kernel, then 
  release gem driver and stabilize it, and then add dri2 to it?
 
 I'm sure the developers working on modesetting, the developers working
 on GEM, and the developers working on DRI2 (three independent sets of
 people) would more than appreciate patches, or even specific bug reports
 they can fix.
 
 Short of that, I'm not sure which problem you're actually trying to
 solve.
 
 Cheers,
 Daniel
 -
 Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
 Studies have shown that voting for your favorite open source project,
 along with a healthy diet, reduces your potential for chronic lameness
 and boredom. Vote Now at http://www.sourceforge.net/community/cca08
 -- ___ Dri-devel mailing list 
 Dri-devel@lists.sourceforge.net 
 https://lists.sourceforge.net/lists/listinfo/dri-devel


-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


Re: [Mesa3d-dev] intel-batchbuffer with DRI2

2008-04-06 Thread Ben Gamari
I'm definitely in the same position here (still). I looked into the
issue with gdb and I also observed no FBConfigs being returned. Any
input?

- Ben


On Sun, 2008-04-06 at 02:33 +0200, Johannes Engel wrote:
 Hi, Kristian and the rest of the DRI world! ;)
 
 Testing your most recent DRI2 work on my 945GM I ran into trouble 
 starting compiz.
 Digging a little bit deeper I recognized, that glXGetFBConfigs seems not 
 to return any FBConfig at all.
 But glxinfo lists a whole lot of them:
 
 ~/software/mesa/progs/xdemos ./glxinfo
 name of display: :0.0
 calling DRI2CreateDrawable, XID 0x423, GLX ID 0x423
 success, head 0x998, handle 0x1f
 display: :0  screen: 0
 direct rendering: Yes
 server glx vendor string: SGI
 server glx version string: 1.2
 server glx extensions:
 GLX_ARB_multisample, GLX_EXT_import_context, 
 GLX_EXT_texture_from_pixmap,
 GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_MESA_copy_sub_buffer,
 GLX_OML_swap_method, GLX_SGI_swap_control, GLX_SGIS_multisample,
 GLX_SGIX_fbconfig, GLX_SGIX_visual_select_group
 client glx vendor string: SGI
 client glx version string: 1.4
 client glx extensions:
 GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_import_context,
 GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_MESA_allocate_memory,
 GLX_MESA_copy_sub_buffer, GLX_MESA_swap_control,
 GLX_MESA_swap_frame_usage, GLX_OML_swap_method, GLX_OML_sync_control,
 GLX_SGI_make_current_read, GLX_SGI_swap_control, GLX_SGI_video_sync,
 GLX_SGIS_multisample, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer,
 GLX_SGIX_visual_select_group, GLX_EXT_texture_from_pixmap
 GLX version: 1.2
 GLX extensions:
 GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_import_context,
 GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_MESA_swap_control,
 GLX_MESA_swap_frame_usage, GLX_OML_swap_method, GLX_SGI_swap_control,
 GLX_SGI_video_sync, GLX_SGIS_multisample, GLX_SGIX_fbconfig,
 GLX_SGIX_visual_select_group, GLX_EXT_texture_from_pixmap
 OpenGL vendor string: Tungsten Graphics, Inc
 OpenGL renderer string: Mesa DRI Intel(R) 945GM 20061102 x86/MMX/SSE2
 OpenGL version string: 1.4 Mesa 7.1
 OpenGL extensions:
 GL_ARB_depth_texture, GL_ARB_fragment_program, GL_ARB_multisample,
 GL_ARB_multitexture, GL_ARB_pixel_buffer_object, 
 GL_ARB_point_parameters,
 GL_ARB_shadow, GL_ARB_texture_border_clamp, GL_ARB_texture_compression,
 GL_ARB_texture_cube_map, GL_ARB_texture_env_add,
 GL_ARB_texture_env_combine, GL_ARB_texture_env_crossbar,
 GL_ARB_texture_env_dot3, GL_ARB_texture_mirrored_repeat,
 GL_ARB_texture_non_power_of_two, GL_ARB_texture_rectangle,
 GL_ARB_transpose_matrix, GL_ARB_vertex_buffer_object,
 GL_ARB_vertex_program, GL_ARB_window_pos, GL_EXT_abgr, GL_EXT_bgra,
 GL_EXT_blend_color, GL_EXT_blend_equation_separate,
 GL_EXT_blend_func_separate, GL_EXT_blend_logic_op, GL_EXT_blend_minmax,
 GL_EXT_blend_subtract, GL_EXT_clip_volume_hint, GL_EXT_cull_vertex,
 GL_EXT_compiled_vertex_array, GL_EXT_copy_texture,
 GL_EXT_draw_range_elements, GL_EXT_framebuffer_object, GL_EXT_fog_coord,
 GL_EXT_multi_draw_arrays, GL_EXT_packed_depth_stencil,
 GL_EXT_packed_pixels, GL_EXT_pixel_buffer_object, 
 GL_EXT_point_parameters,
 GL_EXT_polygon_offset, GL_EXT_rescale_normal, GL_EXT_secondary_color,
 GL_EXT_separate_specular_color, GL_EXT_shadow_funcs, 
 GL_EXT_stencil_wrap,
 GL_EXT_subtexture, GL_EXT_texture, GL_EXT_texture3D,
 GL_EXT_texture_edge_clamp, GL_EXT_texture_env_add,
 GL_EXT_texture_env_combine, GL_EXT_texture_env_dot3,
 GL_EXT_texture_filter_anisotropic, GL_EXT_texture_lod_bias,
 GL_EXT_texture_object, GL_EXT_texture_rectangle, GL_EXT_vertex_array,
 GL_3DFX_texture_compression_FXT1, GL_APPLE_client_storage,
 GL_APPLE_packed_pixels, GL_ATI_blend_equation_separate,
 GL_ATI_separate_stencil, GL_IBM_rasterpos_clip,
 GL_IBM_texture_mirrored_repeat, GL_INGR_blend_func_separate,
 GL_MESA_pack_invert, GL_MESA_ycbcr_texture, GL_MESA_window_pos,
 GL_NV_blend_square, GL_NV_light_max_exponent, GL_NV_point_sprite,
 GL_NV_texture_rectangle, GL_NV_texgen_reflection, GL_NV_vertex_program,
 GL_NV_vertex_program1_1, GL_OES_read_format, GL_SGIS_generate_mipmap,
 GL_SGIS_texture_border_clamp, GL_SGIS_texture_edge_clamp,
 GL_SGIS_texture_lod, GL_SGIX_depth_texture, GL_SUN_multi_draw_arrays
 
 3 GLX Visuals
visual  x  bf lv rg d st colorbuffer ax dp st accumbuffer  ms  cav
  id dep cl sp sz l  ci b ro  r  g  b  a bf th cl  r  g  b  a ns b eat
 --
 0x21 24 tc  0 32  0 r  y  .  8  8  8  8  0 24  8  0  0  0  0  0 0 None
 0x22 24 dc  0 32  0 r  y  .  8  8  8  8  0 24  8  0  0  0  0  0 0 None
 0x56 32 tc  0 32  0 r  .  .  8  8  8  8  0  0  0  0  0  0  0  0 0 None
 
 36 GLXFBConfigs:
visual  x  bf lv rg d st colorbuffer ax dp st accumbuffer  ms  cav
  id dep cl sp sz l  ci b ro  r  g  

DRI card reinitialization after suspend

2005-12-30 Thread Ben Gamari
Howdy all! What is the present status of S3 suspend support in the DRI?
I ask because my laptop locks up with a scrambled screen on resume from
S3 standby when using the radeon driver with DRI enabled. This is a
known problem with the DRI drivers and as such, at least one workaround
has be devised. Supposedly, starting an X server before switching to the
original X session after resume prevents the freeze, although I have
been unable to verify this. Is there some missing code for state
restoration/reinitialization of the card? I thought these
(http://cpbotha.net/dri_resume.html) patches were supposed to solve the
What would be the best way to start debugging this problem (littering
the code with debug outputs sent over the network perhaps?)? What can I
do (code) to make suspend support more reliable on the R300? Thanks a
ton.

- Ben

P.S. R300 RENDER support is coming along nicely, although I have up to
this point be primarily writing test-bench code so that I might better
understand the workings of the card.




---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637alloc_id=16865op=click
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


R300 RENDER Support

2005-12-13 Thread Ben Gamari
Hi All,

I am a college student looking for a bit of a project to tackle over
winter break (having no car really sucks) with quite a bit of
programming experience. While I have never worked with driver
development, I have a good working knowledge of graphics hardware and
architecture. My laptop having a Radeon Mobility X300, I have an
interest in advancing X300 support, in particular the RENDER extension
(3D I suspect is a little over my head). Are there any roadblocks in the
way of moving forward with RENDER support in the DRI drivers? Or perhaps
more importantly, is a relative graphics novice such as myself capable
of X300 RENDER development? If so, where is a good place to start? I
understand that there are no specs for the X300 (at least on the 3D
side, is the 2D engine documented?), so does most work come from reverse
engineering the ATI binary driver? What tools can be used in tracing the
operation of the driver? Does it entail just tracing the instruction
flow with a disassembler? I look forward to hopefully working with you
guys in the future (exams end next Thursday :( ) Thanks for your time,

- Ben Gamari




---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637alloc_id=16865op=click
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel