drm/i915: Add pretty printer for device info flags
Subsystems (2)
PATCH v2 1/3 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%
--- drivers/gpu/drm/i915/i915_debugfs.c | 5 ++--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/i915_gpu_error.c | 6 +++--- drivers/gpu/drm/i915/intel_device_info.c | 20 ++++++++++++++++---- 4 files changed, 23 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +2 -3
@@ -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);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,"platform: %s\n" ,intel_platform_name (info->platform));seq_printf (m,"pch: %d\n" ,INTEL_PCH_TYPE (dev_priv)); -#define PRINT_FLAG (x) seq_printf(m, #x ": %s\n", yesno(info->x)) -DEV_INFO_FOR_EACH_FLAG (PRINT_FLAG ); -#undef PRINT_FLAG +intel_device_info_dump_flags (info, &p);kernel_param_lock (THIS_MODULE );#define PRINT_PARAM (T , x, ...) seq_print_param(m, #x, #T, &i915_modparams.x);
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -4165,6 +4165,8 @@ static inline int intel_opregion_get_panel_type(struct drm_i915_private *dev)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_dump (struct drm_i915_private *dev_priv); +void intel_device_info_dump_flags (const struct intel_device_info *info, +struct drm_printer *p);/* modesetting */ extern void intel_modeset_init_hw (struct drm_device *dev);
drivers/gpu/drm/i915/i915_gpu_error.c +3 -3
@@ -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,const struct intel_device_info *info) { -#define PRINT_FLAG (x) err_printf(m, #x ": %s\n", yesno(info->x)) -DEV_INFO_FOR_EACH_FLAG (PRINT_FLAG ); -#undef PRINT_FLAG +struct drm_printer p =i915_error_printer (m); + +intel_device_info_dump_flags (info, &p); } static __always_inline void err_print_param(struct drm_i915_error_state_buf *m,
drivers/gpu/drm/i915/intel_device_info.c +16 -4
@@ -22,6 +22,8 @@* */ +#include <drm/drm_print.h> +#include "i915_drv.h" #define PLATFORM_NAME (x) [INTEL_##x] = #x
@@ -67,6 +69,14 @@ const char *intel_platform_name(enum intel_platform 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) {const struct intel_device_info *info = &dev_priv->info;
@@ -76,10 +86,12 @@ void intel_device_info_dump(struct drm_i915_private *dev_priv) info->gen, dev_priv->drm.pdev->device, dev_priv->drm.pdev->revision); -#define PRINT_FLAG (name) \ - DRM_DEBUG_DRIVER("i915 device info: " #name ": %s", yesno(info->name)) -DEV_INFO_FOR_EACH_FLAG (PRINT_FLAG ); -#undef PRINT_FLAG + +if (drm_debug &DRM_UT_DRIVER ) { +struct drm_printer p =drm_debug_printer ("i915 device info: " ); + +intel_device_info_dump_flags (info, &p); + } }static void gen10_sseu_info_init (struct drm_i915_private *dev_priv)
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 2/3 drm/i915: Convert intel_device_info_dump into pretty printer
Convert intel_device_info_dump into pretty printer to be consistent with the rest of the driver code.
--- drivers/gpu/drm/i915/i915_drv.c | 6 +++++- drivers/gpu/drm/i915/i915_drv.h | 3 ++- drivers/gpu/drm/i915/intel_device_info.c | 22 ++++++++++------------ 3 files changed, 17 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +5 -1
@@ -931,7 +931,11 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv,intel_display_crc_init (dev_priv); -intel_device_info_dump (dev_priv); +if (drm_debug &DRM_UT_DRIVER ) { +struct drm_printer p =drm_debug_printer ("i915 device info:" ); + +intel_device_info_dump (&dev_priv->info, &p); + }intel_detect_preproduction_hw (dev_priv);
drivers/gpu/drm/i915/i915_drv.h +2 -1
@@ -4164,7 +4164,8 @@ static inline int intel_opregion_get_panel_type(struct drm_i915_private *dev)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_dump (struct drm_i915_private *dev_priv); +void intel_device_info_dump (const struct intel_device_info *info, +struct drm_printer *p);void intel_device_info_dump_flags (const struct intel_device_info *info,struct drm_printer *p);
drivers/gpu/drm/i915/intel_device_info.c +10 -12
@@ -77,21 +77,19 @@ void intel_device_info_dump_flags(const struct intel_device_info *info,#undef PRINT_FLAG } -void intel_device_info_dump (struct drm_i915_private *dev_priv) +void intel_device_info_dump (const struct intel_device_info *info, +struct drm_printer *p) { -const struct intel_device_info *info = &dev_priv->info; +struct drm_i915_private *dev_priv = + container_of(info, struct drm_i915_private, info); -DRM_DEBUG_DRIVER ("i915 device info: platform=%s gen=%i pciid=0x%04x rev=0x%02x" , -intel_platform_name (info->platform), - info->gen, - dev_priv->drm.pdev->device, - dev_priv->drm.pdev->revision); +drm_printf (p,"pciid=0x%04x rev=0x%02x platform=%s gen=%i\n" , +INTEL_DEVID (dev_priv), +INTEL_REVID (dev_priv), +intel_platform_name (info->platform), + info->gen); -if (drm_debug &DRM_UT_DRIVER ) { -struct drm_printer p =drm_debug_printer ("i915 device info: " ); - -intel_device_info_dump_flags (info, &p); - } +intel_device_info_dump_flags (info, p); }static void gen10_sseu_info_init (struct drm_i915_private *dev_priv)
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 2/3] drm/i915: Convert intel_device_info_dump into pretty printer
Quoting Michal Wajdeczko (2017-12-19 11:43:45)
Quoted 6 lines
Convert
intel_device_info_dumpinto pretty printer to be consistent with the rest of the driver code.Suggested-by Chris Wilson <[email protected]>Signed-off-by Michal Wajdeczko <[email protected]>Cc Chris Wilson <[email protected]>
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 3/3 drm/i915: Add pretty printer for modparams
In reply to Michal WajdeczkoWe dump modparams in few places (debugfs, gpu_error) using different functions. Lets add reusable function to avoid code duplication.
add/remove: 1/0 grow/shrink: 0/2 up/down: 1096/-2339 (-1243)
Function old new delta i915_params_dump - 1096 +1096 i915_capabilities 1353 185 -1168 i915_error_state_to_str 5507 4336 -1171
Total: Before=1285716, After=1284473, chg -0.10%
v2: use forward decl rather than include (Chris)
--- drivers/gpu/drm/i915/i915_debugfs.c | 21 +-------------------- drivers/gpu/drm/i915/i915_gpu_error.c | 25 ++++--------------------- drivers/gpu/drm/i915/i915_params.c | 33 +++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/i915_params.h | 4 ++++ 4 files changed, 42 insertions(+), 41 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +1 -20
@@ -37,23 +37,6 @@ static inline struct drm_i915_private *node_to_i915(struct drm_info_node *node)return to_i915 (node->minor->dev); } -static __always_inline void seq_print_param(struct seq_file *m, -const char *name, -const char *type, -const void *x) -{ -if (!__builtin_strcmp (type,"bool" )) -seq_printf (m,"i915.%s=%s\n" , name,yesno (*(const bool *)x)); -else if (!__builtin_strcmp (type,"int" )) -seq_printf (m,"i915.%s=%d\n" , name, *(const int *)x); -else if (!__builtin_strcmp (type,"unsigned int" )) -seq_printf (m,"i915.%s=%u\n" , name, *(const unsigned int *)x); -else if (!__builtin_strcmp (type,"char *" )) -seq_printf (m,"i915.%s=%s\n" , name, *(const char **)x); -else -BUILD_BUG (); -} -static int i915_capabilities (struct seq_file *m,void *data) {struct drm_i915_private *dev_priv =node_to_i915 (m->private);
@@ -67,9 +50,7 @@ static int i915_capabilities(struct seq_file *m, void *data)intel_device_info_dump_flags (info, &p);kernel_param_lock (THIS_MODULE ); -#define PRINT_PARAM (T , x, ...) seq_print_param(m, #x, #T, &i915_modparams.x); -I915_PARAMS_FOR_EACH (PRINT_PARAM ); -#undef PRINT_PARAM +i915_params_dump (&i915_modparams, &p);kernel_param_unlock (THIS_MODULE );return 0 ;
drivers/gpu/drm/i915/i915_gpu_error.c +4 -21
@@ -569,29 +569,12 @@ static void err_print_capabilities(struct drm_i915_error_state_buf *m,intel_device_info_dump_flags (info, &p); } -static __always_inline void err_print_param(struct drm_i915_error_state_buf *m, -const char *name, -const char *type, -const void *x) -{ -if (!__builtin_strcmp (type,"bool" )) -err_printf (m,"i915.%s=%s\n" , name,yesno (*(const bool *)x)); -else if (!__builtin_strcmp (type,"int" )) -err_printf (m,"i915.%s=%d\n" , name, *(const int *)x); -else if (!__builtin_strcmp (type,"unsigned int" )) -err_printf (m,"i915.%s=%u\n" , name, *(const unsigned int *)x); -else if (!__builtin_strcmp (type,"char *" )) -err_printf (m,"i915.%s=%s\n" , name, *(const char **)x); -else -BUILD_BUG (); -} -static void err_print_params (struct drm_i915_error_state_buf *m, -const struct i915_params *p) +const struct i915_params *params) { -#define T , x, ...) err_print_param(m, #x, #T, &p->x); -I915_PARAMS_FOR_EACH (#undef PRINT +struct drm_printer p =i915_error_printer (m); + +i915_params_dump (params, &p); } static void err_print_pciid(struct drm_i915_error_state_buf *m,
drivers/gpu/drm/i915/i915_params.c +33 -0
@@ -22,6 +22,8 @@* IN THE SOFTWARE. */ +#include <drm/drm_print.h> +#include "i915_params.h" #include "i915_drv.h"
@@ -172,3 +174,34 @@ struct i915_params i915_modparams __read_mostly = {i915_param_named (enable_gvt, bool,0400 ,"Enable support for Intel GVT-g graphics virtualization host support(default:false)" ); + +static __always_inline void _print_param(struct drm_printer *p, +const char *name, +const char *type, +const void *x) +{ +if (!__builtin_strcmp (type,"bool" )) +drm_printf (p,"i915.%s=%s\n" , name,yesno (*(const bool *)x)); +else if (!__builtin_strcmp (type,"int" )) +drm_printf (p,"i915.%s=%d\n" , name, *(const int *)x); +else if (!__builtin_strcmp (type,"unsigned int" )) +drm_printf (p,"i915.%s=%u\n" , name, *(const unsigned int *)x); +else if (!__builtin_strcmp (type,"char *" )) +drm_printf (p,"i915.%s=%s\n" , name, *(const char **)x); +else +BUILD_BUG (); +} + +/** +* i915_params_dump - dump i915 modparams +* @params: i915 modparams +* @p: the &drm_printer +* +* Pretty printer for i915 modparams. +*/ +void i915_params_dump (const struct i915_params *params,struct drm_printer *p) +{ +#define T , x, ...) _print_param(p, #x, #T, ¶ms->x); +I915_PARAMS_FOR_EACH (#undef PRINT +}
drivers/gpu/drm/i915/i915_params.h +4 -0
@@ -28,6 +28,8 @@#include <linux/bitops.h> #include <linux/cache.h> /* for __read_mostly */ +struct drm_printer ; +#define ENABLE_GUC_SUBMISSION BIT(0)#define ENABLE_GUC_LOAD_HUC BIT(1)
@@ -77,5 +79,7 @@ struct i915_params {extern struct i915_params i915_modparams__read_mostly ; +void i915_params_dump (const struct i915_params *params,struct drm_printer *p); +#endif
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for series starting with [v2,1/3] drm/i915: Add pretty printer for device info flags
In reply to Michal Wajdeczko== Series Details ==
== Series Details ==
Series: series starting with [v2,1/3] drm/i915: Add pretty printer for device info flags
URL : https://patchwork.freedesktop.org/series/35574/
State : success
== Summary ==
Series 35574v1 series starting with [v2,1/3] drm/i915: Add pretty printer for device info flags
https://patchwork.freedesktop.org/api/1.0/series/35574/revisions/1/mbox/
Test debugfs_test:
Subgroup read_all_entries:
dmesg-warn -> PASS (fi-elk-e7500) fdo#103989 +1
incomplete -> PASS (fi-snb-2520m) fdo#103713fdo#103989 https://bugs.freedesktop.org/show_bug.cgi?id=103989
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fi-bdw-5557u total:288 pass:267 dwarn:0 dfail:0 fail:0 skip:21 time:431s fi-bdw-gvtdvm total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:441s fi-blb-e6850 total:288 pass:223 dwarn:1 dfail:0 fail:0 skip:64 time:381s fi-bsw-n3050 total:288 pass:242 dwarn:0 dfail:0 fail:0 skip:46 time:492s fi-bwr-2160 total:288 pass:183 dwarn:0 dfail:0 fail:0 skip:105 time:276s fi-bxt-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:490s fi-bxt-j4205 total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:496s fi-byt-j1900 total:288 pass:253 dwarn:0 dfail:0 fail:0 skip:35 time:473s fi-byt-n2820 total:288 pass:249 dwarn:0 dfail:0 fail:0 skip:39 time:468s fi-elk-e7500 total:224 pass:163 dwarn:15 dfail:0 fail:0 skip:45 fi-gdg-551 total:288 pass:178 dwarn:1 dfail:0 fail:1 skip:108 time:260s fi-glk-1 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:530s fi-hsw-4770 total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:404s fi-hsw-4770r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:413s fi-ilk-650 total:288 pass:228 dwarn:0 dfail:0 fail:0 skip:60 time:384s fi-ivb-3520m total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:477s fi-ivb-3770 total:288 pass:255 dwarn:0 dfail:0 fail:0 skip:33 time:436s fi-kbl-7500u total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:483s fi-kbl-7560u total:288 pass:268 dwarn:1 dfail:0 fail:0 skip:19 time:514s fi-kbl-7567u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:464s fi-kbl-r total:288 pass:260 dwarn:1 dfail:0 fail:0 skip:27 time:519s fi-pnv-d510 total:288 pass:222 dwarn:1 dfail:0 fail:0 skip:65 time:581s fi-skl-6260u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:441s fi-skl-6600u total:288 pass:260 dwarn:1 dfail:0 fail:0 skip:27 time:533s fi-skl-6700hq total:288 pass:261 dwarn:1 dfail:0 fail:0 skip:26 time:559s fi-skl-6700k2 total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:504s fi-skl-6770hq total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:489s fi-skl-gvtdvm total:288 pass:265 dwarn:0 dfail:0 fail:0 skip:23 time:450s fi-snb-2520m total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:540s fi-snb-2600 total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:404s
Blacklisted hosts:
fi-cfl-s2 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:591s
b08c3df16ea63c118c2fe7f8017b720fca9382d6 drm-tip: 2017y-12m-19d-11h-46m-21s UTC integration manifest 3123016a5807 drm/i915: Add pretty printer for modparams6c70cb86242e drm/i915: Convert intel_device_info_dump into pretty printer b2a7c01e014c drm/i915: Add pretty printer for device info flags
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7536/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.IGT: success for series starting with [v2,1/3] drm/i915: Add pretty printer for device info flags
In reply to Michal Wajdeczko== Series Details ==
== Series Details ==
Series: series starting with [v2,1/3] drm/i915: Add pretty printer for device info flags
URL : https://patchwork.freedesktop.org/series/35574/
State : success
== Summary ==
Test gem_tiled_swapping:
Subgroup non-threaded:
incomplete -> PASS (shard-snb) fdo#104218
Test gem_eio:
Subgroup in-flight-external:
incomplete -> PASS (shard-hsw)
Test kms_frontbuffer_tracking:
Subgroup fbc-1p-offscren-pri-shrfb-draw-render:
pass -> FAIL (shard-snb) fdo#101623 +1
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-b:
skip -> PASS (shard-snb) fdo#103375
Test kms_flip:
Subgroup plain-flip-fb-recreate-interruptible:
fail -> PASS (shard-hsw) fdo#100368
Subgroup wf_vblank-vs-dpms:
dmesg-warn -> PASS (shard-hsw) fdo#102614
Test kms_setmode:
Subgroup basic:
fail -> PASS (shard-hsw) fdo#99912fdo#104218 https://bugs.freedesktop.org/show_bug.cgi?id=104218
fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623
fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
shard-hsw total:2712 pass:1538 dwarn:1 dfail:0 fail:9 skip:1164 time:9423s shard-snb total:2712 pass:1307 dwarn:1 dfail:0 fail:13 skip:1391 time:8025s
Blacklisted hosts:
shard-apl total:2690 pass:1665 dwarn:1 dfail:0 fail:22 skip:1001 time:13298s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7536/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: ✓ Fi.CI.IGT: success for series starting with [v2,1/3] drm/i915: Add pretty printer for device info flags
Quoting Patchwork (2017-12-19 15:01:40)
Quoted 20 lines
== Series Details ==
Series: series starting with [v2,1/3] drm/i915: Add pretty printer for device info flags
URL : https://patchwork.freedesktop.org/series/35574/
State : success== Summary ==
Test
gem_tiled_swapping:Subgroup non-threaded: incomplete -> PASS (shard-snb) fdo#104218 Test gem_eio: Subgroup in-flight-external: incomplete -> PASS (shard-hsw) Test kms_frontbuffer_tracking: Subgroup fbc-1p-offscren-pri-shrfb-draw-render: pass -> FAIL (shard-snb) fdo#101623 +1 Test kms_pipe_crc_basic: Subgroup suspend-read-crc-pipe-b: skip -> PASS (shard-snb) fdo#103375
Quoted 8 lines
Test
kms_flip:Subgroup plain-flip-fb-recreate-interruptible: fail -> PASS (shard-hsw) fdo#100368 Subgroup wf_vblank-vs-dpms: dmesg-warn -> PASS (shard-hsw) fdo#102614 Test kms_setmode: Subgroup basic: fail -> PASS (shard-hsw) fdo#99912
Thanks for the patches, discarding nearly a whole page from our bloated driver! It's size is getting scary.
Pushed,
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx