aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2017-12-20 04:35:44 -0500
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2017-12-20 09:30:17 -0500
commit8d44e9e69aacecd522bb2797eb2febc5c6c46558 (patch)
tree6bfeb81401e996cbb2dc431f9fcca7f73f99cb1a
parent48c9571c34b153abc1c4f2b431fa74490b671943 (diff)
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>
-rw-r--r--drivers/gpu/drm/drm_fb_helper.c1
-rw-r--r--drivers/gpu/drm/drm_framebuffer.c2
-rw-r--r--include/drm/drm_framebuffer.h6
3 files changed, 9 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 4a61e1aef41b..035784ddd133 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1896,6 +1896,7 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
1896 if (ret < 0) 1896 if (ret < 0)
1897 return ret; 1897 return ret;
1898 1898
1899 strcpy(fb_helper->fb->comm, "[fbcon]");
1899 return 0; 1900 return 0;
1900} 1901}
1901 1902
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index d63d4c2ac4c8..5a13ff29f4f0 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -664,6 +664,7 @@ int drm_framebuffer_init(struct drm_device *dev, struct drm_framebuffer *fb,
664 INIT_LIST_HEAD(&fb->filp_head); 664 INIT_LIST_HEAD(&fb->filp_head);
665 665
666 fb->funcs = funcs; 666 fb->funcs = funcs;
667 strcpy(fb->comm, current->comm);
667 668
668 ret = __drm_mode_object_add(dev, &fb->base, DRM_MODE_OBJECT_FB, 669 ret = __drm_mode_object_add(dev, &fb->base, DRM_MODE_OBJECT_FB,
669 false, drm_framebuffer_free); 670 false, drm_framebuffer_free);
@@ -978,6 +979,7 @@ void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent,
978 struct drm_format_name_buf format_name; 979 struct drm_format_name_buf format_name;
979 unsigned int i; 980 unsigned int i;
980 981
982 drm_printf_indent(p, indent, "allocated by = %s\n", fb->comm);
981 drm_printf_indent(p, indent, "refcount=%u\n", 983 drm_printf_indent(p, indent, "refcount=%u\n",
982 drm_framebuffer_read_refcount(fb)); 984 drm_framebuffer_read_refcount(fb));
983 drm_printf_indent(p, indent, "format=%s\n", 985 drm_printf_indent(p, indent, "format=%s\n",
diff --git a/include/drm/drm_framebuffer.h b/include/drm/drm_framebuffer.h
index dccb897951ba..c50502c656e5 100644
--- a/include/drm/drm_framebuffer.h
+++ b/include/drm/drm_framebuffer.h
@@ -121,6 +121,12 @@ struct drm_framebuffer {
121 * @base: base modeset object structure, contains the reference count. 121 * @base: base modeset object structure, contains the reference count.
122 */ 122 */
123 struct drm_mode_object base; 123 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
124 /** 130 /**
125 * @format: framebuffer format information 131 * @format: framebuffer format information
126 */ 132 */