Commit a8c9b849 authored by Michal Wajdeczko's avatar Michal Wajdeczko Committed by Chris Wilson

drm/i915: Add pretty printer for device info flags

We dump device flags in few places (init_early, debugfs, gpu_error)
using different functions. Lets add reusable function to avoid
code duplication.

add/remove: 1/0 grow/shrink: 0/3 up/down: 1296/-3572 (-2276)
Function                                     old     new   delta
intel_device_info_dump_flags                   -    1296   +1296
i915_capabilities                           2435    1353   -1082
i915_error_state_to_str                     6642    5507   -1135
intel_device_info_dump                      1507     152   -1355
Total: Before=1287992, After=1285716, chg -0.18%
Signed-off-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20171219114346.26308-1-michal.wajdeczko@intel.com
parent 04bf68bb
...@@ -58,14 +58,13 @@ static int i915_capabilities(struct seq_file *m, void *data) ...@@ -58,14 +58,13 @@ static int i915_capabilities(struct seq_file *m, void *data)
{ {
struct drm_i915_private *dev_priv = node_to_i915(m->private); struct drm_i915_private *dev_priv = node_to_i915(m->private);
const struct intel_device_info *info = INTEL_INFO(dev_priv); const struct intel_device_info *info = INTEL_INFO(dev_priv);
struct drm_printer p = drm_seq_file_printer(m);
seq_printf(m, "gen: %d\n", INTEL_GEN(dev_priv)); seq_printf(m, "gen: %d\n", INTEL_GEN(dev_priv));
seq_printf(m, "platform: %s\n", intel_platform_name(info->platform)); seq_printf(m, "platform: %s\n", intel_platform_name(info->platform));
seq_printf(m, "pch: %d\n", INTEL_PCH_TYPE(dev_priv)); seq_printf(m, "pch: %d\n", INTEL_PCH_TYPE(dev_priv));
#define PRINT_FLAG(x) seq_printf(m, #x ": %s\n", yesno(info->x)) intel_device_info_dump_flags(info, &p);
DEV_INFO_FOR_EACH_FLAG(PRINT_FLAG);
#undef PRINT_FLAG
kernel_param_lock(THIS_MODULE); kernel_param_lock(THIS_MODULE);
#define PRINT_PARAM(T, x, ...) seq_print_param(m, #x, #T, &i915_modparams.x); #define PRINT_PARAM(T, x, ...) seq_print_param(m, #x, #T, &i915_modparams.x);
......
...@@ -4165,6 +4165,8 @@ mkwrite_device_info(struct drm_i915_private *dev_priv) ...@@ -4165,6 +4165,8 @@ mkwrite_device_info(struct drm_i915_private *dev_priv)
const char *intel_platform_name(enum intel_platform platform); const char *intel_platform_name(enum intel_platform platform);
void intel_device_info_runtime_init(struct drm_i915_private *dev_priv); void intel_device_info_runtime_init(struct drm_i915_private *dev_priv);
void intel_device_info_dump(struct drm_i915_private *dev_priv); void intel_device_info_dump(struct drm_i915_private *dev_priv);
void intel_device_info_dump_flags(const struct intel_device_info *info,
struct drm_printer *p);
/* modesetting */ /* modesetting */
extern void intel_modeset_init_hw(struct drm_device *dev); extern void intel_modeset_init_hw(struct drm_device *dev);
......
...@@ -564,9 +564,9 @@ static void print_error_obj(struct drm_i915_error_state_buf *m, ...@@ -564,9 +564,9 @@ static void print_error_obj(struct drm_i915_error_state_buf *m,
static void err_print_capabilities(struct drm_i915_error_state_buf *m, static void err_print_capabilities(struct drm_i915_error_state_buf *m,
const struct intel_device_info *info) const struct intel_device_info *info)
{ {
#define PRINT_FLAG(x) err_printf(m, #x ": %s\n", yesno(info->x)) struct drm_printer p = i915_error_printer(m);
DEV_INFO_FOR_EACH_FLAG(PRINT_FLAG);
#undef PRINT_FLAG intel_device_info_dump_flags(info, &p);
} }
static __always_inline void err_print_param(struct drm_i915_error_state_buf *m, static __always_inline void err_print_param(struct drm_i915_error_state_buf *m,
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
* *
*/ */
#include <drm/drm_print.h>
#include "i915_drv.h" #include "i915_drv.h"
#define PLATFORM_NAME(x) [INTEL_##x] = #x #define PLATFORM_NAME(x) [INTEL_##x] = #x
...@@ -67,6 +69,14 @@ const char *intel_platform_name(enum intel_platform platform) ...@@ -67,6 +69,14 @@ const char *intel_platform_name(enum intel_platform platform)
return platform_names[platform]; return platform_names[platform];
} }
void intel_device_info_dump_flags(const struct intel_device_info *info,
struct drm_printer *p)
{
#define PRINT_FLAG(name) drm_printf(p, "%s: %s\n", #name, yesno(info->name));
DEV_INFO_FOR_EACH_FLAG(PRINT_FLAG);
#undef PRINT_FLAG
}
void intel_device_info_dump(struct drm_i915_private *dev_priv) void intel_device_info_dump(struct drm_i915_private *dev_priv)
{ {
const struct intel_device_info *info = &dev_priv->info; const struct intel_device_info *info = &dev_priv->info;
...@@ -76,10 +86,12 @@ void intel_device_info_dump(struct drm_i915_private *dev_priv) ...@@ -76,10 +86,12 @@ void intel_device_info_dump(struct drm_i915_private *dev_priv)
info->gen, info->gen,
dev_priv->drm.pdev->device, dev_priv->drm.pdev->device,
dev_priv->drm.pdev->revision); dev_priv->drm.pdev->revision);
#define PRINT_FLAG(name) \
DRM_DEBUG_DRIVER("i915 device info: " #name ": %s", yesno(info->name)) if (drm_debug & DRM_UT_DRIVER) {
DEV_INFO_FOR_EACH_FLAG(PRINT_FLAG); struct drm_printer p = drm_debug_printer("i915 device info: ");
#undef PRINT_FLAG
intel_device_info_dump_flags(info, &p);
}
} }
static void gen10_sseu_info_init(struct drm_i915_private *dev_priv) static void gen10_sseu_info_init(struct drm_i915_private *dev_priv)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment