On Tue, Feb 16, 2021 at 12:19:30PM +0200, Sakari Ailus wrote:
Switch DRM drivers from drm_get_format_name() to %p4cc. This gets rid of a large number of temporary variables at the same time.
...
- seq_printf(m, "\t\tuapi: [FB:%d] %s,0x%llx,%dx%d, visible=%s, src=" DRM_RECT_FP_FMT ", dst=" DRM_RECT_FMT ", rotation=%s\n",
fb ? fb->base.id : 0, fb ? format_name.str : "n/a",
- seq_printf(m, "\t\tuapi: [FB:%d] ", fb ? fb->base.id : 0);
- if (fb)
seq_printf(m, "%p4cc", &fb->format->format);
- else
seq_puts(m, "n/a");
- seq_printf(m, ",0x%llx,%dx%d, visible=%s, src=" DRM_RECT_FP_FMT ", dst=" DRM_RECT_FMT ", rotation=%s\n", fb ? fb->modifier : 0, fb ? fb->width : 0, fb ? fb->height : 0, plane_visibility(plane_state),
I still think this can be improved. See below for the example:
seq_puts(m, "\t\tuapi: "); if (fb) seq_printf(m, "[FB:%d] %p4cc,0x%llx,%dx%d, ", fb->base.id, &fb->format->format, fb->modifier, fb->width, fb->height); else seq_puts(m, "[FB:0] n/a,0,0x0, "); seq_printf(m, "visible=%s, src=" DRM_RECT_FP_FMT ", dst=" DRM_RECT_FMT ", rotation=%s\n", plane_visibility(plane_state), DRM_RECT_FP_ARG(&src), DRM_RECT_ARG(&dst), rot_str);
This will show logical parts separately and clear view on what would be printed when !fb. Also it uses seq_puts() without any needs for formatting.