[Intel-gfx] [PATCH 1/4] DRM: Remove the unused prefix in DRM_DEBUG_KMS/DRIVER/MODE

ykzhao yakui.zhao at intel.com
Thu Jul 30 02:42:16 CEST 2009


On Mon, 2009-07-20 at 13:48 +0800, Zhao, Yakui wrote:
Hi, Dave
    How about this patch set?
    Before it is shipped, we can't use the DRM_DEBUG_KMS/DRIVER to add
the debug info.
    thanks.
> From: Zhao Yakui <yakui.zhao at intel.com>
> 
> We will have to add a prefix when using the macro defintion of DRM_DEBUG_KMS
> /DRM_DEBUG_DRIVER/MODE. It is not convenient. We should use the DRM_NAME
> as default prefix.
> So remove the prefix in the macro definition of DRM_DEBUG_KMS/DRIVER/MODE.
> 
> Signed-off-by: Zhao Yakui <yakui.zhao at intel.com>
> Acked-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
>  drivers/gpu/drm/drm_modes.c       |    8 +++-----
>  drivers/gpu/drm/i915/i915_dma.c   |   35 +++++++++++++++--------------------
>  drivers/gpu/drm/i915/intel_lvds.c |   10 +++-------
>  drivers/gpu/drm/i915/intel_sdvo.c |   31 ++++++++++++++-----------------
>  include/drm/drmP.h                |   18 +++++++++---------
>  5 files changed, 44 insertions(+), 58 deletions(-)
> 
> Index: linux-2.6/include/drm/drmP.h
> ===================================================================
> --- linux-2.6.orig/include/drm/drmP.h   2009-07-16 13:53:24.000000000 +0800
> +++ linux-2.6/include/drm/drmP.h        2009-07-16 13:53:38.000000000 +0800
> @@ -174,19 +174,19 @@
>                                         __func__, fmt, ##args);         \
>         } while (0)
> 
> -#define DRM_DEBUG_DRIVER(prefix, fmt, args...)                         \
> +#define DRM_DEBUG_DRIVER(fmt, args...)                                 \
>         do {                                                            \
> -               drm_ut_debug_printk(DRM_UT_DRIVER, prefix,              \
> +               drm_ut_debug_printk(DRM_UT_DRIVER, DRM_NAME,            \
>                                         __func__, fmt, ##args);         \
>         } while (0)
> -#define DRM_DEBUG_KMS(prefix, fmt, args...)                            \
> +#define DRM_DEBUG_KMS(fmt, args...)                            \
>         do {                                                            \
> -               drm_ut_debug_printk(DRM_UT_KMS, prefix,                 \
> +               drm_ut_debug_printk(DRM_UT_KMS, DRM_NAME,               \
>                                          __func__, fmt, ##args);        \
>         } while (0)
> -#define DRM_DEBUG_MODE(prefix, fmt, args...)                           \
> +#define DRM_DEBUG_MODE(fmt, args...)                           \
>         do {                                                            \
> -               drm_ut_debug_printk(DRM_UT_MODE, prefix,                \
> +               drm_ut_debug_printk(DRM_UT_MODE, DRM_NAME,              \
>                                          __func__, fmt, ##args);        \
>         } while (0)
>  #define DRM_LOG(fmt, args...)                                          \
> @@ -210,9 +210,9 @@
>                                         NULL, 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_DRIVER(fmt, args...) do { } while (0)
> +#define DRM_DEBUG_KMS(fmt, args...)    do { } while (0)
> +#define DRM_DEBUG_MODE(fmt, args...)   do { } while (0)
>  #define DRM_DEBUG(fmt, arg...)          do { } while (0)
>  #define DRM_LOG(fmt, arg...)           do { } while (0)
>  #define DRM_LOG_KMS(fmt, args...) do { } while (0)
> Index: linux-2.6/drivers/gpu/drm/drm_modes.c
> ===================================================================
> --- linux-2.6.orig/drivers/gpu/drm/drm_modes.c  2009-07-16 13:53:24.000000000 +0800
> +++ linux-2.6/drivers/gpu/drm/drm_modes.c       2009-07-16 13:53:38.000000000 +0800
> @@ -38,7 +38,6 @@
>  #include "drm.h"
>  #include "drm_crtc.h"
> 
> -#define DRM_MODESET_DEBUG      "drm_mode"
>  /**
>   * drm_mode_debug_printmodeline - debug print a mode
>   * @dev: DRM device
> @@ -51,8 +50,8 @@
>   */
>  void drm_mode_debug_printmodeline(struct drm_display_mode *mode)
>  {
> -       DRM_DEBUG_MODE(DRM_MODESET_DEBUG,
> -               "Modeline %d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x\n",
> +       DRM_DEBUG_MODE("Modeline %d:\"%s\" %d %d %d %d %d %d %d %d %d %d "
> +                       "0x%x 0x%x\n",
>                 mode->base.id, mode->name, mode->vrefresh, mode->clock,
>                 mode->hdisplay, mode->hsync_start,
>                 mode->hsync_end, mode->htotal,
> @@ -403,8 +402,7 @@
>                         list_del(&mode->head);
>                         if (verbose) {
>                                 drm_mode_debug_printmodeline(mode);
> -                               DRM_DEBUG_MODE(DRM_MODESET_DEBUG,
> -                                       "Not using %s mode %d\n",
> +                               DRM_DEBUG_MODE("Not using %s mode %d\n",
>                                         mode->name, mode->status);
>                         }
>                         drm_mode_destroy(dev, mode);
> Index: linux-2.6/drivers/gpu/drm/i915/i915_dma.c
> ===================================================================
> --- linux-2.6.orig/drivers/gpu/drm/i915/i915_dma.c      2009-07-16 13:53:24.000000000 +0800
> +++ linux-2.6/drivers/gpu/drm/i915/i915_dma.c   2009-07-16 13:53:38.000000000 +0800
> @@ -33,8 +33,6 @@
>  #include "i915_drm.h"
>  #include "i915_drv.h"
> 
> -#define I915_DRV       "i915_drv"
> -
>  /* Really want an OS-independent resettable timer.  Would like to have
>   * this loop run for (eg) 3 sec, but have the timer reset every time
>   * the head pointer changes, so that EBUSY only happens if the ring
> @@ -101,7 +99,7 @@
>         memset(dev_priv->hw_status_page, 0, PAGE_SIZE);
> 
>         I915_WRITE(HWS_PGA, dev_priv->dma_status_page);
> -       DRM_DEBUG_DRIVER(I915_DRV, "Enabled hardware status page\n");
> +       DRM_DEBUG_DRIVER("Enabled hardware status page\n");
>         return 0;
>  }
> 
> @@ -187,8 +185,7 @@
>                 master_priv->sarea_priv = (drm_i915_sarea_t *)
>                         ((u8 *)master_priv->sarea->handle + init->sarea_priv_offset);
>         } else {
> -               DRM_DEBUG_DRIVER(I915_DRV,
> -                               "sarea not found assuming DRI2 userspace\n");
> +               DRM_DEBUG_DRIVER("sarea not found assuming DRI2 userspace\n");
>         }
> 
>         if (init->ring_size != 0) {
> @@ -238,7 +235,7 @@
>  {
>         drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
> 
> -       DRM_DEBUG_DRIVER(I915_DRV, "%s\n", __func__);
> +       DRM_DEBUG_DRIVER("%s\n", __func__);
> 
>         if (dev_priv->ring.map.handle == NULL) {
>                 DRM_ERROR("can not ioremap virtual address for"
> @@ -251,14 +248,14 @@
>                 DRM_ERROR("Can not find hardware status page\n");
>                 return -EINVAL;
>         }
> -       DRM_DEBUG_DRIVER(I915_DRV, "hw status page @ %p\n",
> +       DRM_DEBUG_DRIVER("hw status page @ %p\n",
>                                 dev_priv->hw_status_page);
> 
>         if (dev_priv->status_gfx_addr != 0)
>                 I915_WRITE(HWS_PGA, dev_priv->status_gfx_addr);
>         else
>                 I915_WRITE(HWS_PGA, dev_priv->dma_status_page);
> -       DRM_DEBUG_DRIVER(I915_DRV, "Enabled hardware status page\n");
> +       DRM_DEBUG_DRIVER("Enabled hardware status page\n");
> 
>         return 0;
>  }
> @@ -552,7 +549,7 @@
>         if (!master_priv->sarea_priv)
>                 return -EINVAL;
> 
> -       DRM_DEBUG_DRIVER(I915_DRV, "%s: page=%d pfCurrentPage=%d\n",
> +       DRM_DEBUG_DRIVER("%s: page=%d pfCurrentPage=%d\n",
>                           __func__,
>                          dev_priv->current_page,
>                          master_priv->sarea_priv->pf_current_page);
> @@ -633,8 +630,7 @@
>                 return -EINVAL;
>         }
> 
> -       DRM_DEBUG_DRIVER(I915_DRV,
> -                       "i915 batchbuffer, start %x used %d cliprects %d\n",
> +       DRM_DEBUG_DRIVER("i915 batchbuffer, start %x used %d cliprects %d\n",
>                         batch->start, batch->used, batch->num_cliprects);
> 
>         RING_LOCK_TEST_WITH_RETURN(dev, file_priv);
> @@ -681,8 +677,7 @@
>         void *batch_data;
>         int ret;
> 
> -       DRM_DEBUG_DRIVER(I915_DRV,
> -                       "i915 cmdbuffer, buf %p sz %d cliprects %d\n",
> +       DRM_DEBUG_DRIVER("i915 cmdbuffer, buf %p sz %d cliprects %d\n",
>                         cmdbuf->buf, cmdbuf->sz, cmdbuf->num_cliprects);
> 
>         RING_LOCK_TEST_WITH_RETURN(dev, file_priv);
> @@ -735,7 +730,7 @@
>  {
>         int ret;
> 
> -       DRM_DEBUG_DRIVER(I915_DRV, "%s\n", __func__);
> +       DRM_DEBUG_DRIVER("%s\n", __func__);
> 
>         RING_LOCK_TEST_WITH_RETURN(dev, file_priv);
> 
> @@ -778,7 +773,7 @@
>                 value = dev_priv->num_fence_regs - dev_priv->fence_reg_start;
>                 break;
>         default:
> -               DRM_DEBUG_DRIVER(I915_DRV, "Unknown parameter %d\n",
> +               DRM_DEBUG_DRIVER("Unknown parameter %d\n",
>                                         param->param);
>                 return -EINVAL;
>         }
> @@ -819,7 +814,7 @@
>                 dev_priv->fence_reg_start = param->value;
>                 break;
>         default:
> -               DRM_DEBUG_DRIVER(I915_DRV, "unknown parameter %d\n",
> +               DRM_DEBUG_DRIVER("unknown parameter %d\n",
>                                         param->param);
>                 return -EINVAL;
>         }
> @@ -846,7 +841,7 @@
>                 return 0;
>         }
> 
> -       DRM_DEBUG("set status page addr 0x%08x\n", (u32)hws->addr);
> +       DRM_DEBUG_DRIVER("set status page addr 0x%08x\n", (u32)hws->addr);
> 
>         dev_priv->status_gfx_addr = hws->addr & (0x1ffff<<12);
> 
> @@ -868,9 +863,9 @@
> 
>         memset(dev_priv->hw_status_page, 0, PAGE_SIZE);
>         I915_WRITE(HWS_PGA, dev_priv->status_gfx_addr);
> -       DRM_DEBUG_DRIVER(I915_DRV, "load hws HWS_PGA with gfx mem 0x%x\n",
> +       DRM_DEBUG_DRIVER("load hws HWS_PGA with gfx mem 0x%x\n",
>                                 dev_priv->status_gfx_addr);
> -       DRM_DEBUG_DRIVER(I915_DRV, "load hws at %p\n",
> +       DRM_DEBUG_DRIVER("load hws at %p\n",
>                                 dev_priv->hw_status_page);
>         return 0;
>  }
> @@ -1310,7 +1305,7 @@
>  {
>         struct drm_i915_file_private *i915_file_priv;
> 
> -       DRM_DEBUG_DRIVER(I915_DRV, "\n");
> +       DRM_DEBUG_DRIVER("\n");
>         i915_file_priv = (struct drm_i915_file_private *)
>             kmalloc(sizeof(*i915_file_priv), GFP_KERNEL);
> 
> Index: linux-2.6/drivers/gpu/drm/i915/intel_lvds.c
> ===================================================================
> --- linux-2.6.orig/drivers/gpu/drm/i915/intel_lvds.c    2009-07-16 13:53:24.000000000 +0800
> +++ linux-2.6/drivers/gpu/drm/i915/intel_lvds.c 2009-07-16 13:53:38.000000000 +0800
> @@ -38,8 +38,6 @@
>  #include "i915_drv.h"
>  #include <linux/acpi.h>
> 
> -#define I915_LVDS "i915_lvds"
> -
>  /*
>   * the following four scaling options are defined.
>   * #define DRM_MODE_SCALE_NON_GPU      0
> @@ -673,8 +671,7 @@
>                 struct drm_crtc *crtc = connector->encoder->crtc;
>                 struct intel_lvds_priv *lvds_priv = intel_output->dev_priv;
>                 if (value == DRM_MODE_SCALE_NON_GPU) {
> -                       DRM_DEBUG_KMS(I915_LVDS,
> -                                       "non_GPU property is unsupported\n");
> +                       DRM_DEBUG_KMS("non_GPU property is unsupported\n");
>                         return 0;
>                 }
>                 if (lvds_priv->fitting_mode == value) {
> @@ -731,8 +728,7 @@
> 
>  static int __init intel_no_lvds_dmi_callback(const struct dmi_system_id *id)
>  {
> -       DRM_DEBUG_KMS(I915_LVDS,
> -                     "Skipping LVDS initialization for %s\n", id->ident);
> +       DRM_DEBUG_KMS("Skipping LVDS initialization for %s\n", id->ident);
>         return 1;
>  }
> 
> @@ -1021,7 +1017,7 @@
>         return;
> 
>  failed:
> -       DRM_DEBUG_KMS(I915_LVDS, "No LVDS modes found, disabling.\n");
> +       DRM_DEBUG_KMS("No LVDS modes found, disabling.\n");
>         if (intel_output->ddc_bus)
>                 intel_i2c_destroy(intel_output->ddc_bus);
>         drm_connector_cleanup(connector);
> Index: linux-2.6/drivers/gpu/drm/i915/intel_sdvo.c
> ===================================================================
> --- linux-2.6.orig/drivers/gpu/drm/i915/intel_sdvo.c    2009-07-16 13:53:24.000000000 +0800
> +++ linux-2.6/drivers/gpu/drm/i915/intel_sdvo.c 2009-07-16 14:29:00.000000000 +0800
> @@ -36,7 +36,6 @@
>  #include "intel_sdvo_regs.h"
> 
>  #undef SDVO_DEBUG
> -#define I915_SDVO      "i915_sdvo"
>  struct intel_sdvo_priv {
>         u8 slave_addr;
> 
> @@ -178,7 +177,7 @@
>                 return true;
>         }
> 
> -       DRM_DEBUG("i2c transfer returned %d\n", ret);
> +       DRM_DEBUG_KMS("i2c transfer returned %d\n", ret);
>         return false;
>  }
> 
> @@ -288,7 +287,7 @@
>         struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv;
>         int i;
> 
> -       DRM_DEBUG_KMS(I915_SDVO, "%s: W: %02X ",
> +       DRM_DEBUG_KMS("%s: W: %02X ",
>                                 SDVO_NAME(sdvo_priv), cmd);
>         for (i = 0; i < args_len; i++)
>                 DRM_LOG_KMS("%02X ", ((u8 *)args)[i]);
> @@ -341,7 +340,7 @@
>         struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv;
>         int i;
> 
> -       DRM_DEBUG_KMS(I915_SDVO, "%s: R: ", SDVO_NAME(sdvo_priv));
> +       DRM_DEBUG_KMS("%s: R: ", SDVO_NAME(sdvo_priv));
>         for (i = 0; i < response_len; i++)
>                 DRM_LOG_KMS("%02X ", ((u8 *)response)[i]);
>         for (; i < 8; i++)
> @@ -658,10 +657,10 @@
>         status = intel_sdvo_read_response(intel_output, &response, 1);
> 
>         if (status != SDVO_CMD_STATUS_SUCCESS) {
> -               DRM_DEBUG("Couldn't get SDVO clock rate multiplier\n");
> +               DRM_DEBUG_KMS("Couldn't get SDVO clock rate multiplier\n");
>                 return SDVO_CLOCK_RATE_MULT_1X;
>         } else {
> -               DRM_DEBUG("Current clock rate multiplier: %d\n", response);
> +               DRM_DEBUG_KMS("Current clock rate multiplier: %d\n", response);
>         }
> 
>         return response;
> @@ -942,14 +941,14 @@
>         format = &sdvo_priv->tv_format;
>         memset(&unset, 0, sizeof(unset));
>         if (memcmp(format, &unset, sizeof(*format))) {
> -               DRM_DEBUG("%s: Choosing default TV format of NTSC-M\n",
> +               DRM_DEBUG_KMS("%s: Choosing default TV format of NTSC-M\n",
>                                 SDVO_NAME(sdvo_priv));
>                 format->ntsc_m = 1;
>                 intel_sdvo_write_cmd(output, SDVO_CMD_SET_TV_FORMAT, format,
>                                 sizeof(*format));
>                 status = intel_sdvo_read_response(output, NULL, 0);
>                 if (status != SDVO_CMD_STATUS_SUCCESS)
> -                       DRM_DEBUG("%s: Failed to set TV format\n",
> +                       DRM_DEBUG_KMS("%s: Failed to set TV format\n",
>                                         SDVO_NAME(sdvo_priv));
>         }
>  }
> @@ -1220,8 +1219,8 @@
>                  * a given it the status is a success, we succeeded.
>                  */
>                 if (status == SDVO_CMD_STATUS_SUCCESS && !input1) {
> -                       DRM_DEBUG("First %s output reported failure to sync\n",
> -                                  SDVO_NAME(sdvo_priv));
> +                       DRM_DEBUG_KMS("First %s output reported failure to "
> +                                       "sync\n", SDVO_NAME(sdvo_priv));
>                 }
> 
>                 if (0)
> @@ -1316,8 +1315,8 @@
>                         intel_wait_for_vblank(dev);
>                 status = intel_sdvo_get_trained_inputs(intel_output, &input1, &input2);
>                 if (status == SDVO_CMD_STATUS_SUCCESS && !input1)
> -                       DRM_DEBUG("First %s output reported failure to sync\n",
> -                                  SDVO_NAME(sdvo_priv));
> +                       DRM_DEBUG_KMS("First %s output reported failure to "
> +                                       "sync\n", SDVO_NAME(sdvo_priv));
>         }
> 
>         intel_sdvo_set_active_outputs(intel_output, sdvo_priv->save_active_outputs);
> @@ -1395,7 +1394,7 @@
>         u8 response[2];
>         u8 status;
>         struct intel_output *intel_output;
> -       DRM_DEBUG("\n");
> +       DRM_DEBUG_KMS("\n");
> 
>         if (!connector)
>                 return 0;
> @@ -1460,7 +1459,7 @@
>         intel_sdvo_write_cmd(intel_output, SDVO_CMD_GET_ATTACHED_DISPLAYS, NULL, 0);
>         status = intel_sdvo_read_response(intel_output, &response, 2);
> 
> -       DRM_DEBUG("SDVO response %d %d\n", response[0], response[1]);
> +       DRM_DEBUG_KMS("SDVO response %d %d\n", response[0], response[1]);
> 
>         if (status != SDVO_CMD_STATUS_SUCCESS)
>                 return connector_status_unknown;
> @@ -1905,8 +1904,7 @@
>         /* Read the regs to test if we can talk to the device */
>         for (i = 0; i < 0x40; i++) {
>                 if (!intel_sdvo_read_byte(intel_output, i, &ch[i])) {
> -                       DRM_DEBUG_KMS(I915_SDVO,
> -                                       "No SDVO device found on SDVO%c\n",
> +                       DRM_DEBUG_KMS("No SDVO device found on SDVO%c\n",
>                                         output_device == SDVOB ? 'B' : 'C');
>                         goto err_i2c;
>                 }
> @@ -1989,8 +1987,7 @@
> 
>                 sdvo_priv->controlled_output = 0;
>                 memcpy (bytes, &sdvo_priv->caps.output_flags, 2);
> -               DRM_DEBUG_KMS(I915_SDVO,
> -                               "%s: Unknown SDVO output type (0x%02x%02x)\n",
> +               DRM_DEBUG_KMS("%s: Unknown SDVO output type (0x%02x%02x)\n",
>                                   SDVO_NAME(sdvo_priv),
>                                   bytes[0], bytes[1]);
>                 encoder_type = DRM_MODE_ENCODER_NONE;
> @@ -2022,7 +2019,7 @@
>                                                &sdvo_priv->pixel_clock_max);
> 
> 
> -       DRM_DEBUG_KMS(I915_SDVO, "%s device VID/DID: %02X:%02X.%02X, "
> +       DRM_DEBUG_KMS("%s device VID/DID: %02X:%02X.%02X, "
>                         "clock range %dMHz - %dMHz, "
>                         "input 1: %c, input 2: %c, "
>                         "output 1: %c, output 2: %c\n",




More information about the Intel-gfx mailing list