[Intel-gfx] [RFC] [Patch] [DRM] :Separate several DRM debug levels

Dave Airlie airlied at gmail.com
Fri May 15 11:21:40 CEST 2009


> Now all the DRM debug info will be printed if the boot option of
> "drm.debug=1" is added. Sometimes it is inconvenient. We will get too much
> unrelated info.
>
> This will separate several DRM debug levels and the debug level can be used
> to print the different debug info. And the debug level is controlled by the
> module parameter of drm.debug
>        In this patch it is divided into four debug levels;
>        drm_core, drm_driver, drm_kms, drm_mode.
>
> At the same time four debug macro definitions are provided.
>        DRM_DEBUG(fmt, args...)
>        DRM_DEBUG_DRIVER(prefix, fmt, args...)
>        DRM_DEBUG_KMS(prefix, fmt, args...)
>        DRM_DEBUG_MODE(prefix, fmt, args...)
>
> When the boot option of "drm.debug=1" is added, it will print the debug info
> using DRM_DEBUG. This is to be compatible with
> When the boot option of "drm.debug=4" is added, it will print the debug info
> using DRM_DEBUG_KMS macro definition.
> When the boot option of "drm.debug=6" is added, it will print the debug info
> using DRM_DEBUG_KMS and DRM_DEBUG_DRIVE.
>
> When the DRM_DEBUG is used, the default prefix is "drm".
> When the DRM_DEBUG_DRIVER/KMS/MODE is used, we can use the different prefix.
> For example: When DRM_DEBUG_KMS is used in the drivers/gpu/drm/i915/intel_lvds.c,
> we can use the "i915_lvds" as the prefix.
>

I'm just wondering if we can leverage the kernel debug printing stuff
for all this, I like the idea of what
you are trying to do alright, its crazy trying to debug using the
current single path.

I'm on holidays so can't review too much, but I'd like to see people
discuss the kernel debug printing
system and also the split between debug categories.

Dave.

>
> Signed-off-by: Zhao Yakui <yakui.zhao at intel.com>
> ---
>  drivers/gpu/drm/drm_stub.c |   14 ++++++++++++++
>  include/drm/drmP.h         |   36 +++++++++++++++++++++++++++++++-----
>  2 files changed, 45 insertions(+), 5 deletions(-)
>
> Index: linux-2.6/drivers/gpu/drm/drm_stub.c
> ===================================================================
> --- linux-2.6.orig/drivers/gpu/drm/drm_stub.c   2009-05-15 13:53:06.000000000 +0800
> +++ linux-2.6/drivers/gpu/drm/drm_stub.c        2009-05-15 13:56:07.000000000 +0800
> @@ -51,7 +51,21 @@
>  struct class *drm_class;
>  struct proc_dir_entry *drm_proc_root;
>  struct dentry *drm_debugfs_root;
> +void drm_ut_debug_printk(unsigned int request_level,
> +                        const char *prefix,
> +                        const char *function_name,
> +                        const char *format, ...)
> +{
> +       va_list args;
>
> +       if (drm_debug & request_level) {
> +               printk(KERN_DEBUG "[%s:%s] ,", prefix, function_name);
> +               va_start(args, format);
> +               printk(format, args);
> +               va_end(args);
> +       }
> +}
> +EXPORT_SYMBOL(drm_ut_debug_printk);
>  static int drm_minor_get_id(struct drm_device *dev, int type)
>  {
>        int new_id;
> Index: linux-2.6/include/drm/drmP.h
> ===================================================================
> --- linux-2.6.orig/include/drm/drmP.h   2009-04-16 16:10:40.000000000 +0800
> +++ linux-2.6/include/drm/drmP.h        2009-05-15 14:40:02.000000000 +0800
> @@ -87,6 +87,15 @@
>  #include "drm_os_linux.h"
>  #include "drm_hashtab.h"
>
> +#define DRM_UT_CORE            0x01
> +#define DRM_UT_DRIVER          0x02
> +#define DRM_UT_KMS             0x04
> +#define DRM_UT_MODE            0x08
> +
> +extern void drm_ut_debug_printk(unsigned int request_level,
> +                               const char *prefix,
> +                               const char *function_name,
> +                               const char *format, ...);
>  /***********************************************************************/
>  /** \name DRM template customization defaults */
>  /*@{*/
> @@ -186,14 +195,31 @@
>  * \param arg arguments
>  */
>  #if DRM_DEBUG_CODE
> -#define DRM_DEBUG(fmt, arg...)                                         \
> +#define DRM_DEBUG(fmt, args...)                                                \
>        do {                                                            \
> -               if ( drm_debug )                        \
> -                       printk(KERN_DEBUG                               \
> -                              "[" DRM_NAME ":%s] " fmt ,       \
> -                              __func__ , ##arg);                       \
> +               drm_ut_debug_printk(DRM_UT_CORE, DRM_NAME,              \
> +                                       __func__, fmt, ##args);         \
> +       } while (0)
> +
> +#define DRM_DEBUG_DRIVER(prefix, fmt, args...)                         \
> +       do {                                                            \
> +               drm_ut_debug_printk(DRM_UT_DRIVER, prefix,              \
> +                                       __func__, fmt, ##args);         \
> +       } while (0)
> +#define DRM_DEBUG_KMS(prefix, fmt, args...)                            \
> +       do {                                                            \
> +               drm_ut_debug_printk(DRM_UT_KMS, prefix,                 \
> +                                        __func__, fmt, ##args);        \
> +       } while (0)
> +#define DRM_DEBUG_MODE(prefix, fmt, args...)                           \
> +       do {                                                            \
> +               drm_ut_debug_printk(DRM_UT_MODE, prefix,                \
> +                                        __func__, fmt, ##args);        \
>        } while (0)
>  #else
> +#define DRM_DEBUG_DRIVER(prefix, fmt, args...) do { } while (0)
> +#define DRM_DEBUG_KMS(prefix, fmt, args...)    do { } while (0)
> +#define DRM_DEBUG_MODE(prefix, fmt, args...)   do { } while (0)
>  #define DRM_DEBUG(fmt, arg...)          do { } while (0)
>  #endif
>
>
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>



More information about the Intel-gfx mailing list