Skip to content

Commit 418e3cd

Browse files
committed
drm/i915: Show the current i915_params in debugfs/i915_capabilites
Alongside the hw capabilities, it is useful to know which of those have been overridden by the user setting module parameters. v2: Use __always_inline and BUILD_BUG magic Signed-off-by: Chris Wilson <[email protected]> Acked-by: Jani Nikula <[email protected]> Reviewed-by: Joonas Lahtinen <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 642c8a7 commit 418e3cd

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

drivers/gpu/drm/i915/i915_debugfs.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,21 @@ drm_add_fake_info_node(struct drm_minor *minor,
6161
return 0;
6262
}
6363

64+
static __always_inline void seq_print_param(struct seq_file *m,
65+
const char *name,
66+
const char *type,
67+
const void *x)
68+
{
69+
if (!__builtin_strcmp(type, "bool"))
70+
seq_printf(m, "i915.%s=%s\n", name, yesno(*(const bool *)x));
71+
else if (!__builtin_strcmp(type, "int"))
72+
seq_printf(m, "i915.%s=%d\n", name, *(const int *)x);
73+
else if (!__builtin_strcmp(type, "unsigned int"))
74+
seq_printf(m, "i915.%s=%u\n", name, *(const unsigned int *)x);
75+
else
76+
BUILD_BUG();
77+
}
78+
6479
static int i915_capabilities(struct seq_file *m, void *data)
6580
{
6681
struct drm_i915_private *dev_priv = node_to_i915(m->private);
@@ -69,10 +84,17 @@ static int i915_capabilities(struct seq_file *m, void *data)
6984
seq_printf(m, "gen: %d\n", INTEL_GEN(dev_priv));
7085
seq_printf(m, "platform: %s\n", intel_platform_name(info->platform));
7186
seq_printf(m, "pch: %d\n", INTEL_PCH_TYPE(dev_priv));
87+
7288
#define PRINT_FLAG(x) seq_printf(m, #x ": %s\n", yesno(info->x))
7389
DEV_INFO_FOR_EACH_FLAG(PRINT_FLAG);
7490
#undef PRINT_FLAG
7591

92+
kernel_param_lock(THIS_MODULE);
93+
#define PRINT_PARAM(T, x) seq_print_param(m, #x, #T, &i915.x);
94+
I915_PARAMS_FOR_EACH(PRINT_PARAM);
95+
#undef PRINT_PARAM
96+
kernel_param_unlock(THIS_MODULE);
97+
7698
return 0;
7799
}
78100

0 commit comments

Comments
 (0)