This patchset adds a debugfs file that prints info about the framebuffers.
I have followed the style of drm_state_info(). This means that the added drm_framebuffer_print_info() could also be used in drm_atomic_plane_print_state(). In order to do that I had to add a way to vary indentation to fit both use cases.
Changes in this version is turning drm_printf_indent() into a macro and converting the rest of the cma helper drivers.
This is how it looks:
$ sudo cat /sys/kernel/debug/dri/0/framebuffer framebuffer[33]: refcount=3 format=RG16 little-endian (0x36314752) modifier=0x0 size=320x240 layers: size[0]=320x240 pitch[0]=640 offset[0]=0 obj[0]: name=0 refcount=1 start=00010000 size=155648 imported=no paddr=0x17c80000 vaddr=d7c80000
$ sudo cat /sys/kernel/debug/dri/0/state plane[28]: plane-0 crtc=crtc-0 fb=33 refcount=3 format=RG16 little-endian (0x36314752) modifier=0x0 size=320x240 layers: size[0]=320x240 pitch[0]=640 offset[0]=0 obj[0]: name=0 refcount=1 start=00010000 size=155648 imported=no paddr=0x17c80000 vaddr=d7c80000 crtc-pos=320x240+0+0 src-pos=320.000000x240.000000+0.000000+0.000000 rotation=1 crtc[29]: crtc-0 <snip>
Changes since version 3: - Applied patch: drm/gem: Remove trailing whitespace - Turn drm_printf_indent() into a macro (Ville) - drm_printf_indent() add overflow marker (Jani) - Converted arc, hdlcd, tilcdc and removed drm_fb_cma_debugfs_show()
Noralf Trønnes (11): drm/vma-manager: drm_vma_node_start() constify argument drm/framebuffer: drm_framebuffer_read_refcount() constify argument drm/print: Add drm_printf_indent() drm/framebuffer: Add framebuffer debugfs file drm/atomic: Use drm_framebuffer_print_info() drm/cma-helper: Add drm_gem_cma_print_info() drm/arc: Use drm_gem_cma_print_info() drm/arm/hdlcd: Use drm_gem_cma_print_info() drm/tilcdc: Use drm_gem_cma_print_info() drm/tinydrm: Use drm_gem_cma_print_info() drm/cma-helper: Remove drm_fb_cma_debugfs_show()
drivers/gpu/drm/arc/arcpgu_drv.c | 2 +- drivers/gpu/drm/arm/hdlcd_drv.c | 2 +- drivers/gpu/drm/drm_atomic.c | 18 ++--------- drivers/gpu/drm/drm_debugfs.c | 6 ++++ drivers/gpu/drm/drm_fb_cma_helper.c | 37 ---------------------- drivers/gpu/drm/drm_framebuffer.c | 59 ++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/drm_gem.c | 17 +++++++++++ drivers/gpu/drm/drm_gem_cma_helper.c | 31 ++++++++----------- drivers/gpu/drm/drm_internal.h | 7 +++++ drivers/gpu/drm/tilcdc/tilcdc_drv.c | 2 +- drivers/gpu/drm/tinydrm/mipi-dbi.c | 8 +---- include/drm/drm_drv.h | 11 +++++++ include/drm/drm_fb_cma_helper.h | 6 ---- include/drm/drm_framebuffer.h | 2 +- include/drm/drm_gem_cma_helper.h | 7 ++--- include/drm/drm_print.h | 8 +++++ include/drm/drm_vma_manager.h | 2 +- include/drm/tinydrm/tinydrm.h | 1 + 18 files changed, 133 insertions(+), 93 deletions(-)
-- 2.14.2
Constify argument so functions calling into this take a const argument.
Reviewed-by: Ville Syrjälä ville.syrjala@linux.intel.com Signed-off-by: Noralf Trønnes noralf@tronnes.org --- include/drm/drm_vma_manager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/drm/drm_vma_manager.h b/include/drm/drm_vma_manager.h index d84d52f6d2b1..8758df94e9a0 100644 --- a/include/drm/drm_vma_manager.h +++ b/include/drm/drm_vma_manager.h @@ -152,7 +152,7 @@ static inline void drm_vma_node_reset(struct drm_vma_offset_node *node) * Start address of @node for page-based addressing. 0 if the node does not * have an offset allocated. */ -static inline unsigned long drm_vma_node_start(struct drm_vma_offset_node *node) +static inline unsigned long drm_vma_node_start(const struct drm_vma_offset_node *node) { return node->vm_node.start; }
Hi Noralf,
Thank you for the patch.
On Monday, 30 October 2017 18:29:35 EET Noralf Trønnes wrote:
Constify argument so functions calling into this take a const argument.
Reviewed-by: Ville Syrjälä ville.syrjala@linux.intel.com Signed-off-by: Noralf Trønnes noralf@tronnes.org
Reviewed-by: Laurent Pinchart laurent.pinchart@ideasonboard.com
include/drm/drm_vma_manager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/drm/drm_vma_manager.h b/include/drm/drm_vma_manager.h index d84d52f6d2b1..8758df94e9a0 100644 --- a/include/drm/drm_vma_manager.h +++ b/include/drm/drm_vma_manager.h @@ -152,7 +152,7 @@ static inline void drm_vma_node_reset(struct drm_vma_offset_node *node) * Start address of @node for page-based addressing. 0 if the node does not * have an offset allocated. */ -static inline unsigned long drm_vma_node_start(struct drm_vma_offset_node *node) +static inline unsigned long drm_vma_node_start(const struct drm_vma_offset_node *node) { return node->vm_node.start; }
Constify argument so functions calling into this take a const argument.
Reviewed-by: Ville Syrjälä ville.syrjala@linux.intel.com Signed-off-by: Noralf Trønnes noralf@tronnes.org --- include/drm/drm_framebuffer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/drm/drm_framebuffer.h b/include/drm/drm_framebuffer.h index b6996ddb19d6..6cce22e1a0f2 100644 --- a/include/drm/drm_framebuffer.h +++ b/include/drm/drm_framebuffer.h @@ -263,7 +263,7 @@ static inline void drm_framebuffer_unreference(struct drm_framebuffer *fb) * * This functions returns the framebuffer's reference count. */ -static inline uint32_t drm_framebuffer_read_refcount(struct drm_framebuffer *fb) +static inline uint32_t drm_framebuffer_read_refcount(const struct drm_framebuffer *fb) { return kref_read(&fb->base.refcount); }
Hi Noralf,
Thank you for the patch.
On Monday, 30 October 2017 18:29:36 EET Noralf Trønnes wrote:
Constify argument so functions calling into this take a const argument.
Reviewed-by: Ville Syrjälä ville.syrjala@linux.intel.com Signed-off-by: Noralf Trønnes noralf@tronnes.org
Reviwed-by: Laurent Pinchart laurent.pinchart@ideasonboard.com
include/drm/drm_framebuffer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/drm/drm_framebuffer.h b/include/drm/drm_framebuffer.h index b6996ddb19d6..6cce22e1a0f2 100644 --- a/include/drm/drm_framebuffer.h +++ b/include/drm/drm_framebuffer.h @@ -263,7 +263,7 @@ static inline void drm_framebuffer_unreference(struct drm_framebuffer *fb) *
- This functions returns the framebuffer's reference count.
*/ -static inline uint32_t drm_framebuffer_read_refcount(struct drm_framebuffer *fb) +static inline uint32_t drm_framebuffer_read_refcount(const struct drm_framebuffer *fb) { return kref_read(&fb->base.refcount); }
Add drm_printf_indent() that adds tab indentation according to argument. Indentation overflow is marked with an X.
Reviewed-by: Daniel Vetter daniel.vetter@ffwll.ch Signed-off-by: Noralf Trønnes noralf@tronnes.org ---
Changes since version 3: - Turn drm_printf_indent() into a macro (Ville) - drm_printf_indent() add overflow marker (Jani)
include/drm/drm_print.h | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 7b9c86a6ca3e..7dbfdebec973 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -80,6 +80,14 @@ void __drm_printfn_debug(struct drm_printer *p, struct va_format *vaf); __printf(2, 3) void drm_printf(struct drm_printer *p, const char *f, ...);
+/** + * drm_printf_indent - Print to a &drm_printer stream with indentation + * @printer: DRM printer + * @indent: Tab indentation level (max 5) + * @fmt: Format string + */ +#define drm_printf_indent(printer, indent, fmt, ...) \ + drm_printf((printer), "%.*s" fmt, (indent), "\t\t\t\t\tX", ##__VA_ARGS__)
/** * drm_seq_file_printer - construct a &drm_printer that outputs to &seq_file
Hi Noralf,
Thank you for the patch.
On Monday, 30 October 2017 18:29:37 EET Noralf Trønnes wrote:
Add drm_printf_indent() that adds tab indentation according to argument. Indentation overflow is marked with an X.
I wonder if this kind of thing would be useful to add to printk somehow. That's not a blocker though, we can switch to a more generic implementation later when one will be available.
Reviewed-by: Daniel Vetter daniel.vetter@ffwll.ch Signed-off-by: Noralf Trønnes noralf@tronnes.org
Reviewed-by: Laurent Pinchart laurent.pinchart@ideasonboard.com
Changes since version 3:
- Turn drm_printf_indent() into a macro (Ville)
- drm_printf_indent() add overflow marker (Jani)
include/drm/drm_print.h | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 7b9c86a6ca3e..7dbfdebec973 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -80,6 +80,14 @@ void __drm_printfn_debug(struct drm_printer *p, struct va_format *vaf); __printf(2, 3) void drm_printf(struct drm_printer *p, const char *f, ...);
+/**
- drm_printf_indent - Print to a &drm_printer stream with indentation
- @printer: DRM printer
- @indent: Tab indentation level (max 5)
- @fmt: Format string
- */
+#define drm_printf_indent(printer, indent, fmt, ...) \
- drm_printf((printer), "%.*s" fmt, (indent), "\t\t\t\t\tX", ##__VA_ARGS__)
/**
- drm_seq_file_printer - construct a &drm_printer that outputs to
&seq_file
Add debugfs file that dumps info about the framebuffers and its planes. Also dump info about any connected gem object(s).
Reviewed-by: Daniel Vetter daniel.vetter@ffwll.ch Signed-off-by: Noralf Trønnes noralf@tronnes.org --- drivers/gpu/drm/drm_debugfs.c | 6 ++++ drivers/gpu/drm/drm_framebuffer.c | 59 +++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/drm_gem.c | 17 +++++++++++ drivers/gpu/drm/drm_internal.h | 7 +++++ include/drm/drm_drv.h | 11 ++++++++ 5 files changed, 100 insertions(+)
diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c index c1807d5754b2..550f29de6c1f 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c @@ -158,6 +158,12 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id, } }
+ ret = drm_framebuffer_debugfs_init(minor); + if (ret) { + DRM_ERROR("Failed to create framebuffer debugfs file\n"); + return ret; + } + if (dev->driver->debugfs_init) { ret = dev->driver->debugfs_init(minor); if (ret) { diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c index af279844d7ce..4f7873a1b922 100644 --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -25,7 +25,9 @@ #include <drm/drm_auth.h> #include <drm/drm_framebuffer.h> #include <drm/drm_atomic.h> +#include <drm/drm_print.h>
+#include "drm_internal.h" #include "drm_crtc_internal.h"
/** @@ -955,3 +957,60 @@ int drm_framebuffer_plane_height(int height, return fb_plane_height(height, fb->format, plane); } EXPORT_SYMBOL(drm_framebuffer_plane_height); + +void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent, + const struct drm_framebuffer *fb) +{ + struct drm_format_name_buf format_name; + int i; + + drm_printf_indent(p, indent, "refcount=%d\n", + drm_framebuffer_read_refcount(fb)); + drm_printf_indent(p, indent, "format=%s\n", + drm_get_format_name(fb->format->format, &format_name)); + drm_printf_indent(p, indent, "modifier=0x%llx\n", fb->modifier); + drm_printf_indent(p, indent, "size=%dx%d\n", fb->width, fb->height); + drm_printf_indent(p, indent, "layers:\n"); + + for (i = 0; i < fb->format->num_planes; i++) { + drm_printf_indent(p, indent + 1, "size[%d]=%dx%d\n", i, + drm_framebuffer_plane_width(fb->width, fb, i), + drm_framebuffer_plane_height(fb->height, fb, i)); + drm_printf_indent(p, indent + 1, "pitch[%d]=%u\n", i, fb->pitches[i]); + drm_printf_indent(p, indent + 1, "offset[%d]=%u\n", i, fb->offsets[i]); + drm_printf_indent(p, indent + 1, "obj[%d]:%s\n", i, + fb->obj[i] ? "" : "(null)"); + if (fb->obj[i]) + drm_gem_print_info(p, indent + 2, fb->obj[i]); + } +} + +#ifdef CONFIG_DEBUG_FS +static int drm_framebuffer_info(struct seq_file *m, void *data) +{ + struct drm_info_node *node = m->private; + struct drm_device *dev = node->minor->dev; + struct drm_printer p = drm_seq_file_printer(m); + struct drm_framebuffer *fb; + + mutex_lock(&dev->mode_config.fb_lock); + drm_for_each_fb(fb, dev) { + drm_printf(&p, "framebuffer[%d]:\n", fb->base.id); + drm_framebuffer_print_info(&p, 1, fb); + } + mutex_unlock(&dev->mode_config.fb_lock); + + return 0; +} + +static const struct drm_info_list drm_framebuffer_debugfs_list[] = { + { "framebuffer", drm_framebuffer_info, 0 }, +}; + +int drm_framebuffer_debugfs_init(struct drm_minor *minor) +{ + return drm_debugfs_create_files(drm_framebuffer_debugfs_list, + ARRAY_SIZE(drm_framebuffer_debugfs_list), + minor->debugfs_root, minor); +} +#endif diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index 4c84b23d37cc..152bd6210dde 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c @@ -40,6 +40,7 @@ #include <drm/drmP.h> #include <drm/drm_vma_manager.h> #include <drm/drm_gem.h> +#include <drm/drm_print.h> #include "drm_internal.h"
/** @file drm_gem.c @@ -1040,3 +1041,19 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma) return ret; } EXPORT_SYMBOL(drm_gem_mmap); + +void drm_gem_print_info(struct drm_printer *p, unsigned int indent, + const struct drm_gem_object *obj) +{ + drm_printf_indent(p, indent, "name=%d\n", obj->name); + drm_printf_indent(p, indent, "refcount=%d\n", + kref_read(&obj->refcount)); + drm_printf_indent(p, indent, "start=%08lx\n", + drm_vma_node_start(&obj->vma_node)); + drm_printf_indent(p, indent, "size=%zu\n", obj->size); + drm_printf_indent(p, indent, "imported=%s\n", + obj->import_attach ? "yes" : "no"); + + if (obj->dev->driver->gem_print_info) + obj->dev->driver->gem_print_info(p, indent, obj); +} diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index fbc3f308fa19..430ce3fe4f3b 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -106,6 +106,8 @@ int drm_gem_open_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv); void drm_gem_open(struct drm_device *dev, struct drm_file *file_private); void drm_gem_release(struct drm_device *dev, struct drm_file *file_private); +void drm_gem_print_info(struct drm_printer *p, unsigned int indent, + const struct drm_gem_object *obj);
/* drm_debugfs.c drm_debugfs_crc.c */ #if defined(CONFIG_DEBUG_FS) @@ -173,3 +175,8 @@ int drm_syncobj_reset_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private); int drm_syncobj_signal_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private); + +/* drm_framebuffer.c */ +void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent, + const struct drm_framebuffer *fb); +int drm_framebuffer_debugfs_init(struct drm_minor *minor); diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h index 0e90ef24214b..434de999c3ba 100644 --- a/include/drm/drm_drv.h +++ b/include/drm/drm_drv.h @@ -39,6 +39,7 @@ struct drm_minor; struct dma_buf_attachment; struct drm_display_mode; struct drm_mode_create_dumb; +struct drm_printer;
/* driver capabilities and requirements mask */ #define DRIVER_USE_AGP 0x1 @@ -428,6 +429,16 @@ struct drm_driver { */ void (*gem_close_object) (struct drm_gem_object *, struct drm_file *);
+ /** + * @gem_print_info: + * + * If driver subclasses struct &drm_gem_object, it can implement this + * optional hook for printing additional driver specific info. + * See drm_gem_print_info(). + */ + void (*gem_print_info)(struct drm_printer *p, unsigned int indent, + const struct drm_gem_object *obj); + /** * @gem_create_object: constructor for gem objects *
Hi Noralf,
Thank you for the patch.
On Monday, 30 October 2017 18:29:38 EET Noralf Trønnes wrote:
Add debugfs file that dumps info about the framebuffers and its planes. Also dump info about any connected gem object(s).
Reviewed-by: Daniel Vetter daniel.vetter@ffwll.ch Signed-off-by: Noralf Trønnes noralf@tronnes.org
drivers/gpu/drm/drm_debugfs.c | 6 ++++ drivers/gpu/drm/drm_framebuffer.c | 59 ++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/drm_gem.c | 17 +++++++++++ drivers/gpu/drm/drm_internal.h | 7 +++++ include/drm/drm_drv.h | 11 ++++++++ 5 files changed, 100 insertions(+)
diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c index c1807d5754b2..550f29de6c1f 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c @@ -158,6 +158,12 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id, } }
- ret = drm_framebuffer_debugfs_init(minor);
- if (ret) {
DRM_ERROR("Failed to create framebuffer debugfs file\n");
return ret;
- }
- if (dev->driver->debugfs_init) { ret = dev->driver->debugfs_init(minor); if (ret) {
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c index af279844d7ce..4f7873a1b922 100644 --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -25,7 +25,9 @@ #include <drm/drm_auth.h> #include <drm/drm_framebuffer.h> #include <drm/drm_atomic.h> +#include <drm/drm_print.h>
+#include "drm_internal.h" #include "drm_crtc_internal.h"
/** @@ -955,3 +957,60 @@ int drm_framebuffer_plane_height(int height, return fb_plane_height(height, fb->format, plane); } EXPORT_SYMBOL(drm_framebuffer_plane_height);
+void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent,
const struct drm_framebuffer *fb)
+{
- struct drm_format_name_buf format_name;
- int i;
i is never negative, you can make it an unsigned int.
- drm_printf_indent(p, indent, "refcount=%d\n",
drm_framebuffer_read_refcount(fb));
drm_framebuffer_read_refcount() returns an unsigned int, the printk format should be %u.
- drm_printf_indent(p, indent, "format=%s\n",
drm_get_format_name(fb->format->format, &format_name));
- drm_printf_indent(p, indent, "modifier=0x%llx\n", fb->modifier);
- drm_printf_indent(p, indent, "size=%dx%d\n", fb->width, fb->height);
Ditto here, %ux%u.
- drm_printf_indent(p, indent, "layers:\n");
- for (i = 0; i < fb->format->num_planes; i++) {
drm_printf_indent(p, indent + 1, "size[%d]=%dx%d\n", i,
drm_framebuffer_plane_width(fb->width, fb, i),
drm_framebuffer_plane_height(fb->height, fb, i));
drm_printf_indent(p, indent + 1, "pitch[%d]=%u\n", i, fb->pitches[i]);
drm_printf_indent(p, indent + 1, "offset[%d]=%u\n", i, fb->offsets[i]);
drm_printf_indent(p, indent + 1, "obj[%d]:%s\n", i,
fb->obj[i] ? "" : "(null)");
And in various places here too.
if (fb->obj[i])
drm_gem_print_info(p, indent + 2, fb->obj[i]);
- }
+}
+#ifdef CONFIG_DEBUG_FS +static int drm_framebuffer_info(struct seq_file *m, void *data) +{
- struct drm_info_node *node = m->private;
- struct drm_device *dev = node->minor->dev;
- struct drm_printer p = drm_seq_file_printer(m);
- struct drm_framebuffer *fb;
- mutex_lock(&dev->mode_config.fb_lock);
- drm_for_each_fb(fb, dev) {
drm_printf(&p, "framebuffer[%d]:\n", fb->base.id);
fb->base.id is an unsigned int, the printk format should be %u.
drm_framebuffer_print_info(&p, 1, fb);
- }
- mutex_unlock(&dev->mode_config.fb_lock);
- return 0;
+}
+static const struct drm_info_list drm_framebuffer_debugfs_list[] = {
- { "framebuffer", drm_framebuffer_info, 0 },
+};
+int drm_framebuffer_debugfs_init(struct drm_minor *minor) +{
- return drm_debugfs_create_files(drm_framebuffer_debugfs_list,
ARRAY_SIZE(drm_framebuffer_debugfs_list),
minor->debugfs_root, minor);
+} +#endif diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index 4c84b23d37cc..152bd6210dde 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c @@ -40,6 +40,7 @@ #include <drm/drmP.h> #include <drm/drm_vma_manager.h> #include <drm/drm_gem.h> +#include <drm/drm_print.h> #include "drm_internal.h"
/** @file drm_gem.c @@ -1040,3 +1041,19 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma) return ret; } EXPORT_SYMBOL(drm_gem_mmap);
+void drm_gem_print_info(struct drm_printer *p, unsigned int indent,
const struct drm_gem_object *obj)
+{
- drm_printf_indent(p, indent, "name=%d\n", obj->name);
- drm_printf_indent(p, indent, "refcount=%d\n",
kref_read(&obj->refcount));
kref_read() returns an unsigned int, the printk format should be %u.
- drm_printf_indent(p, indent, "start=%08lx\n",
drm_vma_node_start(&obj->vma_node));
- drm_printf_indent(p, indent, "size=%zu\n", obj->size);
- drm_printf_indent(p, indent, "imported=%s\n",
obj->import_attach ? "yes" : "no");
- if (obj->dev->driver->gem_print_info)
obj->dev->driver->gem_print_info(p, indent, obj);
+} diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index fbc3f308fa19..430ce3fe4f3b 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -106,6 +106,8 @@ int drm_gem_open_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv); void drm_gem_open(struct drm_device *dev, struct drm_file *file_private); void drm_gem_release(struct drm_device *dev, struct drm_file *file_private); +void drm_gem_print_info(struct drm_printer *p, unsigned int indent,
const struct drm_gem_object *obj);
/* drm_debugfs.c drm_debugfs_crc.c */ #if defined(CONFIG_DEBUG_FS) @@ -173,3 +175,8 @@ int drm_syncobj_reset_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private); int drm_syncobj_signal_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private);
+/* drm_framebuffer.c */ +void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent,
const struct drm_framebuffer *fb);
+int drm_framebuffer_debugfs_init(struct drm_minor *minor); diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h index 0e90ef24214b..434de999c3ba 100644 --- a/include/drm/drm_drv.h +++ b/include/drm/drm_drv.h @@ -39,6 +39,7 @@ struct drm_minor; struct dma_buf_attachment; struct drm_display_mode; struct drm_mode_create_dumb; +struct drm_printer;
/* driver capabilities and requirements mask */ #define DRIVER_USE_AGP 0x1 @@ -428,6 +429,16 @@ struct drm_driver { */ void (*gem_close_object) (struct drm_gem_object *, struct drm_file *);
- /**
* @gem_print_info:
*
* If driver subclasses struct &drm_gem_object, it can implement this
* optional hook for printing additional driver specific info.
* See drm_gem_print_info().
Should you also document the meaning of the indent argument ?
*/
- void (*gem_print_info)(struct drm_printer *p, unsigned int indent,
const struct drm_gem_object *obj);
- /**
- @gem_create_object: constructor for gem objects
With all this fixed,
Reviewed-by: Laurent Pinchart laurent.pinchart@ideasonboard.com
Hi Laurent,
Thank you for the review.
Den 02.11.2017 05.43, skrev Laurent Pinchart:
Hi Noralf,
Thank you for the patch.
On Monday, 30 October 2017 18:29:38 EET Noralf Trønnes wrote:
Add debugfs file that dumps info about the framebuffers and its planes. Also dump info about any connected gem object(s).
Reviewed-by: Daniel Vetter daniel.vetter@ffwll.ch Signed-off-by: Noralf Trønnes noralf@tronnes.org
drivers/gpu/drm/drm_debugfs.c | 6 ++++ drivers/gpu/drm/drm_framebuffer.c | 59 ++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/drm_gem.c | 17 +++++++++++ drivers/gpu/drm/drm_internal.h | 7 +++++ include/drm/drm_drv.h | 11 ++++++++ 5 files changed, 100 insertions(+)
diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c index c1807d5754b2..550f29de6c1f 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c @@ -158,6 +158,12 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id, } }
- ret = drm_framebuffer_debugfs_init(minor);
- if (ret) {
DRM_ERROR("Failed to create framebuffer debugfs file\n");
return ret;
- }
- if (dev->driver->debugfs_init) { ret = dev->driver->debugfs_init(minor); if (ret) {
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c index af279844d7ce..4f7873a1b922 100644 --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -25,7 +25,9 @@ #include <drm/drm_auth.h> #include <drm/drm_framebuffer.h> #include <drm/drm_atomic.h> +#include <drm/drm_print.h>
+#include "drm_internal.h" #include "drm_crtc_internal.h"
/** @@ -955,3 +957,60 @@ int drm_framebuffer_plane_height(int height, return fb_plane_height(height, fb->format, plane); } EXPORT_SYMBOL(drm_framebuffer_plane_height);
+void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent,
const struct drm_framebuffer *fb)
+{
- struct drm_format_name_buf format_name;
- int i;
i is never negative, you can make it an unsigned int.
Yeah, I did that in a previous version, but Ville wanted it to be int. Personally I don't really care as long as I remember to use int when I have a loop that counts down to zero, which has bitten me before.
So based on my experience maybe I should always use plain int in loop indices, too avoid that rare count down case where I continue to use unsigned int for the loop index, me being a limited human being :-)
Noralf.
- drm_printf_indent(p, indent, "refcount=%d\n",
drm_framebuffer_read_refcount(fb));
drm_framebuffer_read_refcount() returns an unsigned int, the printk format should be %u.
- drm_printf_indent(p, indent, "format=%s\n",
drm_get_format_name(fb->format->format, &format_name));
- drm_printf_indent(p, indent, "modifier=0x%llx\n", fb->modifier);
- drm_printf_indent(p, indent, "size=%dx%d\n", fb->width, fb->height);
Ditto here, %ux%u.
- drm_printf_indent(p, indent, "layers:\n");
- for (i = 0; i < fb->format->num_planes; i++) {
drm_printf_indent(p, indent + 1, "size[%d]=%dx%d\n", i,
drm_framebuffer_plane_width(fb->width, fb, i),
drm_framebuffer_plane_height(fb->height, fb, i));
drm_printf_indent(p, indent + 1, "pitch[%d]=%u\n", i, fb->pitches[i]);
drm_printf_indent(p, indent + 1, "offset[%d]=%u\n", i, fb->offsets[i]);
drm_printf_indent(p, indent + 1, "obj[%d]:%s\n", i,
fb->obj[i] ? "" : "(null)");
And in various places here too.
if (fb->obj[i])
drm_gem_print_info(p, indent + 2, fb->obj[i]);
- }
+}
+#ifdef CONFIG_DEBUG_FS +static int drm_framebuffer_info(struct seq_file *m, void *data) +{
- struct drm_info_node *node = m->private;
- struct drm_device *dev = node->minor->dev;
- struct drm_printer p = drm_seq_file_printer(m);
- struct drm_framebuffer *fb;
- mutex_lock(&dev->mode_config.fb_lock);
- drm_for_each_fb(fb, dev) {
drm_printf(&p, "framebuffer[%d]:\n", fb->base.id);
fb->base.id is an unsigned int, the printk format should be %u.
drm_framebuffer_print_info(&p, 1, fb);
- }
- mutex_unlock(&dev->mode_config.fb_lock);
- return 0;
+}
+static const struct drm_info_list drm_framebuffer_debugfs_list[] = {
- { "framebuffer", drm_framebuffer_info, 0 },
+};
+int drm_framebuffer_debugfs_init(struct drm_minor *minor) +{
- return drm_debugfs_create_files(drm_framebuffer_debugfs_list,
ARRAY_SIZE(drm_framebuffer_debugfs_list),
minor->debugfs_root, minor);
+} +#endif diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index 4c84b23d37cc..152bd6210dde 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c @@ -40,6 +40,7 @@ #include <drm/drmP.h> #include <drm/drm_vma_manager.h> #include <drm/drm_gem.h> +#include <drm/drm_print.h> #include "drm_internal.h"
/** @file drm_gem.c @@ -1040,3 +1041,19 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma) return ret; } EXPORT_SYMBOL(drm_gem_mmap);
+void drm_gem_print_info(struct drm_printer *p, unsigned int indent,
const struct drm_gem_object *obj)
+{
- drm_printf_indent(p, indent, "name=%d\n", obj->name);
- drm_printf_indent(p, indent, "refcount=%d\n",
kref_read(&obj->refcount));
kref_read() returns an unsigned int, the printk format should be %u.
- drm_printf_indent(p, indent, "start=%08lx\n",
drm_vma_node_start(&obj->vma_node));
- drm_printf_indent(p, indent, "size=%zu\n", obj->size);
- drm_printf_indent(p, indent, "imported=%s\n",
obj->import_attach ? "yes" : "no");
- if (obj->dev->driver->gem_print_info)
obj->dev->driver->gem_print_info(p, indent, obj);
+} diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index fbc3f308fa19..430ce3fe4f3b 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -106,6 +106,8 @@ int drm_gem_open_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv); void drm_gem_open(struct drm_device *dev, struct drm_file *file_private); void drm_gem_release(struct drm_device *dev, struct drm_file *file_private); +void drm_gem_print_info(struct drm_printer *p, unsigned int indent,
const struct drm_gem_object *obj);
/* drm_debugfs.c drm_debugfs_crc.c */ #if defined(CONFIG_DEBUG_FS)
@@ -173,3 +175,8 @@ int drm_syncobj_reset_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private); int drm_syncobj_signal_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private);
+/* drm_framebuffer.c */ +void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent,
const struct drm_framebuffer *fb);
+int drm_framebuffer_debugfs_init(struct drm_minor *minor); diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h index 0e90ef24214b..434de999c3ba 100644 --- a/include/drm/drm_drv.h +++ b/include/drm/drm_drv.h @@ -39,6 +39,7 @@ struct drm_minor; struct dma_buf_attachment; struct drm_display_mode; struct drm_mode_create_dumb; +struct drm_printer;
/* driver capabilities and requirements mask */ #define DRIVER_USE_AGP 0x1 @@ -428,6 +429,16 @@ struct drm_driver { */ void (*gem_close_object) (struct drm_gem_object *, struct drm_file *);
- /**
* @gem_print_info:
*
* If driver subclasses struct &drm_gem_object, it can implement this
* optional hook for printing additional driver specific info.
* See drm_gem_print_info().
Should you also document the meaning of the indent argument ?
*/
- void (*gem_print_info)(struct drm_printer *p, unsigned int indent,
const struct drm_gem_object *obj);
- /**
- @gem_create_object: constructor for gem objects
With all this fixed,
Reviewed-by: Laurent Pinchart laurent.pinchart@ideasonboard.com
Use drm_framebuffer_print_info() to print framebuffer info in drm_atomic_plane_print_state(). This will give optional GEM info as well.
Reviewed-by: Daniel Vetter daniel.vetter@ffwll.ch Signed-off-by: Noralf Trønnes noralf@tronnes.org --- drivers/gpu/drm/drm_atomic.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 6c9c4a8e09af..6d626355ba4e 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -33,6 +33,7 @@ #include <linux/sync_file.h>
#include "drm_crtc_internal.h" +#include "drm_internal.h"
void __drm_crtc_commit_free(struct kref *kref) { @@ -934,21 +935,8 @@ static void drm_atomic_plane_print_state(struct drm_printer *p, drm_printf(p, "plane[%u]: %s\n", plane->base.id, plane->name); drm_printf(p, "\tcrtc=%s\n", state->crtc ? state->crtc->name : "(null)"); drm_printf(p, "\tfb=%u\n", state->fb ? state->fb->base.id : 0); - if (state->fb) { - struct drm_framebuffer *fb = state->fb; - int i, n = fb->format->num_planes; - struct drm_format_name_buf format_name; - - drm_printf(p, "\t\tformat=%s\n", - drm_get_format_name(fb->format->format, &format_name)); - drm_printf(p, "\t\t\tmodifier=0x%llx\n", fb->modifier); - drm_printf(p, "\t\tsize=%dx%d\n", fb->width, fb->height); - drm_printf(p, "\t\tlayers:\n"); - for (i = 0; i < n; i++) { - drm_printf(p, "\t\t\tpitch[%d]=%u\n", i, fb->pitches[i]); - drm_printf(p, "\t\t\toffset[%d]=%u\n", i, fb->offsets[i]); - } - } + if (state->fb) + drm_framebuffer_print_info(p, 2, state->fb); drm_printf(p, "\tcrtc-pos=" DRM_RECT_FMT "\n", DRM_RECT_ARG(&dest)); drm_printf(p, "\tsrc-pos=" DRM_RECT_FP_FMT "\n", DRM_RECT_FP_ARG(&src)); drm_printf(p, "\trotation=%x\n", state->rotation);
Hi Noralf,
Thank you for the patch.
On Monday, 30 October 2017 18:29:39 EET Noralf Trønnes wrote:
Use drm_framebuffer_print_info() to print framebuffer info in drm_atomic_plane_print_state(). This will give optional GEM info as well.
Reviewed-by: Daniel Vetter daniel.vetter@ffwll.ch Signed-off-by: Noralf Trønnes noralf@tronnes.org
Reviewed-by: Laurent Pinchart laurent.pinchart@ideasonboard.com
drivers/gpu/drm/drm_atomic.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 6c9c4a8e09af..6d626355ba4e 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -33,6 +33,7 @@ #include <linux/sync_file.h>
#include "drm_crtc_internal.h" +#include "drm_internal.h"
void __drm_crtc_commit_free(struct kref *kref) { @@ -934,21 +935,8 @@ static void drm_atomic_plane_print_state(struct drm_printer *p, drm_printf(p, "plane[%u]: %s\n", plane->base.id, plane->name); drm_printf(p, "\tcrtc=%s\n", state->crtc ? state->crtc->name : "(null)"); drm_printf(p, "\tfb=%u\n", state->fb ? state->fb->base.id : 0);
- if (state->fb) {
struct drm_framebuffer *fb = state->fb;
int i, n = fb->format->num_planes;
struct drm_format_name_buf format_name;
drm_printf(p, "\t\tformat=%s\n",
drm_get_format_name(fb->format->format, &format_name));
drm_printf(p, "\t\t\tmodifier=0x%llx\n", fb->modifier);
drm_printf(p, "\t\tsize=%dx%d\n", fb->width, fb->height);
drm_printf(p, "\t\tlayers:\n");
for (i = 0; i < n; i++) {
drm_printf(p, "\t\t\tpitch[%d]=%u\n", i, fb->pitches[i]);
drm_printf(p, "\t\t\toffset[%d]=%u\n", i, fb->offsets[i]);
}
- }
- if (state->fb)
drm_printf(p, "\tcrtc-pos=" DRM_RECT_FMT "\n", DRM_RECT_ARG(&dest)); drm_printf(p, "\tsrc-pos=" DRM_RECT_FP_FMT "\n", DRM_RECT_FP_ARG(&src)); drm_printf(p, "\trotation=%x\n", state->rotation);drm_framebuffer_print_info(p, 2, state->fb);
Add drm_gem_cma_print_info() for debugfs printing struct drm_gem_cma_object specific info.
Reviewed-by: Daniel Vetter daniel.vetter@ffwll.ch Signed-off-by: Noralf Trønnes noralf@tronnes.org --- drivers/gpu/drm/drm_gem_cma_helper.c | 19 +++++++++++++++++++ include/drm/drm_gem_cma_helper.h | 5 ++++- 2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c index 020e7668dfab..89dc7f04fae6 100644 --- a/drivers/gpu/drm/drm_gem_cma_helper.c +++ b/drivers/gpu/drm/drm_gem_cma_helper.c @@ -423,6 +423,25 @@ void drm_gem_cma_describe(struct drm_gem_cma_object *cma_obj, EXPORT_SYMBOL_GPL(drm_gem_cma_describe); #endif
+/** + * drm_gem_cma_print_info() - Print &drm_gem_cma_object info for debugfs + * @p: DRM printer + * @indent: Tab indentation level + * @gem: GEM object + * + * This function can be used as the &drm_driver->gem_print_info callback. + * It prints paddr and vaddr for use in e.g. debugfs output. + */ +void drm_gem_cma_print_info(struct drm_printer *p, unsigned int indent, + const struct drm_gem_object *obj) +{ + struct drm_gem_cma_object *cma_obj = to_drm_gem_cma_obj(obj); + + drm_printf_indent(p, indent, "paddr=%pad\n", &cma_obj->paddr); + drm_printf_indent(p, indent, "vaddr=%p\n", cma_obj->vaddr); +} +EXPORT_SYMBOL(drm_gem_cma_print_info); + /** * drm_gem_cma_prime_get_sg_table - provide a scatter/gather table of pinned * pages for a CMA GEM object diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h index 58a739bf15f1..bc47e6eba271 100644 --- a/include/drm/drm_gem_cma_helper.h +++ b/include/drm/drm_gem_cma_helper.h @@ -21,7 +21,7 @@ struct drm_gem_cma_object { };
static inline struct drm_gem_cma_object * -to_drm_gem_cma_obj(struct drm_gem_object *gem_obj) +to_drm_gem_cma_obj(const struct drm_gem_object *gem_obj) { return container_of(gem_obj, struct drm_gem_cma_object, base); } @@ -94,6 +94,9 @@ unsigned long drm_gem_cma_get_unmapped_area(struct file *filp, void drm_gem_cma_describe(struct drm_gem_cma_object *obj, struct seq_file *m); #endif
+void drm_gem_cma_print_info(struct drm_printer *p, unsigned int indent, + const struct drm_gem_object *obj); + struct sg_table *drm_gem_cma_prime_get_sg_table(struct drm_gem_object *obj); struct drm_gem_object * drm_gem_cma_prime_import_sg_table(struct drm_device *dev,
Hi Noralf,
Than you for the patch.
On Monday, 30 October 2017 18:29:40 EET Noralf Trønnes wrote:
Add drm_gem_cma_print_info() for debugfs printing struct drm_gem_cma_object specific info.
Reviewed-by: Daniel Vetter daniel.vetter@ffwll.ch Signed-off-by: Noralf Trønnes noralf@tronnes.org
drivers/gpu/drm/drm_gem_cma_helper.c | 19 +++++++++++++++++++ include/drm/drm_gem_cma_helper.h | 5 ++++- 2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c index 020e7668dfab..89dc7f04fae6 100644 --- a/drivers/gpu/drm/drm_gem_cma_helper.c +++ b/drivers/gpu/drm/drm_gem_cma_helper.c @@ -423,6 +423,25 @@ void drm_gem_cma_describe(struct drm_gem_cma_object *cma_obj, EXPORT_SYMBOL_GPL(drm_gem_cma_describe); #endif
+/**
- drm_gem_cma_print_info() - Print &drm_gem_cma_object info for debugfs
- @p: DRM printer
- @indent: Tab indentation level
- @gem: GEM object
- This function can be used as the &drm_driver->gem_print_info callback.
- It prints paddr and vaddr for use in e.g. debugfs output.
- */
+void drm_gem_cma_print_info(struct drm_printer *p, unsigned int indent,
const struct drm_gem_object *obj)
+{
- struct drm_gem_cma_object *cma_obj = to_drm_gem_cma_obj(obj);
- drm_printf_indent(p, indent, "paddr=%pad\n", &cma_obj->paddr);
- drm_printf_indent(p, indent, "vaddr=%p\n", cma_obj->vaddr);
+} +EXPORT_SYMBOL(drm_gem_cma_print_info);
/**
- drm_gem_cma_prime_get_sg_table - provide a scatter/gather table of
pinned * pages for a CMA GEM object diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h index 58a739bf15f1..bc47e6eba271 100644 --- a/include/drm/drm_gem_cma_helper.h +++ b/include/drm/drm_gem_cma_helper.h @@ -21,7 +21,7 @@ struct drm_gem_cma_object { };
static inline struct drm_gem_cma_object * -to_drm_gem_cma_obj(struct drm_gem_object *gem_obj) +to_drm_gem_cma_obj(const struct drm_gem_object *gem_obj)
This will happily return a non-const pointer to the drm_gem_cma_object based on a const pointer to the contained drm_gem_object, thus creating const-safety problems.
There was an attempt to fix the problem in the container_of() macro itself (see https://lkml.org/lkml/2017/5/19/381) but the patch seems to have fallen through the cracks. It would require turning this inline function into a macro.
I don't think we need to wait for the container_of() patch to land, but it would be useful to turn the inline function into a macro already to automatically benefit from the change, instead of introducting a const-safety problem that we will all forget about until it breaks something in the future.
{ return container_of(gem_obj, struct drm_gem_cma_object, base); } @@ -94,6 +94,9 @@ unsigned long drm_gem_cma_get_unmapped_area(struct file *filp, void drm_gem_cma_describe(struct drm_gem_cma_object *obj, struct seq_file *m); #endif
+void drm_gem_cma_print_info(struct drm_printer *p, unsigned int indent,
const struct drm_gem_object *obj);
struct sg_table *drm_gem_cma_prime_get_sg_table(struct drm_gem_object *obj); struct drm_gem_object * drm_gem_cma_prime_import_sg_table(struct drm_device *dev,
There is a new core debugfs file that prints fb/gem info: <debugfs>/dri/<n>/framebuffer
Use drm_gem_cma_print_info() to provide info to that output instead of using drm_fb_cma_debugfs_show().
Cc: Alexey Brodkin abrodkin@synopsys.com Signed-off-by: Noralf Trønnes noralf@tronnes.org --- drivers/gpu/drm/arc/arcpgu_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c index 074fd4ea7ece..f067de4e1e82 100644 --- a/drivers/gpu/drm/arc/arcpgu_drv.c +++ b/drivers/gpu/drm/arc/arcpgu_drv.c @@ -155,7 +155,6 @@ static int arcpgu_show_pxlclock(struct seq_file *m, void *arg)
static struct drm_info_list arcpgu_debugfs_list[] = { { "clocks", arcpgu_show_pxlclock, 0 }, - { "fb", drm_fb_cma_debugfs_show, 0 }, };
static int arcpgu_debugfs_init(struct drm_minor *minor) @@ -180,6 +179,7 @@ static struct drm_driver arcpgu_drm_driver = { .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_free_object_unlocked = drm_gem_cma_free_object, + .gem_print_info = drm_gem_cma_print_info, .gem_vm_ops = &drm_gem_cma_vm_ops, .gem_prime_export = drm_gem_prime_export, .gem_prime_import = drm_gem_prime_import,
Hi Noralf,
On Mon, 2017-10-30 at 17:29 +0100, Noralf Trønnes wrote:
There is a new core debugfs file that prints fb/gem info: <debugfs>/dri/<n>/framebuffer
Use drm_gem_cma_print_info() to provide info to that output instead of using drm_fb_cma_debugfs_show().
Cc: Alexey Brodkin abrodkin@synopsys.com Signed-off-by: Noralf Trønnes noralf@tronnes.org
Thanks for doing this!
We used to have just: ----------------------------->8-------------------------- # cat fb fb: 1280x720@RG16 0: offset=0 pitch=2560, obj: 0 ( 1) 00008000 0xbe000000 70100000 1843200 ----------------------------->8--------------------------
And now we get more: a) information printed b) readable form of this info ----------------------------->8-------------------------- # cat framebuffer framebuffer[33]: refcount=3 format=RG16 little-endian (0x36314752) modifier=0x0 size=1280x720 layers: size[0]=1280x720 pitch[0]=2560 offset[0]=0 obj[0]: name=0 refcount=1 start=00008000 size=1843200 imported=no paddr=0xbe000000 vaddr=70100000 ----------------------------->8--------------------------
Acked-by: Alexey Brodkin abrodkin@synopsys.com
On Tue, Oct 31, 2017 at 04:17:07PM +0000, Alexey Brodkin wrote:
Hi Noralf,
On Mon, 2017-10-30 at 17:29 +0100, Noralf Trønnes wrote:
There is a new core debugfs file that prints fb/gem info: <debugfs>/dri/<n>/framebuffer
Use drm_gem_cma_print_info() to provide info to that output instead of using drm_fb_cma_debugfs_show().
Cc: Alexey Brodkin abrodkin@synopsys.com Signed-off-by: Noralf Trønnes noralf@tronnes.org
Thanks for doing this!
We used to have just: ----------------------------->8-------------------------- # cat fb fb: 1280x720@RG16 0: offset=0 pitch=2560, obj: 0 ( 1) 00008000 0xbe000000 70100000 1843200 ----------------------------->8--------------------------
And now we get more: a) information printed b) readable form of this info ----------------------------->8-------------------------- # cat framebuffer framebuffer[33]: refcount=3 format=RG16 little-endian (0x36314752) modifier=0x0 size=1280x720 layers:
BTW "layers" seems like a somewhat confusing term to use here. I believe layers mean something different in GL, so we probably shouldn't use that name here.
The current name used in the code is "plane". But that too is rather confusing on account of drm_plane. IIRC in the past I've proposed that we should s/plane/color_plane/ when talking about the planes of a framebuffer.
size[0]=1280x720 pitch[0]=2560 offset[0]=0 obj[0]: name=0 refcount=1 start=00008000 size=1843200 imported=no paddr=0xbe000000 vaddr=70100000 ----------------------------->8--------------------------
Acked-by: Alexey Brodkin abrodkin@synopsys.com
Hi Noralf,
Thank you for the patch.
On Monday, 30 October 2017 18:29:41 EET Noralf Trønnes wrote:
There is a new core debugfs file that prints fb/gem info: <debugfs>/dri/<n>/framebuffer
Use drm_gem_cma_print_info() to provide info to that output instead of using drm_fb_cma_debugfs_show().
Cc: Alexey Brodkin abrodkin@synopsys.com Signed-off-by: Noralf Trønnes noralf@tronnes.org
Reviewed-by: Laurent Pinchart laurent.pinchart@ideasonboard.com
drivers/gpu/drm/arc/arcpgu_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c index 074fd4ea7ece..f067de4e1e82 100644 --- a/drivers/gpu/drm/arc/arcpgu_drv.c +++ b/drivers/gpu/drm/arc/arcpgu_drv.c @@ -155,7 +155,6 @@ static int arcpgu_show_pxlclock(struct seq_file *m, void *arg)
static struct drm_info_list arcpgu_debugfs_list[] = { { "clocks", arcpgu_show_pxlclock, 0 },
- { "fb", drm_fb_cma_debugfs_show, 0 },
};
static int arcpgu_debugfs_init(struct drm_minor *minor) @@ -180,6 +179,7 @@ static struct drm_driver arcpgu_drm_driver = { .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_free_object_unlocked = drm_gem_cma_free_object,
- .gem_print_info = drm_gem_cma_print_info, .gem_vm_ops = &drm_gem_cma_vm_ops, .gem_prime_export = drm_gem_prime_export, .gem_prime_import = drm_gem_prime_import,
There is a new core debugfs file that prints fb/gem info: <debugfs>/dri/<n>/framebuffer
Use drm_gem_cma_print_info() to provide info to that output instead of using drm_fb_cma_debugfs_show().
Cc: Liviu Dudau liviu.dudau@arm.com Cc: Brian Starkey brian.starkey@arm.com Signed-off-by: Noralf Trønnes noralf@tronnes.org --- drivers/gpu/drm/arm/hdlcd_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c index 764d0c83710c..59b21bdc0c30 100644 --- a/drivers/gpu/drm/arm/hdlcd_drv.c +++ b/drivers/gpu/drm/arm/hdlcd_drv.c @@ -230,7 +230,6 @@ static int hdlcd_show_pxlclock(struct seq_file *m, void *arg) static struct drm_info_list hdlcd_debugfs_list[] = { { "interrupt_count", hdlcd_show_underrun_count, 0 }, { "clocks", hdlcd_show_pxlclock, 0 }, - { "fb", drm_fb_cma_debugfs_show, 0 }, };
static int hdlcd_debugfs_init(struct drm_minor *minor) @@ -252,6 +251,7 @@ static struct drm_driver hdlcd_driver = { .irq_postinstall = hdlcd_irq_postinstall, .irq_uninstall = hdlcd_irq_uninstall, .gem_free_object_unlocked = drm_gem_cma_free_object, + .gem_print_info = drm_gem_cma_print_info, .gem_vm_ops = &drm_gem_cma_vm_ops, .dumb_create = drm_gem_cma_dumb_create, .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
On Mon, Oct 30, 2017 at 05:29:42PM +0100, Noralf Trønnes wrote:
There is a new core debugfs file that prints fb/gem info: <debugfs>/dri/<n>/framebuffer
Use drm_gem_cma_print_info() to provide info to that output instead of using drm_fb_cma_debugfs_show().
Cc: Liviu Dudau liviu.dudau@arm.com Cc: Brian Starkey brian.starkey@arm.com Signed-off-by: Noralf Trønnes noralf@tronnes.org
Acked-by: Liviu Dudau liviu.dudau@arm.com
I'm going to assume that you are going to carry the whole series through drm-misc (or some other tree of your choice) and you don't need me to pull this patch through my tree.
Best regards, Liviu
drivers/gpu/drm/arm/hdlcd_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c index 764d0c83710c..59b21bdc0c30 100644 --- a/drivers/gpu/drm/arm/hdlcd_drv.c +++ b/drivers/gpu/drm/arm/hdlcd_drv.c @@ -230,7 +230,6 @@ static int hdlcd_show_pxlclock(struct seq_file *m, void *arg) static struct drm_info_list hdlcd_debugfs_list[] = { { "interrupt_count", hdlcd_show_underrun_count, 0 }, { "clocks", hdlcd_show_pxlclock, 0 },
- { "fb", drm_fb_cma_debugfs_show, 0 },
};
static int hdlcd_debugfs_init(struct drm_minor *minor) @@ -252,6 +251,7 @@ static struct drm_driver hdlcd_driver = { .irq_postinstall = hdlcd_irq_postinstall, .irq_uninstall = hdlcd_irq_uninstall, .gem_free_object_unlocked = drm_gem_cma_free_object,
- .gem_print_info = drm_gem_cma_print_info, .gem_vm_ops = &drm_gem_cma_vm_ops, .dumb_create = drm_gem_cma_dumb_create, .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
-- 2.14.2
Hi Noralf,
Thank you for the patch.
On Monday, 30 October 2017 18:29:42 EET Noralf Trønnes wrote:
There is a new core debugfs file that prints fb/gem info: <debugfs>/dri/<n>/framebuffer
Use drm_gem_cma_print_info() to provide info to that output instead of using drm_fb_cma_debugfs_show().
Cc: Liviu Dudau liviu.dudau@arm.com Cc: Brian Starkey brian.starkey@arm.com Signed-off-by: Noralf Trønnes noralf@tronnes.org
Reviewed-by: Laurent Pinchart laurent.pinchart@ideasonboard.com
drivers/gpu/drm/arm/hdlcd_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c index 764d0c83710c..59b21bdc0c30 100644 --- a/drivers/gpu/drm/arm/hdlcd_drv.c +++ b/drivers/gpu/drm/arm/hdlcd_drv.c @@ -230,7 +230,6 @@ static int hdlcd_show_pxlclock(struct seq_file *m, void *arg) static struct drm_info_list hdlcd_debugfs_list[] = { { "interrupt_count", hdlcd_show_underrun_count, 0 }, { "clocks", hdlcd_show_pxlclock, 0 },
- { "fb", drm_fb_cma_debugfs_show, 0 },
};
static int hdlcd_debugfs_init(struct drm_minor *minor) @@ -252,6 +251,7 @@ static struct drm_driver hdlcd_driver = { .irq_postinstall = hdlcd_irq_postinstall, .irq_uninstall = hdlcd_irq_uninstall, .gem_free_object_unlocked = drm_gem_cma_free_object,
- .gem_print_info = drm_gem_cma_print_info, .gem_vm_ops = &drm_gem_cma_vm_ops, .dumb_create = drm_gem_cma_dumb_create, .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
There is a new core debugfs file that prints fb/gem info: <debugfs>/dri/<n>/framebuffer
Use drm_gem_cma_print_info() to provide info to that output instead of using drm_fb_cma_debugfs_show().
Cc: Jyri Sarha jsarha@ti.com Cc: Tomi Valkeinen tomi.valkeinen@ti.com Signed-off-by: Noralf Trønnes noralf@tronnes.org --- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index 72ce063aa0d8..bc4feb3a84b9 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c @@ -507,7 +507,6 @@ static int tilcdc_mm_show(struct seq_file *m, void *arg) static struct drm_info_list tilcdc_debugfs_list[] = { { "regs", tilcdc_regs_show, 0 }, { "mm", tilcdc_mm_show, 0 }, - { "fb", drm_fb_cma_debugfs_show, 0 }, };
static int tilcdc_debugfs_init(struct drm_minor *minor) @@ -541,6 +540,7 @@ static struct drm_driver tilcdc_driver = { .lastclose = tilcdc_lastclose, .irq_handler = tilcdc_irq, .gem_free_object_unlocked = drm_gem_cma_free_object, + .gem_print_info = drm_gem_cma_print_info, .gem_vm_ops = &drm_gem_cma_vm_ops, .dumb_create = drm_gem_cma_dumb_create,
On 10/30/2017 06:29 PM, Noralf Trønnes wrote:
There is a new core debugfs file that prints fb/gem info: <debugfs>/dri/<n>/framebuffer
Use drm_gem_cma_print_info() to provide info to that output instead of using drm_fb_cma_debugfs_show().
Cc: Jyri Sarha jsarha@ti.com Cc: Tomi Valkeinen tomi.valkeinen@ti.com Signed-off-by: Noralf Trønnes noralf@tronnes.org
Acked-by: Jyri Sarha jsarha@ti.com
Thanks, Just let me know if I should pick this to my next tilcdc pull request.
Best regards, Jyri
drivers/gpu/drm/tilcdc/tilcdc_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index 72ce063aa0d8..bc4feb3a84b9 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c @@ -507,7 +507,6 @@ static int tilcdc_mm_show(struct seq_file *m, void *arg) static struct drm_info_list tilcdc_debugfs_list[] = { { "regs", tilcdc_regs_show, 0 }, { "mm", tilcdc_mm_show, 0 },
{ "fb", drm_fb_cma_debugfs_show, 0 },
};
static int tilcdc_debugfs_init(struct drm_minor *minor) @@ -541,6 +540,7 @@ static struct drm_driver tilcdc_driver = { .lastclose = tilcdc_lastclose, .irq_handler = tilcdc_irq, .gem_free_object_unlocked = drm_gem_cma_free_object,
- .gem_print_info = drm_gem_cma_print_info, .gem_vm_ops = &drm_gem_cma_vm_ops, .dumb_create = drm_gem_cma_dumb_create,
Hi Noralf,
Thank you for the patch.
On Monday, 30 October 2017 18:29:43 EET Noralf Trønnes wrote:
There is a new core debugfs file that prints fb/gem info: <debugfs>/dri/<n>/framebuffer
Use drm_gem_cma_print_info() to provide info to that output instead of using drm_fb_cma_debugfs_show().
Cc: Jyri Sarha jsarha@ti.com Cc: Tomi Valkeinen tomi.valkeinen@ti.com Signed-off-by: Noralf Trønnes noralf@tronnes.org
Reviewed-by: Laurent Pinchart laurent.pinchart@ideasonboard.com
drivers/gpu/drm/tilcdc/tilcdc_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index 72ce063aa0d8..bc4feb3a84b9 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c @@ -507,7 +507,6 @@ static int tilcdc_mm_show(struct seq_file *m, void *arg) static struct drm_info_list tilcdc_debugfs_list[] = { { "regs", tilcdc_regs_show, 0 }, { "mm", tilcdc_mm_show, 0 },
{ "fb", drm_fb_cma_debugfs_show, 0 },
};
static int tilcdc_debugfs_init(struct drm_minor *minor) @@ -541,6 +540,7 @@ static struct drm_driver tilcdc_driver = { .lastclose = tilcdc_lastclose, .irq_handler = tilcdc_irq, .gem_free_object_unlocked = drm_gem_cma_free_object,
- .gem_print_info = drm_gem_cma_print_info, .gem_vm_ops = &drm_gem_cma_vm_ops, .dumb_create = drm_gem_cma_dumb_create,
There is a new core debugfs file that prints fb/gem info: <debugfs>/dri/<n>/framebuffer
Use drm_gem_cma_print_info() to provide info to that output instead of using drm_fb_cma_debugfs_show().
Reviewed-by: Daniel Vetter daniel.vetter@ffwll.ch Signed-off-by: Noralf Trønnes noralf@tronnes.org --- drivers/gpu/drm/tinydrm/mipi-dbi.c | 8 +------- include/drm/tinydrm/tinydrm.h | 1 + 2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/tinydrm/mipi-dbi.c b/drivers/gpu/drm/tinydrm/mipi-dbi.c index d43e992ab432..347f9b226f26 100644 --- a/drivers/gpu/drm/tinydrm/mipi-dbi.c +++ b/drivers/gpu/drm/tinydrm/mipi-dbi.c @@ -961,10 +961,6 @@ static const struct file_operations mipi_dbi_debugfs_command_fops = { .write = mipi_dbi_debugfs_command_write, };
-static const struct drm_info_list mipi_dbi_debugfs_list[] = { - { "fb", drm_fb_cma_debugfs_show, 0 }, -}; - /** * mipi_dbi_debugfs_init - Create debugfs entries * @minor: DRM minor @@ -987,9 +983,7 @@ int mipi_dbi_debugfs_init(struct drm_minor *minor) debugfs_create_file("command", mode, minor->debugfs_root, mipi, &mipi_dbi_debugfs_command_fops);
- return drm_debugfs_create_files(mipi_dbi_debugfs_list, - ARRAY_SIZE(mipi_dbi_debugfs_list), - minor->debugfs_root, minor); + return 0; } EXPORT_SYMBOL(mipi_dbi_debugfs_init);
diff --git a/include/drm/tinydrm/tinydrm.h b/include/drm/tinydrm/tinydrm.h index 4774fe3d4273..423828922e5a 100644 --- a/include/drm/tinydrm/tinydrm.h +++ b/include/drm/tinydrm/tinydrm.h @@ -46,6 +46,7 @@ pipe_to_tinydrm(struct drm_simple_display_pipe *pipe) */ #define TINYDRM_GEM_DRIVER_OPS \ .gem_free_object = tinydrm_gem_cma_free_object, \ + .gem_print_info = drm_gem_cma_print_info, \ .gem_vm_ops = &drm_gem_cma_vm_ops, \ .prime_handle_to_fd = drm_gem_prime_handle_to_fd, \ .prime_fd_to_handle = drm_gem_prime_fd_to_handle, \
Hi Noralf,
Thank you for the patch.
On Monday, 30 October 2017 18:29:44 EET Noralf Trønnes wrote:
There is a new core debugfs file that prints fb/gem info: <debugfs>/dri/<n>/framebuffer
Use drm_gem_cma_print_info() to provide info to that output instead of using drm_fb_cma_debugfs_show().
Reviewed-by: Daniel Vetter daniel.vetter@ffwll.ch Signed-off-by: Noralf Trønnes noralf@tronnes.org
Reviewed-by: Laurent Pinchart laurent.pinchart@ideasonboard.com
drivers/gpu/drm/tinydrm/mipi-dbi.c | 8 +------- include/drm/tinydrm/tinydrm.h | 1 + 2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/tinydrm/mipi-dbi.c b/drivers/gpu/drm/tinydrm/mipi-dbi.c index d43e992ab432..347f9b226f26 100644 --- a/drivers/gpu/drm/tinydrm/mipi-dbi.c +++ b/drivers/gpu/drm/tinydrm/mipi-dbi.c @@ -961,10 +961,6 @@ static const struct file_operations mipi_dbi_debugfs_command_fops = { .write = mipi_dbi_debugfs_command_write, };
-static const struct drm_info_list mipi_dbi_debugfs_list[] = {
- { "fb", drm_fb_cma_debugfs_show, 0 },
-};
/**
- mipi_dbi_debugfs_init - Create debugfs entries
- @minor: DRM minor
@@ -987,9 +983,7 @@ int mipi_dbi_debugfs_init(struct drm_minor *minor) debugfs_create_file("command", mode, minor->debugfs_root, mipi, &mipi_dbi_debugfs_command_fops);
- return drm_debugfs_create_files(mipi_dbi_debugfs_list,
ARRAY_SIZE(mipi_dbi_debugfs_list),
minor->debugfs_root, minor);
- return 0;
} EXPORT_SYMBOL(mipi_dbi_debugfs_init);
diff --git a/include/drm/tinydrm/tinydrm.h b/include/drm/tinydrm/tinydrm.h index 4774fe3d4273..423828922e5a 100644 --- a/include/drm/tinydrm/tinydrm.h +++ b/include/drm/tinydrm/tinydrm.h @@ -46,6 +46,7 @@ pipe_to_tinydrm(struct drm_simple_display_pipe *pipe) */ #define TINYDRM_GEM_DRIVER_OPS \ .gem_free_object = tinydrm_gem_cma_free_object, \
- .gem_print_info = drm_gem_cma_print_info, \ .gem_vm_ops = &drm_gem_cma_vm_ops, \ .prime_handle_to_fd = drm_gem_prime_handle_to_fd, \ .prime_fd_to_handle = drm_gem_prime_fd_to_handle, \
drm_fb_cma_debugfs_show() and drm_gem_cma_describe() are superseded by drm_framebuffer_debugfs_init() and drm_gem_cma_print_info().
Cc: Laurent Pinchart laurent.pinchart@ideasonboard.com Signed-off-by: Noralf Trønnes noralf@tronnes.org --- drivers/gpu/drm/drm_fb_cma_helper.c | 37 ------------------------------------ drivers/gpu/drm/drm_gem_cma_helper.c | 26 ------------------------- include/drm/drm_fb_cma_helper.h | 6 ------ include/drm/drm_gem_cma_helper.h | 4 ---- 4 files changed, 73 deletions(-)
diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c index 0e3c14174d08..35b56dfba929 100644 --- a/drivers/gpu/drm/drm_fb_cma_helper.c +++ b/drivers/gpu/drm/drm_fb_cma_helper.c @@ -130,43 +130,6 @@ dma_addr_t drm_fb_cma_get_gem_addr(struct drm_framebuffer *fb, } EXPORT_SYMBOL_GPL(drm_fb_cma_get_gem_addr);
-#ifdef CONFIG_DEBUG_FS -static void drm_fb_cma_describe(struct drm_framebuffer *fb, struct seq_file *m) -{ - int i; - - seq_printf(m, "fb: %dx%d@%4.4s\n", fb->width, fb->height, - (char *)&fb->format->format); - - for (i = 0; i < fb->format->num_planes; i++) { - seq_printf(m, " %d: offset=%d pitch=%d, obj: ", - i, fb->offsets[i], fb->pitches[i]); - drm_gem_cma_describe(drm_fb_cma_get_gem_obj(fb, i), m); - } -} - -/** - * drm_fb_cma_debugfs_show() - Helper to list CMA framebuffer objects - * in debugfs. - * @m: output file - * @arg: private data for the callback - */ -int drm_fb_cma_debugfs_show(struct seq_file *m, void *arg) -{ - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct drm_device *dev = node->minor->dev; - struct drm_framebuffer *fb; - - mutex_lock(&dev->mode_config.fb_lock); - drm_for_each_fb(fb, dev) - drm_fb_cma_describe(fb, m); - mutex_unlock(&dev->mode_config.fb_lock); - - return 0; -} -EXPORT_SYMBOL_GPL(drm_fb_cma_debugfs_show); -#endif - static int drm_fb_cma_mmap(struct fb_info *info, struct vm_area_struct *vma) { return dma_mmap_writecombine(info->device, vma, info->screen_base, diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c index 89dc7f04fae6..9b99f9feb432 100644 --- a/drivers/gpu/drm/drm_gem_cma_helper.c +++ b/drivers/gpu/drm/drm_gem_cma_helper.c @@ -397,32 +397,6 @@ unsigned long drm_gem_cma_get_unmapped_area(struct file *filp, EXPORT_SYMBOL_GPL(drm_gem_cma_get_unmapped_area); #endif
-#ifdef CONFIG_DEBUG_FS -/** - * drm_gem_cma_describe - describe a CMA GEM object for debugfs - * @cma_obj: CMA GEM object - * @m: debugfs file handle - * - * This function can be used to dump a human-readable representation of the - * CMA GEM object into a synthetic file. - */ -void drm_gem_cma_describe(struct drm_gem_cma_object *cma_obj, - struct seq_file *m) -{ - struct drm_gem_object *obj = &cma_obj->base; - uint64_t off; - - off = drm_vma_node_start(&obj->vma_node); - - seq_printf(m, "%2d (%2d) %08llx %pad %p %zu", - obj->name, kref_read(&obj->refcount), - off, &cma_obj->paddr, cma_obj->vaddr, obj->size); - - seq_printf(m, "\n"); -} -EXPORT_SYMBOL_GPL(drm_gem_cma_describe); -#endif - /** * drm_gem_cma_print_info() - Print &drm_gem_cma_object info for debugfs * @p: DRM printer diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h index 023f052a5873..a613ff022e6c 100644 --- a/include/drm/drm_fb_cma_helper.h +++ b/include/drm/drm_fb_cma_helper.h @@ -35,11 +35,5 @@ dma_addr_t drm_fb_cma_get_gem_addr(struct drm_framebuffer *fb, struct drm_plane_state *state, unsigned int plane);
-#ifdef CONFIG_DEBUG_FS -struct seq_file; - -int drm_fb_cma_debugfs_show(struct seq_file *m, void *arg); -#endif - #endif
diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h index bc47e6eba271..08375115fdc0 100644 --- a/include/drm/drm_gem_cma_helper.h +++ b/include/drm/drm_gem_cma_helper.h @@ -90,10 +90,6 @@ unsigned long drm_gem_cma_get_unmapped_area(struct file *filp, unsigned long flags); #endif
-#ifdef CONFIG_DEBUG_FS -void drm_gem_cma_describe(struct drm_gem_cma_object *obj, struct seq_file *m); -#endif - void drm_gem_cma_print_info(struct drm_printer *p, unsigned int indent, const struct drm_gem_object *obj);
On Mon, Oct 30, 2017 at 05:29:45PM +0100, Noralf Trønnes wrote:
drm_fb_cma_debugfs_show() and drm_gem_cma_describe() are superseded by drm_framebuffer_debugfs_init() and drm_gem_cma_print_info().
Cc: Laurent Pinchart laurent.pinchart@ideasonboard.com Signed-off-by: Noralf Trønnes noralf@tronnes.org
Nice addition to the series, I totally missed this. For patches 7-11:
Reviewed-by: Daniel Vetter daniel.vetter@ffwll.ch
drivers/gpu/drm/drm_fb_cma_helper.c | 37 ------------------------------------ drivers/gpu/drm/drm_gem_cma_helper.c | 26 ------------------------- include/drm/drm_fb_cma_helper.h | 6 ------ include/drm/drm_gem_cma_helper.h | 4 ---- 4 files changed, 73 deletions(-)
diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c index 0e3c14174d08..35b56dfba929 100644 --- a/drivers/gpu/drm/drm_fb_cma_helper.c +++ b/drivers/gpu/drm/drm_fb_cma_helper.c @@ -130,43 +130,6 @@ dma_addr_t drm_fb_cma_get_gem_addr(struct drm_framebuffer *fb, } EXPORT_SYMBOL_GPL(drm_fb_cma_get_gem_addr);
-#ifdef CONFIG_DEBUG_FS -static void drm_fb_cma_describe(struct drm_framebuffer *fb, struct seq_file *m) -{
- int i;
- seq_printf(m, "fb: %dx%d@%4.4s\n", fb->width, fb->height,
(char *)&fb->format->format);
- for (i = 0; i < fb->format->num_planes; i++) {
seq_printf(m, " %d: offset=%d pitch=%d, obj: ",
i, fb->offsets[i], fb->pitches[i]);
drm_gem_cma_describe(drm_fb_cma_get_gem_obj(fb, i), m);
- }
-}
-/**
- drm_fb_cma_debugfs_show() - Helper to list CMA framebuffer objects
in debugfs.
- @m: output file
- @arg: private data for the callback
- */
-int drm_fb_cma_debugfs_show(struct seq_file *m, void *arg) -{
- struct drm_info_node *node = (struct drm_info_node *) m->private;
- struct drm_device *dev = node->minor->dev;
- struct drm_framebuffer *fb;
- mutex_lock(&dev->mode_config.fb_lock);
- drm_for_each_fb(fb, dev)
drm_fb_cma_describe(fb, m);
- mutex_unlock(&dev->mode_config.fb_lock);
- return 0;
-} -EXPORT_SYMBOL_GPL(drm_fb_cma_debugfs_show); -#endif
static int drm_fb_cma_mmap(struct fb_info *info, struct vm_area_struct *vma) { return dma_mmap_writecombine(info->device, vma, info->screen_base, diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c index 89dc7f04fae6..9b99f9feb432 100644 --- a/drivers/gpu/drm/drm_gem_cma_helper.c +++ b/drivers/gpu/drm/drm_gem_cma_helper.c @@ -397,32 +397,6 @@ unsigned long drm_gem_cma_get_unmapped_area(struct file *filp, EXPORT_SYMBOL_GPL(drm_gem_cma_get_unmapped_area); #endif
-#ifdef CONFIG_DEBUG_FS -/**
- drm_gem_cma_describe - describe a CMA GEM object for debugfs
- @cma_obj: CMA GEM object
- @m: debugfs file handle
- This function can be used to dump a human-readable representation of the
- CMA GEM object into a synthetic file.
- */
-void drm_gem_cma_describe(struct drm_gem_cma_object *cma_obj,
struct seq_file *m)
-{
- struct drm_gem_object *obj = &cma_obj->base;
- uint64_t off;
- off = drm_vma_node_start(&obj->vma_node);
- seq_printf(m, "%2d (%2d) %08llx %pad %p %zu",
obj->name, kref_read(&obj->refcount),
off, &cma_obj->paddr, cma_obj->vaddr, obj->size);
- seq_printf(m, "\n");
-} -EXPORT_SYMBOL_GPL(drm_gem_cma_describe); -#endif
/**
- drm_gem_cma_print_info() - Print &drm_gem_cma_object info for debugfs
- @p: DRM printer
diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h index 023f052a5873..a613ff022e6c 100644 --- a/include/drm/drm_fb_cma_helper.h +++ b/include/drm/drm_fb_cma_helper.h @@ -35,11 +35,5 @@ dma_addr_t drm_fb_cma_get_gem_addr(struct drm_framebuffer *fb, struct drm_plane_state *state, unsigned int plane);
-#ifdef CONFIG_DEBUG_FS -struct seq_file;
-int drm_fb_cma_debugfs_show(struct seq_file *m, void *arg); -#endif
#endif
diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h index bc47e6eba271..08375115fdc0 100644 --- a/include/drm/drm_gem_cma_helper.h +++ b/include/drm/drm_gem_cma_helper.h @@ -90,10 +90,6 @@ unsigned long drm_gem_cma_get_unmapped_area(struct file *filp, unsigned long flags); #endif
-#ifdef CONFIG_DEBUG_FS -void drm_gem_cma_describe(struct drm_gem_cma_object *obj, struct seq_file *m); -#endif
void drm_gem_cma_print_info(struct drm_printer *p, unsigned int indent, const struct drm_gem_object *obj);
-- 2.14.2
Hi Noralf,
Thank you for the patch.
On Monday, 30 October 2017 18:29:45 EET Noralf Trønnes wrote:
drm_fb_cma_debugfs_show() and drm_gem_cma_describe() are superseded by drm_framebuffer_debugfs_init() and drm_gem_cma_print_info().
Cc: Laurent Pinchart laurent.pinchart@ideasonboard.com Signed-off-by: Noralf Trønnes noralf@tronnes.org
Reviewed-by: Laurent Pinchart laurent.pinchart@ideasonboard.com
drivers/gpu/drm/drm_fb_cma_helper.c | 37 --------------------------------- drivers/gpu/drm/drm_gem_cma_helper.c | 26 ------------------------- include/drm/drm_fb_cma_helper.h | 6 ------ include/drm/drm_gem_cma_helper.h | 4 ---- 4 files changed, 73 deletions(-)
diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c index 0e3c14174d08..35b56dfba929 100644 --- a/drivers/gpu/drm/drm_fb_cma_helper.c +++ b/drivers/gpu/drm/drm_fb_cma_helper.c @@ -130,43 +130,6 @@ dma_addr_t drm_fb_cma_get_gem_addr(struct drm_framebuffer *fb, } EXPORT_SYMBOL_GPL(drm_fb_cma_get_gem_addr);
-#ifdef CONFIG_DEBUG_FS -static void drm_fb_cma_describe(struct drm_framebuffer *fb, struct seq_file *m) -{
- int i;
- seq_printf(m, "fb: %dx%d@%4.4s\n", fb->width, fb->height,
(char *)&fb->format->format);
- for (i = 0; i < fb->format->num_planes; i++) {
seq_printf(m, " %d: offset=%d pitch=%d, obj: ",
i, fb->offsets[i], fb->pitches[i]);
drm_gem_cma_describe(drm_fb_cma_get_gem_obj(fb, i), m);
- }
-}
-/**
- drm_fb_cma_debugfs_show() - Helper to list CMA framebuffer objects
in debugfs.
- @m: output file
- @arg: private data for the callback
- */
-int drm_fb_cma_debugfs_show(struct seq_file *m, void *arg) -{
- struct drm_info_node *node = (struct drm_info_node *) m->private;
- struct drm_device *dev = node->minor->dev;
- struct drm_framebuffer *fb;
- mutex_lock(&dev->mode_config.fb_lock);
- drm_for_each_fb(fb, dev)
drm_fb_cma_describe(fb, m);
- mutex_unlock(&dev->mode_config.fb_lock);
- return 0;
-} -EXPORT_SYMBOL_GPL(drm_fb_cma_debugfs_show); -#endif
static int drm_fb_cma_mmap(struct fb_info *info, struct vm_area_struct *vma) { return dma_mmap_writecombine(info->device, vma, info->screen_base, diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c index 89dc7f04fae6..9b99f9feb432 100644 --- a/drivers/gpu/drm/drm_gem_cma_helper.c +++ b/drivers/gpu/drm/drm_gem_cma_helper.c @@ -397,32 +397,6 @@ unsigned long drm_gem_cma_get_unmapped_area(struct file *filp, EXPORT_SYMBOL_GPL(drm_gem_cma_get_unmapped_area); #endif
-#ifdef CONFIG_DEBUG_FS -/**
- drm_gem_cma_describe - describe a CMA GEM object for debugfs
- @cma_obj: CMA GEM object
- @m: debugfs file handle
- This function can be used to dump a human-readable representation of the
- CMA GEM object into a synthetic file.
- */
-void drm_gem_cma_describe(struct drm_gem_cma_object *cma_obj,
struct seq_file *m)
-{
- struct drm_gem_object *obj = &cma_obj->base;
- uint64_t off;
- off = drm_vma_node_start(&obj->vma_node);
- seq_printf(m, "%2d (%2d) %08llx %pad %p %zu",
obj->name, kref_read(&obj->refcount),
off, &cma_obj->paddr, cma_obj->vaddr, obj->size);
- seq_printf(m, "\n");
-} -EXPORT_SYMBOL_GPL(drm_gem_cma_describe); -#endif
/**
- drm_gem_cma_print_info() - Print &drm_gem_cma_object info for debugfs
- @p: DRM printer
diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h index 023f052a5873..a613ff022e6c 100644 --- a/include/drm/drm_fb_cma_helper.h +++ b/include/drm/drm_fb_cma_helper.h @@ -35,11 +35,5 @@ dma_addr_t drm_fb_cma_get_gem_addr(struct drm_framebuffer *fb, struct drm_plane_state *state, unsigned int plane);
-#ifdef CONFIG_DEBUG_FS -struct seq_file;
-int drm_fb_cma_debugfs_show(struct seq_file *m, void *arg); -#endif
#endif
diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h index bc47e6eba271..08375115fdc0 100644 --- a/include/drm/drm_gem_cma_helper.h +++ b/include/drm/drm_gem_cma_helper.h @@ -90,10 +90,6 @@ unsigned long drm_gem_cma_get_unmapped_area(struct file *filp, unsigned long flags); #endif
-#ifdef CONFIG_DEBUG_FS -void drm_gem_cma_describe(struct drm_gem_cma_object *obj, struct seq_file *m); -#endif
void drm_gem_cma_print_info(struct drm_printer *p, unsigned int indent, const struct drm_gem_object *obj);
dri-devel@lists.freedesktop.org