Loading...
1/*
2 * drivers/gpu/drm/omapdrm/omap_debugfs.c
3 *
4 * Copyright (C) 2011 Texas Instruments
5 * Author: Rob Clark <rob.clark@linaro.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <drm/drm_crtc.h>
21#include <drm/drm_fb_helper.h>
22
23#include "omap_drv.h"
24#include "omap_dmm_tiler.h"
25
26#ifdef CONFIG_DEBUG_FS
27
28static int gem_show(struct seq_file *m, void *arg)
29{
30 struct drm_info_node *node = (struct drm_info_node *) m->private;
31 struct drm_device *dev = node->minor->dev;
32 struct omap_drm_private *priv = dev->dev_private;
33 int ret;
34
35 ret = mutex_lock_interruptible(&dev->struct_mutex);
36 if (ret)
37 return ret;
38
39 seq_printf(m, "All Objects:\n");
40 omap_gem_describe_objects(&priv->obj_list, m);
41
42 mutex_unlock(&dev->struct_mutex);
43
44 return 0;
45}
46
47static int mm_show(struct seq_file *m, void *arg)
48{
49 struct drm_info_node *node = (struct drm_info_node *) m->private;
50 struct drm_device *dev = node->minor->dev;
51 return drm_mm_dump_table(m, &dev->vma_offset_manager->vm_addr_space_mm);
52}
53
54#ifdef CONFIG_DRM_FBDEV_EMULATION
55static int fb_show(struct seq_file *m, void *arg)
56{
57 struct drm_info_node *node = (struct drm_info_node *) m->private;
58 struct drm_device *dev = node->minor->dev;
59 struct omap_drm_private *priv = dev->dev_private;
60 struct drm_framebuffer *fb;
61
62 seq_printf(m, "fbcon ");
63 omap_framebuffer_describe(priv->fbdev->fb, m);
64
65 mutex_lock(&dev->mode_config.fb_lock);
66 list_for_each_entry(fb, &dev->mode_config.fb_list, head) {
67 if (fb == priv->fbdev->fb)
68 continue;
69
70 seq_printf(m, "user ");
71 omap_framebuffer_describe(fb, m);
72 }
73 mutex_unlock(&dev->mode_config.fb_lock);
74
75 return 0;
76}
77#endif
78
79/* list of debufs files that are applicable to all devices */
80static struct drm_info_list omap_debugfs_list[] = {
81 {"gem", gem_show, 0},
82 {"mm", mm_show, 0},
83#ifdef CONFIG_DRM_FBDEV_EMULATION
84 {"fb", fb_show, 0},
85#endif
86};
87
88/* list of debugfs files that are specific to devices with dmm/tiler */
89static struct drm_info_list omap_dmm_debugfs_list[] = {
90 {"tiler_map", tiler_map_show, 0},
91};
92
93int omap_debugfs_init(struct drm_minor *minor)
94{
95 struct drm_device *dev = minor->dev;
96 int ret;
97
98 ret = drm_debugfs_create_files(omap_debugfs_list,
99 ARRAY_SIZE(omap_debugfs_list),
100 minor->debugfs_root, minor);
101
102 if (ret) {
103 dev_err(dev->dev, "could not install omap_debugfs_list\n");
104 return ret;
105 }
106
107 if (dmm_is_available())
108 ret = drm_debugfs_create_files(omap_dmm_debugfs_list,
109 ARRAY_SIZE(omap_dmm_debugfs_list),
110 minor->debugfs_root, minor);
111
112 if (ret) {
113 dev_err(dev->dev, "could not install omap_dmm_debugfs_list\n");
114 return ret;
115 }
116
117 return ret;
118}
119
120void omap_debugfs_cleanup(struct drm_minor *minor)
121{
122 drm_debugfs_remove_files(omap_debugfs_list,
123 ARRAY_SIZE(omap_debugfs_list), minor);
124 if (dmm_is_available())
125 drm_debugfs_remove_files(omap_dmm_debugfs_list,
126 ARRAY_SIZE(omap_dmm_debugfs_list), minor);
127}
128
129#endif
1/*
2 * drivers/gpu/drm/omapdrm/omap_debugfs.c
3 *
4 * Copyright (C) 2011 Texas Instruments
5 * Author: Rob Clark <rob.clark@linaro.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <linux/seq_file.h>
21
22#include <drm/drm_crtc.h>
23#include <drm/drm_fb_helper.h>
24
25#include "omap_drv.h"
26#include "omap_dmm_tiler.h"
27
28#ifdef CONFIG_DEBUG_FS
29
30static int gem_show(struct seq_file *m, void *arg)
31{
32 struct drm_info_node *node = (struct drm_info_node *) m->private;
33 struct drm_device *dev = node->minor->dev;
34 struct omap_drm_private *priv = dev->dev_private;
35 int ret;
36
37 ret = mutex_lock_interruptible(&dev->struct_mutex);
38 if (ret)
39 return ret;
40
41 seq_printf(m, "All Objects:\n");
42 omap_gem_describe_objects(&priv->obj_list, m);
43
44 mutex_unlock(&dev->struct_mutex);
45
46 return 0;
47}
48
49static int mm_show(struct seq_file *m, void *arg)
50{
51 struct drm_info_node *node = (struct drm_info_node *) m->private;
52 struct drm_device *dev = node->minor->dev;
53 return drm_mm_dump_table(m, &dev->vma_offset_manager->vm_addr_space_mm);
54}
55
56#ifdef CONFIG_DRM_FBDEV_EMULATION
57static int fb_show(struct seq_file *m, void *arg)
58{
59 struct drm_info_node *node = (struct drm_info_node *) m->private;
60 struct drm_device *dev = node->minor->dev;
61 struct omap_drm_private *priv = dev->dev_private;
62 struct drm_framebuffer *fb;
63
64 seq_printf(m, "fbcon ");
65 omap_framebuffer_describe(priv->fbdev->fb, m);
66
67 mutex_lock(&dev->mode_config.fb_lock);
68 list_for_each_entry(fb, &dev->mode_config.fb_list, head) {
69 if (fb == priv->fbdev->fb)
70 continue;
71
72 seq_printf(m, "user ");
73 omap_framebuffer_describe(fb, m);
74 }
75 mutex_unlock(&dev->mode_config.fb_lock);
76
77 return 0;
78}
79#endif
80
81/* list of debufs files that are applicable to all devices */
82static struct drm_info_list omap_debugfs_list[] = {
83 {"gem", gem_show, 0},
84 {"mm", mm_show, 0},
85#ifdef CONFIG_DRM_FBDEV_EMULATION
86 {"fb", fb_show, 0},
87#endif
88};
89
90/* list of debugfs files that are specific to devices with dmm/tiler */
91static struct drm_info_list omap_dmm_debugfs_list[] = {
92 {"tiler_map", tiler_map_show, 0},
93};
94
95int omap_debugfs_init(struct drm_minor *minor)
96{
97 struct drm_device *dev = minor->dev;
98 int ret;
99
100 ret = drm_debugfs_create_files(omap_debugfs_list,
101 ARRAY_SIZE(omap_debugfs_list),
102 minor->debugfs_root, minor);
103
104 if (ret) {
105 dev_err(dev->dev, "could not install omap_debugfs_list\n");
106 return ret;
107 }
108
109 if (dmm_is_available())
110 ret = drm_debugfs_create_files(omap_dmm_debugfs_list,
111 ARRAY_SIZE(omap_dmm_debugfs_list),
112 minor->debugfs_root, minor);
113
114 if (ret) {
115 dev_err(dev->dev, "could not install omap_dmm_debugfs_list\n");
116 return ret;
117 }
118
119 return ret;
120}
121
122void omap_debugfs_cleanup(struct drm_minor *minor)
123{
124 drm_debugfs_remove_files(omap_debugfs_list,
125 ARRAY_SIZE(omap_debugfs_list), minor);
126 if (dmm_is_available())
127 drm_debugfs_remove_files(omap_dmm_debugfs_list,
128 ARRAY_SIZE(omap_dmm_debugfs_list), minor);
129}
130
131#endif