2 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 * Author: Rob Clark <rob.clark@linaro.org>
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License along with
15 * this program. If not, see <http://www.gnu.org/licenses/>.
18 #include <linux/seq_file.h>
20 #include <drm/drm_crtc.h>
21 #include <drm/drm_debugfs.h>
22 #include <drm/drm_file.h>
23 #include <drm/drm_fb_helper.h>
26 #include "omap_dmm_tiler.h"
28 #ifdef CONFIG_DEBUG_FS
30 static int gem_show(struct seq_file *m, void *arg)
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;
36 seq_printf(m, "All Objects:\n");
37 mutex_lock(&priv->list_lock);
38 omap_gem_describe_objects(&priv->obj_list, m);
39 mutex_unlock(&priv->list_lock);
44 static int mm_show(struct seq_file *m, void *arg)
46 struct drm_info_node *node = (struct drm_info_node *) m->private;
47 struct drm_device *dev = node->minor->dev;
48 struct drm_printer p = drm_seq_file_printer(m);
50 drm_mm_print(&dev->vma_offset_manager->vm_addr_space_mm, &p);
55 #ifdef CONFIG_DRM_FBDEV_EMULATION
56 static int fb_show(struct seq_file *m, void *arg)
58 struct drm_info_node *node = (struct drm_info_node *) m->private;
59 struct drm_device *dev = node->minor->dev;
60 struct omap_drm_private *priv = dev->dev_private;
61 struct drm_framebuffer *fb;
63 seq_printf(m, "fbcon ");
64 omap_framebuffer_describe(priv->fbdev->fb, m);
66 mutex_lock(&dev->mode_config.fb_lock);
67 list_for_each_entry(fb, &dev->mode_config.fb_list, head) {
68 if (fb == priv->fbdev->fb)
71 seq_printf(m, "user ");
72 omap_framebuffer_describe(fb, m);
74 mutex_unlock(&dev->mode_config.fb_lock);
80 /* list of debufs files that are applicable to all devices */
81 static struct drm_info_list omap_debugfs_list[] = {
84 #ifdef CONFIG_DRM_FBDEV_EMULATION
89 /* list of debugfs files that are specific to devices with dmm/tiler */
90 static struct drm_info_list omap_dmm_debugfs_list[] = {
91 {"tiler_map", tiler_map_show, 0},
94 int omap_debugfs_init(struct drm_minor *minor)
96 struct drm_device *dev = minor->dev;
99 ret = drm_debugfs_create_files(omap_debugfs_list,
100 ARRAY_SIZE(omap_debugfs_list),
101 minor->debugfs_root, minor);
104 dev_err(dev->dev, "could not install omap_debugfs_list\n");
108 if (dmm_is_available())
109 ret = drm_debugfs_create_files(omap_dmm_debugfs_list,
110 ARRAY_SIZE(omap_dmm_debugfs_list),
111 minor->debugfs_root, minor);
114 dev_err(dev->dev, "could not install omap_dmm_debugfs_list\n");