2 * drivers/gpu/drm/omapdrm/omap_debugfs.c
4 * Copyright (C) 2011 Texas Instruments
5 * Author: Rob Clark <rob.clark@linaro.org>
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.
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
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/>.
20 #include <linux/seq_file.h>
22 #include <drm/drm_crtc.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
;
37 ret
= mutex_lock_interruptible(&dev
->struct_mutex
);
41 seq_printf(m
, "All Objects:\n");
42 omap_gem_describe_objects(&priv
->obj_list
, m
);
44 mutex_unlock(&dev
->struct_mutex
);
49 static int mm_show(struct seq_file
*m
, void *arg
)
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
);
56 #ifdef CONFIG_DRM_FBDEV_EMULATION
57 static int fb_show(struct seq_file
*m
, void *arg
)
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
;
64 seq_printf(m
, "fbcon ");
65 omap_framebuffer_describe(priv
->fbdev
->fb
, m
);
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
)
72 seq_printf(m
, "user ");
73 omap_framebuffer_describe(fb
, m
);
75 mutex_unlock(&dev
->mode_config
.fb_lock
);
81 /* list of debufs files that are applicable to all devices */
82 static struct drm_info_list omap_debugfs_list
[] = {
85 #ifdef CONFIG_DRM_FBDEV_EMULATION
90 /* list of debugfs files that are specific to devices with dmm/tiler */
91 static struct drm_info_list omap_dmm_debugfs_list
[] = {
92 {"tiler_map", tiler_map_show
, 0},
95 int omap_debugfs_init(struct drm_minor
*minor
)
97 struct drm_device
*dev
= minor
->dev
;
100 ret
= drm_debugfs_create_files(omap_debugfs_list
,
101 ARRAY_SIZE(omap_debugfs_list
),
102 minor
->debugfs_root
, minor
);
105 dev_err(dev
->dev
, "could not install omap_debugfs_list\n");
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
);
115 dev_err(dev
->dev
, "could not install omap_dmm_debugfs_list\n");
122 void omap_debugfs_cleanup(struct drm_minor
*minor
)
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
);