Linux Audio

Check our new training course

Loading...
v6.13.7
 1// SPDX-License-Identifier: GPL-2.0-only
 2/*
 3 * Copyright (C) 2011 Texas Instruments Incorporated - https://www.ti.com/
 4 * Author: Rob Clark <rob.clark@linaro.org>
 5 */
 6
 7#include <linux/seq_file.h>
 8
 9#include <drm/drm_crtc.h>
10#include <drm/drm_debugfs.h>
11#include <drm/drm_file.h>
12#include <drm/drm_fb_helper.h>
13#include <drm/drm_framebuffer.h>
14
15#include "omap_drv.h"
16#include "omap_dmm_tiler.h"
17
18#ifdef CONFIG_DEBUG_FS
19
20static int gem_show(struct seq_file *m, void *arg)
21{
22	struct drm_info_node *node = (struct drm_info_node *) m->private;
23	struct drm_device *dev = node->minor->dev;
24	struct omap_drm_private *priv = dev->dev_private;
25
26	seq_printf(m, "All Objects:\n");
27	mutex_lock(&priv->list_lock);
28	omap_gem_describe_objects(&priv->obj_list, m);
29	mutex_unlock(&priv->list_lock);
30
31	return 0;
32}
33
34static int mm_show(struct seq_file *m, void *arg)
35{
36	struct drm_info_node *node = (struct drm_info_node *) m->private;
37	struct drm_device *dev = node->minor->dev;
38	struct drm_printer p = drm_seq_file_printer(m);
39
40	drm_mm_print(&dev->vma_offset_manager->vm_addr_space_mm, &p);
41
42	return 0;
43}
44
45#ifdef CONFIG_DRM_FBDEV_EMULATION
46static int fb_show(struct seq_file *m, void *arg)
47{
48	struct drm_info_node *node = (struct drm_info_node *) m->private;
49	struct drm_device *dev = node->minor->dev;
50	struct drm_fb_helper *helper = dev->fb_helper;
51	struct drm_framebuffer *fb;
52
53	seq_printf(m, "fbcon ");
54	omap_framebuffer_describe(helper->fb, m);
55
56	mutex_lock(&dev->mode_config.fb_lock);
57	list_for_each_entry(fb, &dev->mode_config.fb_list, head) {
58		if (fb == helper->fb)
59			continue;
60
61		seq_printf(m, "user ");
62		omap_framebuffer_describe(fb, m);
63	}
64	mutex_unlock(&dev->mode_config.fb_lock);
65
66	return 0;
67}
68#endif
69
70/* list of debufs files that are applicable to all devices */
71static struct drm_info_list omap_debugfs_list[] = {
72	{"gem", gem_show, 0},
73	{"mm", mm_show, 0},
74#ifdef CONFIG_DRM_FBDEV_EMULATION
75	{"fb", fb_show, 0},
76#endif
77};
78
79/* list of debugfs files that are specific to devices with dmm/tiler */
80static struct drm_info_list omap_dmm_debugfs_list[] = {
81	{"tiler_map", tiler_map_show, 0},
82};
83
84void omap_debugfs_init(struct drm_minor *minor)
85{
86	drm_debugfs_create_files(omap_debugfs_list,
87				 ARRAY_SIZE(omap_debugfs_list),
88				 minor->debugfs_root, minor);
89
90	if (dmm_is_available())
91		drm_debugfs_create_files(omap_dmm_debugfs_list,
92					 ARRAY_SIZE(omap_dmm_debugfs_list),
93					 minor->debugfs_root, minor);
94}
95
96#endif
v5.9
 1// SPDX-License-Identifier: GPL-2.0-only
 2/*
 3 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
 4 * Author: Rob Clark <rob.clark@linaro.org>
 5 */
 6
 7#include <linux/seq_file.h>
 8
 9#include <drm/drm_crtc.h>
10#include <drm/drm_debugfs.h>
11#include <drm/drm_file.h>
12#include <drm/drm_fb_helper.h>
 
13
14#include "omap_drv.h"
15#include "omap_dmm_tiler.h"
16
17#ifdef CONFIG_DEBUG_FS
18
19static int gem_show(struct seq_file *m, void *arg)
20{
21	struct drm_info_node *node = (struct drm_info_node *) m->private;
22	struct drm_device *dev = node->minor->dev;
23	struct omap_drm_private *priv = dev->dev_private;
24
25	seq_printf(m, "All Objects:\n");
26	mutex_lock(&priv->list_lock);
27	omap_gem_describe_objects(&priv->obj_list, m);
28	mutex_unlock(&priv->list_lock);
29
30	return 0;
31}
32
33static int mm_show(struct seq_file *m, void *arg)
34{
35	struct drm_info_node *node = (struct drm_info_node *) m->private;
36	struct drm_device *dev = node->minor->dev;
37	struct drm_printer p = drm_seq_file_printer(m);
38
39	drm_mm_print(&dev->vma_offset_manager->vm_addr_space_mm, &p);
40
41	return 0;
42}
43
44#ifdef CONFIG_DRM_FBDEV_EMULATION
45static int fb_show(struct seq_file *m, void *arg)
46{
47	struct drm_info_node *node = (struct drm_info_node *) m->private;
48	struct drm_device *dev = node->minor->dev;
49	struct omap_drm_private *priv = dev->dev_private;
50	struct drm_framebuffer *fb;
51
52	seq_printf(m, "fbcon ");
53	omap_framebuffer_describe(priv->fbdev->fb, m);
54
55	mutex_lock(&dev->mode_config.fb_lock);
56	list_for_each_entry(fb, &dev->mode_config.fb_list, head) {
57		if (fb == priv->fbdev->fb)
58			continue;
59
60		seq_printf(m, "user ");
61		omap_framebuffer_describe(fb, m);
62	}
63	mutex_unlock(&dev->mode_config.fb_lock);
64
65	return 0;
66}
67#endif
68
69/* list of debufs files that are applicable to all devices */
70static struct drm_info_list omap_debugfs_list[] = {
71	{"gem", gem_show, 0},
72	{"mm", mm_show, 0},
73#ifdef CONFIG_DRM_FBDEV_EMULATION
74	{"fb", fb_show, 0},
75#endif
76};
77
78/* list of debugfs files that are specific to devices with dmm/tiler */
79static struct drm_info_list omap_dmm_debugfs_list[] = {
80	{"tiler_map", tiler_map_show, 0},
81};
82
83void omap_debugfs_init(struct drm_minor *minor)
84{
85	drm_debugfs_create_files(omap_debugfs_list,
86				 ARRAY_SIZE(omap_debugfs_list),
87				 minor->debugfs_root, minor);
88
89	if (dmm_is_available())
90		drm_debugfs_create_files(omap_dmm_debugfs_list,
91					 ARRAY_SIZE(omap_dmm_debugfs_list),
92					 minor->debugfs_root, minor);
93}
94
95#endif