Skip to contentSkip to conversation

drm/framebuffer: Add framebuffer debugfs file

PATCH Superseded Noralf Trønnes 7 participants 29 messages Oct 30, 2017 – Nov 4, 2017

Subsystems (5)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover drm/framebuffer: Add framebuffer debugfs file

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

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#1 lore raw

PATCH v4 1/11 drm/vma-manager: drm_vma_node_start() constify argument

Constify argument so functions calling into this take a const argument.

---
 include/drm/drm_vma_manager.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/drm/drm_vma_manager.h +1 -1
index d84d52f6d2b1..8758df94e9a0 100644
@@ -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;
 }
Signature · 6 lines
2.14.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v4 1/11
#2 lore raw

Re: [PATCH v4 01/11] drm/vma-manager: drm_vma_node_start() constify argument

Hi Noralf,

Thank you for the patch.

Quoted 4 lines · On Monday, 30 October 2017 18:29:35 EET Noralf Trønnes wrote:

Constify argument so functions calling into this take a const argument.

Quoted 17 lines
---
 include/drm/drm_vma_manager.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/drm/drm_vma_manager.h +0 -0
index d84d52f6d2b1..8758df94e9a0 100644
@@ -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;
}

Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

PATCH v4 2/11 drm/framebuffer: drm_framebuffer_read_refcount() constify argument

In reply to Noralf Trønnes

Constify argument so functions calling into this take a const argument.

---
 include/drm/drm_framebuffer.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/drm/drm_framebuffer.h +1 -1
index b6996ddb19d6..6cce22e1a0f2 100644
@@ -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);
 }
Signature · 6 lines
2.14.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw

Re: [PATCH v4 02/11] drm/framebuffer: drm_framebuffer_read_refcount() constify argument

Hi Noralf,

Thank you for the patch.

Quoted 4 lines · On Monday, 30 October 2017 18:29:36 EET Noralf Trønnes wrote:

Constify argument so functions calling into this take a const argument.

Quoted 17 lines
---
 include/drm/drm_framebuffer.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/drm/drm_framebuffer.h +0 -0
index b6996ddb19d6..6cce22e1a0f2 100644
@@ -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);
}

Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#5 lore raw

PATCH v4 3/11 drm/print: Add drm_printf_indent()

In reply to Noralf Trønnes

Add drm_printf_indent() that adds tab indentation according to argument. Indentation overflow is marked with an X.

---

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(+)
include/drm/drm_print.h +8 -0
index 7b9c86a6ca3e..7dbfdebec973 100644
@@ -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
Signature · 6 lines
2.14.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v4 3/11
#6 lore raw

Re: [PATCH v4 03/11] drm/print: Add drm_printf_indent()

Hi Noralf,

Thank you for the patch.

Quoted 2 lines · 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.

Quoted 2 lines
Quoted 29 lines

---

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(+)
include/drm/drm_print.h +8 -0
index 7b9c86a6ca3e..7dbfdebec973 100644
@@ -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

Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#7 lore raw

PATCH v4 4/11 drm/framebuffer: Add framebuffer debugfs file

In reply to Noralf Trønnes

Add debugfs file that dumps info about the framebuffers and its planes. Also dump info about any connected gem object(s).

---
 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(+)
drivers/gpu/drm/drm_debugfs.c +6 -0
index c1807d5754b2..550f29de6c1f 100644
@@ -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) {
drivers/gpu/drm/drm_framebuffer.c +59 -0

69 lines not on this page · raw message

drivers/gpu/drm/drm_gem.c +17 -0
index 4c84b23d37cc..152bd6210dde 100644
@@ -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);
+}
drivers/gpu/drm/drm_internal.h +7 -0
index fbc3f308fa19..430ce3fe4f3b 100644
@@ -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);
include/drm/drm_drv.h +11 -0
index 0e90ef24214b..434de999c3ba 100644
@@ -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
 	 *
Signature · 6 lines
2.14.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v4 4/11
#8 lore raw

Hi Noralf,

Thank you for the patch.

Quoted 45 lines · 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).

---
 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(+)
drivers/gpu/drm/drm_debugfs.c +6 -0
index c1807d5754b2..550f29de6c1f 100644
@@ -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) {
(quoted diff) +0 -0

b/drivers/gpu/drm/drm_framebuffer.c index af279844d7ce..4f7873a1b922 100644

drivers/gpu/drm/drm_framebuffer.c +2 -0
@@ -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"
 
 /**

drivers/gpu/drm/drm_framebuffer.c int drm_framebuffer_plane_height(int height, · line 965

Quoted 9 lines
drivers/gpu/drm/drm_framebuffer.c +6 -0
@@ -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.

drivers/gpu/drm/drm_framebuffer.c int drm_framebuffer_plane_height(int height, · line 968

Quoted 2 lines
drivers/gpu/drm/drm_framebuffer.c +2 -0
+	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.

drivers/gpu/drm/drm_framebuffer.c int drm_framebuffer_plane_height(int height, · line 972

Quoted 4 lines
drivers/gpu/drm/drm_framebuffer.c +4 -0
+	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.

drivers/gpu/drm/drm_framebuffer.c int drm_framebuffer_plane_height(int height, · line 982

Quoted 10 lines
drivers/gpu/drm/drm_framebuffer.c +10 -0
+	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.

Quoted 6 lines
drivers/gpu/drm/drm_framebuffer.c +6 -0
+		if (fb->obj[i])
+			drm_gem_print_info(p, indent + 2, fb->obj[i]);
+	}
+}
+
+#ifdef CONFIG_DEBUG_FS

drivers/gpu/drm/drm_framebuffer.c int drm_framebuffer_plane_height(int height, · line 998

Quoted 10 lines
drivers/gpu/drm/drm_framebuffer.c +10 -0
+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.

Quoted 31 lines
drivers/gpu/drm/drm_framebuffer.c +18 -0
+		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
drivers/gpu/drm/drm_gem.c +1 -0
index 4c84b23d37cc..152bd6210dde 100644
@@ -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

drivers/gpu/drm/drm_gem.c int drm_gem_mmap(struct file *filp, struct · line 1050

Quoted 10 lines
drivers/gpu/drm/drm_gem.c +7 -0
@@ -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.

Quoted 45 lines
drivers/gpu/drm/drm_gem.c +9 -0
+	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);
+}
drivers/gpu/drm/drm_internal.h +2 -0
index fbc3f308fa19..430ce3fe4f3b 100644
@@ -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)

drivers/gpu/drm/drm_internal.h +5 -0
@@ -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);
include/drm/drm_drv.h +1 -0
index 0e90ef24214b..434de999c3ba 100644
@@ -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

include/drm/drm_drv.h struct drm_driver { · line 437

Quoted 9 lines
include/drm/drm_drv.h +6 -0
@@ -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 ?

include/drm/drm_drv.h struct drm_driver { · line 444

Quoted 7 lines
include/drm/drm_drv.h +4 -0
+	 */
+	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,

Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#9 lore raw

Hi Laurent,

Thank you for the review.

Den 02.11.2017 05.43, skrev Laurent Pinchart:

Quoted 48 lines

Hi Noralf,

Thank you for the patch.

Quoted 43 lines · 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).

---
  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(+)
drivers/gpu/drm/drm_debugfs.c +6 -0
index c1807d5754b2..550f29de6c1f 100644
@@ -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) {
(quoted diff) +0 -0

b/drivers/gpu/drm/drm_framebuffer.c index af279844d7ce..4f7873a1b922 100644

drivers/gpu/drm/drm_framebuffer.c +2 -0
@@ -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"
 
Quoted 12 lines

drivers/gpu/drm/drm_framebuffer.c int drm_framebuffer_plane_height(int height, · line 965

Quoted 11 lines
drivers/gpu/drm/drm_framebuffer.c +6 -0
  /**
@@ -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.

Quoted 149 lines

drivers/gpu/drm/drm_framebuffer.c int drm_framebuffer_plane_height(int height, · line 968

Quoted 2 lines
drivers/gpu/drm/drm_framebuffer.c +2 -0
+	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.

drivers/gpu/drm/drm_framebuffer.c int drm_framebuffer_plane_height(int height, · line 972

Quoted 4 lines
drivers/gpu/drm/drm_framebuffer.c +4 -0
+	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.

drivers/gpu/drm/drm_framebuffer.c int drm_framebuffer_plane_height(int height, · line 982

Quoted 10 lines
drivers/gpu/drm/drm_framebuffer.c +10 -0
+	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.

Quoted 6 lines
drivers/gpu/drm/drm_framebuffer.c +6 -0
+		if (fb->obj[i])
+			drm_gem_print_info(p, indent + 2, fb->obj[i]);
+	}
+}
+
+#ifdef CONFIG_DEBUG_FS

drivers/gpu/drm/drm_framebuffer.c int drm_framebuffer_plane_height(int height, · line 998

Quoted 10 lines
drivers/gpu/drm/drm_framebuffer.c +10 -0
+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.

Quoted 31 lines
drivers/gpu/drm/drm_framebuffer.c +18 -0
+		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
drivers/gpu/drm/drm_gem.c +1 -0
index 4c84b23d37cc..152bd6210dde 100644
@@ -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

drivers/gpu/drm/drm_gem.c int drm_gem_mmap(struct file *filp, struct · line 1050

Quoted 10 lines
drivers/gpu/drm/drm_gem.c +7 -0
@@ -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.

Quoted 45 lines
drivers/gpu/drm/drm_gem.c +9 -0
+	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);
+}
drivers/gpu/drm/drm_internal.h +2 -0
index fbc3f308fa19..430ce3fe4f3b 100644
@@ -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)
drivers/gpu/drm/drm_internal.h +5 -0
@@ -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);
include/drm/drm_drv.h +1 -0
index 0e90ef24214b..434de999c3ba 100644
@@ -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

include/drm/drm_drv.h struct drm_driver { · line 437

Quoted 9 lines
include/drm/drm_drv.h +6 -0
@@ -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 ?

include/drm/drm_drv.h struct drm_driver { · line 444

Quoted 7 lines
include/drm/drm_drv.h +4 -0
+	 */
+	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,

Quoted 2 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#10 lore raw

PATCH v4 5/11 drm/atomic: Use drm_framebuffer_print_info()

In reply to Noralf Trønnes

Use drm_framebuffer_print_info() to print framebuffer info in drm_atomic_plane_print_state(). This will give optional GEM info as well.

---
 drivers/gpu/drm/drm_atomic.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)
drivers/gpu/drm/drm_atomic.c +3 -15
index 6c9c4a8e09af..6d626355ba4e 100644
@@ -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);
Signature · 6 lines
2.14.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v4 5/11
#11 lore raw

Re: [PATCH v4 05/11] drm/atomic: Use drm_framebuffer_print_info()

Hi Noralf,

Thank you for the patch.

Quoted 5 lines · 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.

Quoted 41 lines
---
 drivers/gpu/drm/drm_atomic.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)
drivers/gpu/drm/drm_atomic.c +3 -15
index 6c9c4a8e09af..6d626355ba4e 100644
@@ -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);

Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#12 lore raw

PATCH v4 6/11 drm/cma-helper: Add drm_gem_cma_print_info()

In reply to Noralf Trønnes

Add drm_gem_cma_print_info() for debugfs printing
struct drm_gem_cma_object specific info.

---
 drivers/gpu/drm/drm_gem_cma_helper.c | 19 +++++++++++++++++++
 include/drm/drm_gem_cma_helper.h     |  5 ++++-
 2 files changed, 23 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_gem_cma_helper.c +19 -0
index 020e7668dfab..89dc7f04fae6 100644
@@ -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
include/drm/drm_gem_cma_helper.h +4 -1
index 58a739bf15f1..bc47e6eba271 100644
@@ -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,
Signature · 6 lines
2.14.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#13 lore raw

Re: [PATCH v4 06/11] drm/cma-helper: Add drm_gem_cma_print_info()

Hi Noralf,

Than you for the patch.

Quoted 46 lines · 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.

---
 drivers/gpu/drm/drm_gem_cma_helper.c | 19 +++++++++++++++++++
 include/drm/drm_gem_cma_helper.h     |  5 ++++-
 2 files changed, 23 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/drm_gem_cma_helper.c index 020e7668dfab..89dc7f04fae6 100644

drivers/gpu/drm/drm_gem_cma_helper.c +19 -0
@@ -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

(quoted diff) +0 -0

b/include/drm/drm_gem_cma_helper.h index 58a739bf15f1..bc47e6eba271 100644

include/drm/drm_gem_cma_helper.h struct drm_gem_cma_object { · line 24

Quoted 5 lines
include/drm/drm_gem_cma_helper.h +1 -1
@@ -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.

Quoted 14 lines
include/drm/drm_gem_cma_helper.h +0 -0
 {
 	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

include/drm/drm_gem_cma_helper.h +3 -0
+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,

Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#14 lore raw

PATCH v4 7/11 drm/arc: Use drm_gem_cma_print_info()

In reply to Noralf Trønnes

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().

---
 drivers/gpu/drm/arc/arcpgu_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/arc/arcpgu_drv.c +1 -1
index 074fd4ea7ece..f067de4e1e82 100644
@@ -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,
Signature · 6 lines
2.14.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v4 7/11
#15 lore raw

Re: [PATCH v4 07/11] drm/arc: Use drm_gem_cma_print_info()

Hi Noralf,

Quoted 9 lines · Noralf Trønnes

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().

---

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--------------------------

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#16 lore raw

Re: [PATCH v4 07/11] drm/arc: Use drm_gem_cma_print_info()

Quoted 26 lines · Alexey Brodkin

Hi Noralf,

Quoted 9 lines · Noralf Trønnes

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().

---

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--------------------------

Quoted 7 lines
# 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.

Quoted 14 lines

                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--------------------------

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v4 7/11
#17 lore raw

Re: [PATCH v4 07/11] drm/arc: Use drm_gem_cma_print_info()

In reply to Noralf Trønnes

Hi Noralf,

Thank you for the patch.

Quoted 8 lines · 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().

Quoted 25 lines
---
 drivers/gpu/drm/arc/arcpgu_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/arc/arcpgu_drv.c index 074fd4ea7ece..f067de4e1e82 100644

drivers/gpu/drm/arc/arcpgu_drv.c +0 -1
@@ -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)

drivers/gpu/drm/arc/arcpgu_drv.c +1 -0
@@ -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,
Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#18 lore raw

PATCH v4 8/11 drm/arm/hdlcd: Use drm_gem_cma_print_info()

In reply to Noralf Trønnes

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 <[email protected]>
Cc Brian Starkey <[email protected]>
---
 drivers/gpu/drm/arm/hdlcd_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/arm/hdlcd_drv.c +1 -1
index 764d0c83710c..59b21bdc0c30 100644
@@ -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,
Signature · 6 lines
2.14.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer Acked-by on v4 8/11
#19 lore raw

Re: [PATCH v4 08/11] drm/arm/hdlcd: Use drm_gem_cma_print_info()

Quoted 9 lines · Noralf Trønnes

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 <[email protected]>
Cc Brian Starkey <[email protected]>

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

Quoted 27 lines
---
 drivers/gpu/drm/arm/hdlcd_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/arm/hdlcd_drv.c +1 -1
index 764d0c83710c..59b21bdc0c30 100644
@@ -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,
Signature · 1 line
2.14.2
Signature · 12 lines
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v4 8/11
#20 lore raw

Re: [PATCH v4 08/11] drm/arm/hdlcd: Use drm_gem_cma_print_info()

In reply to Noralf Trønnes

Hi Noralf,

Thank you for the patch.

Quoted 9 lines · 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 <[email protected]>
Cc Brian Starkey <[email protected]>
Quoted 24 lines
---
 drivers/gpu/drm/arm/hdlcd_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/arm/hdlcd_drv.c index 764d0c83710c..59b21bdc0c30 100644

drivers/gpu/drm/arm/hdlcd_drv.c +1 -1
@@ -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,
Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#21 lore raw

PATCH v4 9/11 drm/tilcdc: Use drm_gem_cma_print_info()

In reply to Noralf Trønnes

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 <[email protected]>
Cc Tomi Valkeinen <[email protected]>
---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tilcdc/tilcdc_drv.c +1 -1
index 72ce063aa0d8..bc4feb3a84b9 100644
@@ -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,
 
Signature · 6 lines
2.14.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v4 9/11
#22 lore raw

Re: [PATCH v4 09/11] drm/tilcdc: Use drm_gem_cma_print_info()

Quoted 9 lines · Noralf Trønnes

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 <[email protected]>
Cc Tomi Valkeinen <[email protected]>

Thanks,
Just let me know if I should pick this to my next tilcdc pull request.

Best regards,
Jyri

Quoted 25 lines
---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tilcdc/tilcdc_drv.c +1 -1
index 72ce063aa0d8..bc4feb3a84b9 100644
@@ -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,
 
Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v4 9/11
#23 lore raw

Re: [PATCH v4 09/11] drm/tilcdc: Use drm_gem_cma_print_info()

In reply to Noralf Trønnes

Hi Noralf,

Thank you for the patch.

Quoted 9 lines · 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 <[email protected]>
Cc Tomi Valkeinen <[email protected]>
Quoted 24 lines
---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index 72ce063aa0d8..bc4feb3a84b9 100644

drivers/gpu/drm/tilcdc/tilcdc_drv.c +1 -1
@@ -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,
Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#24 lore raw

PATCH v4 10/11 drm/tinydrm: Use drm_gem_cma_print_info()

In reply to Noralf Trønnes

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().

---
 drivers/gpu/drm/tinydrm/mipi-dbi.c | 8 +-------
 include/drm/tinydrm/tinydrm.h      | 1 +
 2 files changed, 2 insertions(+), 7 deletions(-)
drivers/gpu/drm/tinydrm/mipi-dbi.c +1 -7
index d43e992ab432..347f9b226f26 100644
@@ -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);
 
include/drm/tinydrm/tinydrm.h +1 -0
index 4774fe3d4273..423828922e5a 100644
@@ -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, \
Signature · 6 lines
2.14.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v4 10/11
#25 lore raw

Re: [PATCH v4 10/11] drm/tinydrm: Use drm_gem_cma_print_info()

Hi Noralf,

Thank you for the patch.

Quoted 8 lines · 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().

Quoted 44 lines
---
 drivers/gpu/drm/tinydrm/mipi-dbi.c | 8 +-------
 include/drm/tinydrm/tinydrm.h      | 1 +
 2 files changed, 2 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/tinydrm/mipi-dbi.c index d43e992ab432..347f9b226f26 100644

drivers/gpu/drm/tinydrm/mipi-dbi.c +1 -7
@@ -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);
 
include/drm/tinydrm/tinydrm.h +1 -0
index 4774fe3d4273..423828922e5a 100644
@@ -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, \
Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#26 lore raw

PATCH v4 11/11 drm/cma-helper: Remove drm_fb_cma_debugfs_show()

In reply to Noralf Trønnes

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 <[email protected]>
---
 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(-)
drivers/gpu/drm/drm_fb_cma_helper.c +0 -37
index 0e3c14174d08..35b56dfba929 100644
@@ -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,
drivers/gpu/drm/drm_gem_cma_helper.c +0 -26
index 89dc7f04fae6..9b99f9feb432 100644
@@ -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
include/drm/drm_fb_cma_helper.h +0 -6
index 023f052a5873..a613ff022e6c 100644
@@ -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
 
include/drm/drm_gem_cma_helper.h +0 -4
index bc47e6eba271..08375115fdc0 100644
@@ -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);
 
Signature · 6 lines
2.14.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v4 11/11
#27 lore raw

Re: [PATCH v4 11/11] drm/cma-helper: Remove drm_fb_cma_debugfs_show()

Quoted 5 lines · Noralf Trønnes

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 <[email protected]>

Nice addition to the series, I totally missed this. For patches 7-11:

Quoted 126 lines
---
 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(-)
drivers/gpu/drm/drm_fb_cma_helper.c +0 -37
index 0e3c14174d08..35b56dfba929 100644
@@ -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,
drivers/gpu/drm/drm_gem_cma_helper.c +0 -26
index 89dc7f04fae6..9b99f9feb432 100644
@@ -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
include/drm/drm_fb_cma_helper.h +0 -6
index 023f052a5873..a613ff022e6c 100644
@@ -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
 
include/drm/drm_gem_cma_helper.h +0 -4
index bc47e6eba271..08375115fdc0 100644
@@ -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);
 
Signature · 1 line
2.14.2
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v4 11/11
#28 lore raw

Re: [PATCH v4 11/11] drm/cma-helper: Remove drm_fb_cma_debugfs_show()

In reply to Noralf Trønnes

Hi Noralf,

Thank you for the patch.

Quoted 5 lines · 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 <[email protected]>
Quoted 126 lines
---
 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(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/drm_fb_cma_helper.c index 0e3c14174d08..35b56dfba929 100644

drivers/gpu/drm/drm_fb_cma_helper.c +0 -37
@@ -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) {
drivers/gpu/drm/drm_fb_cma_helper.c +0 -0
 	return dma_mmap_writecombine(info->device, vma, info->screen_base,
(quoted diff) +0 -0

b/drivers/gpu/drm/drm_gem_cma_helper.c index 89dc7f04fae6..9b99f9feb432 100644

drivers/gpu/drm/drm_gem_cma_helper.c +0 -26
@@ -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
(quoted diff) +0 -0

b/include/drm/drm_fb_cma_helper.h index 023f052a5873..a613ff022e6c 100644

include/drm/drm_fb_cma_helper.h +0 -6
@@ -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
 
(quoted diff) +0 -0

b/include/drm/drm_gem_cma_helper.h index bc47e6eba271..08375115fdc0 100644

include/drm/drm_gem_cma_helper.h +0 -4
@@ -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);
Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel