[Intel-gfx] [PATCH] Add i915 register dumping debugfs file

Eric Anholt eric at anholt.net
Wed Jun 17 23:38:41 CEST 2009


On Wed, 2009-06-10 at 18:14 -0400, Ben Gamari wrote:
> ---
>  drivers/gpu/drm/i915/Makefile       |    1 +
>  drivers/gpu/drm/i915/i915_debugfs.c |   58 +++++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/i915/i915_drv.c     |    4 +-
>  drivers/gpu/drm/i915/i915_drv.h     |    4 ++
>  4 files changed, 65 insertions(+), 2 deletions(-)
>  create mode 100644 drivers/gpu/drm/i915/i915_debugfs.c

Do we really need to make a separate file for non-GEM, given that
non-GEM shouldn't exist any more?  If anything, I'd rather that
i915_gem_debugfs.c just got moved to i915_debugfs.c.

Anyway, if this was the patch we went with, lacks licensing in the new
file, which is inconsistent with the rest of the codebase.

> 
> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index 51c5a05..b842742 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -5,6 +5,7 @@
>  ccflags-y := -Iinclude/drm
>  i915-y := i915_drv.o i915_dma.o i915_irq.o i915_mem.o \
>            i915_suspend.o \
> +	  i915_debugfs.o \
>  	  i915_gem.o \
>  	  i915_gem_debug.o \
>  	  i915_gem_debugfs.o \
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> new file mode 100644
> index 0000000..a5d5bf3
> --- /dev/null
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -0,0 +1,58 @@
> +#include <linux/seq_file.h>
> +#include "drmP.h"
> +#include "drm.h"
> +#include "i915_drm.h"
> +#include "i915_drv.h"
> +
> +#if defined(CONFIG_DEBUG_FS)
> +
> +static int i915_registers_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;
> +	uint32_t reg;
> +
> +#define DUMP_RANGE(start, end) \
> +	for (reg=start; reg < end; reg += 4) \
> +		seq_printf(m, "%08x\t%08x\n", reg, I915_READ(reg));
> +
> +	DUMP_RANGE(0x00000, 0x00fff);	/* VGA registers */
> +	DUMP_RANGE(0x02000, 0x02fff);	/* instruction, memory, interrupt control registers */
> +	DUMP_RANGE(0x03000, 0x031ff);	/* FENCE and PPGTT control registers */
> +	DUMP_RANGE(0x03200, 0x03fff);	/* frame buffer compression registers */
> +	DUMP_RANGE(0x05000, 0x05fff);	/* I/O control registers */
> +	DUMP_RANGE(0x06000, 0x06fff);	/* clock control registers */
> +	DUMP_RANGE(0x07000, 0x07fff);	/* 3D internal debug registers */
> +	DUMP_RANGE(0x07400, 0x088ff);	/* GPE debug registers */
> +	DUMP_RANGE(0x0a000, 0x0afff);	/* display palette registers */
> +	DUMP_RANGE(0x10000, 0x13fff);	/* MMIO MCHBAR */
> +	DUMP_RANGE(0x30000, 0x3ffff);	/* overlay registers */
> +	DUMP_RANGE(0x60000, 0x6ffff);	/* display engine pipeline registers */
> +	DUMP_RANGE(0x70000, 0x72fff);	/* display and cursor registers */
> +	DUMP_RANGE(0x73000, 0x73fff);	/* performance counters */
> +
> +	return 0;
> +}
> +
> +static struct drm_info_list i915_debugfs_list[] = {
> +	{"i915_regs", i915_registers_info, 0},
> +};
> +#define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
> +
> +int i915_debugfs_init(struct drm_minor *minor)
> +{
> +	i915_gem_debugfs_init(minor);
> +	return drm_debugfs_create_files(i915_debugfs_list,
> +					I915_DEBUGFS_ENTRIES,
> +					minor->debugfs_root, minor);
> +}
> +
> +void i915_debugfs_cleanup(struct drm_minor *minor)
> +{
> +	i915_gem_debugfs_cleanup(minor);
> +	drm_debugfs_remove_files(i915_debugfs_list,
> +				 I915_DEBUGFS_ENTRIES, minor);
> +}
> +
> +#endif /* CONFIG_DEBUG_FS */
> +
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 98560e1..3bbdddf 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -183,8 +183,8 @@ static struct drm_driver driver = {
>  	.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,
> +	.debugfs_init = i915_debugfs_init,
> +	.debugfs_cleanup = i915_debugfs_cleanup,
>  #endif
>  	.gem_init_object = i915_gem_init_object,
>  	.gem_free_object = i915_gem_free_object,
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index b03f6ea..787399f 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -705,6 +705,10 @@ void i915_dump_lru(struct drm_device *dev, const char *where);
>  int i915_gem_debugfs_init(struct drm_minor *minor);
>  void i915_gem_debugfs_cleanup(struct drm_minor *minor);
>  
> +/* i915_debugfs.c */
> +int i915_debugfs_init(struct drm_minor *minor);
> +void i915_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);
-- 
Eric Anholt
eric at anholt.net                         eric.anholt at intel.com


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20090617/bbe63f51/attachment.sig>


More information about the Intel-gfx mailing list