Skip to content

Commit 8d44e9e

Browse files
committed
drm/framebuffer: Print task that allocated the fb in debug info.
This is is very useful to finding sources of leaked framebufers. The fbcon fb is annotated with [fbcon], to give it a better name than kworker. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20171220093545.613-3-maarten.lankhorst@linux.intel.com Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
1 parent 48c9571 commit 8d44e9e

3 files changed

Lines changed: 9 additions & 0 deletions

File tree

‎drivers/gpu/drm/drm_fb_helper.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1896,6 +1896,7 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
18961896
if (ret < 0)
18971897
return ret;
18981898

1899+
strcpy(fb_helper->fb->comm, "[fbcon]");
18991900
return 0;
19001901
}
19011902

‎drivers/gpu/drm/drm_framebuffer.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,7 @@ int drm_framebuffer_init(struct drm_device *dev, struct drm_framebuffer *fb,
664664
INIT_LIST_HEAD(&fb->filp_head);
665665

666666
fb->funcs = funcs;
667+
strcpy(fb->comm, current->comm);
667668

668669
ret = __drm_mode_object_add(dev, &fb->base, DRM_MODE_OBJECT_FB,
669670
false, drm_framebuffer_free);
@@ -978,6 +979,7 @@ void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent,
978979
struct drm_format_name_buf format_name;
979980
unsigned int i;
980981

982+
drm_printf_indent(p, indent, "allocated by = %s\n", fb->comm);
981983
drm_printf_indent(p, indent, "refcount=%u\n",
982984
drm_framebuffer_read_refcount(fb));
983985
drm_printf_indent(p, indent, "format=%s\n",

‎include/drm/drm_framebuffer.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ struct drm_framebuffer {
121121
* @base: base modeset object structure, contains the reference count.
122122
*/
123123
struct drm_mode_object base;
124+
125+
/**
126+
* @comm: Name of the process allocating the fb, used for fb dumping.
127+
*/
128+
char comm[TASK_COMM_LEN];
129+
124130
/**
125131
* @format: framebuffer format information
126132
*/

0 commit comments

Comments
 (0)