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_fb_helper.h>
24 #include "omap_dmm_tiler.h"
26 #ifdef CONFIG_DEBUG_FS
28 static int gem_show(struct seq_file
*m
, void *arg
)
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
;
35 ret
= mutex_lock_interruptible(&dev
->struct_mutex
);
39 seq_printf(m
, "All Objects:\n");
40 omap_gem_describe_objects(&priv
->obj_list
, m
);
42 mutex_unlock(&dev
->struct_mutex
);
47 static int mm_show(struct seq_file
*m
, void *arg
)
49 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
50 struct drm_device
*dev
= node
->minor
->dev
;
51 struct drm_printer p
= drm_seq_file_printer(m
);
53 drm_mm_print(&dev
->vma_offset_manager
->vm_addr_space_mm
, &p
);
58 #ifdef CONFIG_DRM_FBDEV_EMULATION
59 static int fb_show(struct seq_file
*m
, void *arg
)
61 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
62 struct drm_device
*dev
= node
->minor
->dev
;
63 struct omap_drm_private
*priv
= dev
->dev_private
;
64 struct drm_framebuffer
*fb
;
66 seq_printf(m
, "fbcon ");
67 omap_framebuffer_describe(priv
->fbdev
->fb
, m
);
69 mutex_lock(&dev
->mode_config
.fb_lock
);
70 list_for_each_entry(fb
, &dev
->mode_config
.fb_list
, head
) {
71 if (fb
== priv
->fbdev
->fb
)
74 seq_printf(m
, "user ");
75 omap_framebuffer_describe(fb
, m
);
77 mutex_unlock(&dev
->mode_config
.fb_lock
);
83 /* list of debufs files that are applicable to all devices */
84 static struct drm_info_list omap_debugfs_list
[] = {
87 #ifdef CONFIG_DRM_FBDEV_EMULATION
92 /* list of debugfs files that are specific to devices with dmm/tiler */
93 static struct drm_info_list omap_dmm_debugfs_list
[] = {
94 {"tiler_map", tiler_map_show
, 0},
97 int omap_debugfs_init(struct drm_minor
*minor
)
99 struct drm_device
*dev
= minor
->dev
;
102 ret
= drm_debugfs_create_files(omap_debugfs_list
,
103 ARRAY_SIZE(omap_debugfs_list
),
104 minor
->debugfs_root
, minor
);
107 dev_err(dev
->dev
, "could not install omap_debugfs_list\n");
111 if (dmm_is_available())
112 ret
= drm_debugfs_create_files(omap_dmm_debugfs_list
,
113 ARRAY_SIZE(omap_dmm_debugfs_list
),
114 minor
->debugfs_root
, minor
);
117 dev_err(dev
->dev
, "could not install omap_dmm_debugfs_list\n");