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

yakui_zhao yakui.zhao at intel.com
Thu Jun 11 03:10:04 CEST 2009


On Thu, 2009-06-11 at 06:14 +0800, Ben Gamari wrote:
Hi, Ben
    ´╗┐thanks for your effort.
    In fact the intel_reg_dump tool under the intel
driver( src/reg_dumper/intel_reg_dump) still can be used in KMS mode.
Is that enough for you?

    And I have three questions about this patch:
    a. there is no register definition in some register ranges. And it
is unnecessary to dump it. Even when there exists the register
definitions, it is meaningless for some platforms.(For example: LVDS
port for non-mobile platform)
    b. In this patch the reg index/value is exposed. I don't know
whether it is appropriate for intel_gpu_tool
    c. the memory allocation. In this patch it will dump more than 64K.
Then the memory buffer related with seq_file will be freed/allocated
several times.  And the function of i915_register_info is also called
several times.

Thanks.
    Yakui
> ---
>  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
> 
> 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);




More information about the Intel-gfx mailing list