Andy Gross | 6169a148 | 2011-12-15 21:05:17 -0600 | [diff] [blame] | 1 | /* |
Andrew F. Davis | bb5cdf8 | 2017-12-05 14:29:31 -0600 | [diff] [blame] | 2 | * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ |
Andy Gross | 6169a148 | 2011-12-15 21:05:17 -0600 | [diff] [blame] | 3 | * Author: Rob Clark <rob.clark@linaro.org> |
| 4 | * |
| 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. |
| 8 | * |
| 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 |
| 12 | * more details. |
| 13 | * |
| 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/>. |
| 16 | */ |
| 17 | |
Arnd Bergmann | 2d80245 | 2016-05-11 18:01:45 +0200 | [diff] [blame] | 18 | #include <linux/seq_file.h> |
| 19 | |
Laurent Pinchart | 2d278f5 | 2015-03-05 21:31:37 +0200 | [diff] [blame] | 20 | #include <drm/drm_crtc.h> |
| 21 | #include <drm/drm_fb_helper.h> |
| 22 | |
Andy Gross | 6169a148 | 2011-12-15 21:05:17 -0600 | [diff] [blame] | 23 | #include "omap_drv.h" |
| 24 | #include "omap_dmm_tiler.h" |
| 25 | |
| 26 | #ifdef CONFIG_DEBUG_FS |
| 27 | |
Rob Clark | f6b6036 | 2012-03-05 10:48:36 -0600 | [diff] [blame] | 28 | static 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; |
Rob Clark | f6b6036 | 2012-03-05 10:48:36 -0600 | [diff] [blame] | 33 | |
| 34 | seq_printf(m, "All Objects:\n"); |
Daniel Vetter | 5117bd8 | 2018-05-25 19:39:24 +0300 | [diff] [blame] | 35 | mutex_lock(&priv->list_lock); |
Rob Clark | f6b6036 | 2012-03-05 10:48:36 -0600 | [diff] [blame] | 36 | omap_gem_describe_objects(&priv->obj_list, m); |
Daniel Vetter | 5117bd8 | 2018-05-25 19:39:24 +0300 | [diff] [blame] | 37 | mutex_unlock(&priv->list_lock); |
Rob Clark | f6b6036 | 2012-03-05 10:48:36 -0600 | [diff] [blame] | 38 | |
Rob Clark | f6b6036 | 2012-03-05 10:48:36 -0600 | [diff] [blame] | 39 | return 0; |
| 40 | } |
| 41 | |
| 42 | static int mm_show(struct seq_file *m, void *arg) |
| 43 | { |
| 44 | struct drm_info_node *node = (struct drm_info_node *) m->private; |
| 45 | struct drm_device *dev = node->minor->dev; |
Daniel Vetter | b5c3714 | 2016-12-29 12:09:24 +0100 | [diff] [blame] | 46 | struct drm_printer p = drm_seq_file_printer(m); |
| 47 | |
| 48 | drm_mm_print(&dev->vma_offset_manager->vm_addr_space_mm, &p); |
| 49 | |
| 50 | return 0; |
Rob Clark | f6b6036 | 2012-03-05 10:48:36 -0600 | [diff] [blame] | 51 | } |
| 52 | |
Laurent Pinchart | e1c1174 | 2015-12-14 22:39:30 +0200 | [diff] [blame] | 53 | #ifdef CONFIG_DRM_FBDEV_EMULATION |
Rob Clark | f6b6036 | 2012-03-05 10:48:36 -0600 | [diff] [blame] | 54 | static int fb_show(struct seq_file *m, void *arg) |
| 55 | { |
| 56 | struct drm_info_node *node = (struct drm_info_node *) m->private; |
| 57 | struct drm_device *dev = node->minor->dev; |
| 58 | struct omap_drm_private *priv = dev->dev_private; |
| 59 | struct drm_framebuffer *fb; |
Rob Clark | f6b6036 | 2012-03-05 10:48:36 -0600 | [diff] [blame] | 60 | |
| 61 | seq_printf(m, "fbcon "); |
| 62 | omap_framebuffer_describe(priv->fbdev->fb, m); |
| 63 | |
Daniel Vetter | 4b096ac | 2012-12-10 21:19:18 +0100 | [diff] [blame] | 64 | mutex_lock(&dev->mode_config.fb_lock); |
Rob Clark | f6b6036 | 2012-03-05 10:48:36 -0600 | [diff] [blame] | 65 | list_for_each_entry(fb, &dev->mode_config.fb_list, head) { |
| 66 | if (fb == priv->fbdev->fb) |
| 67 | continue; |
| 68 | |
| 69 | seq_printf(m, "user "); |
| 70 | omap_framebuffer_describe(fb, m); |
| 71 | } |
Daniel Vetter | 4b096ac | 2012-12-10 21:19:18 +0100 | [diff] [blame] | 72 | mutex_unlock(&dev->mode_config.fb_lock); |
Rob Clark | f6b6036 | 2012-03-05 10:48:36 -0600 | [diff] [blame] | 73 | |
Rob Clark | f6b6036 | 2012-03-05 10:48:36 -0600 | [diff] [blame] | 74 | return 0; |
| 75 | } |
Laurent Pinchart | e1c1174 | 2015-12-14 22:39:30 +0200 | [diff] [blame] | 76 | #endif |
Rob Clark | f6b6036 | 2012-03-05 10:48:36 -0600 | [diff] [blame] | 77 | |
| 78 | /* list of debufs files that are applicable to all devices */ |
Andy Gross | 6169a148 | 2011-12-15 21:05:17 -0600 | [diff] [blame] | 79 | static struct drm_info_list omap_debugfs_list[] = { |
Rob Clark | f6b6036 | 2012-03-05 10:48:36 -0600 | [diff] [blame] | 80 | {"gem", gem_show, 0}, |
| 81 | {"mm", mm_show, 0}, |
Laurent Pinchart | e1c1174 | 2015-12-14 22:39:30 +0200 | [diff] [blame] | 82 | #ifdef CONFIG_DRM_FBDEV_EMULATION |
Rob Clark | f6b6036 | 2012-03-05 10:48:36 -0600 | [diff] [blame] | 83 | {"fb", fb_show, 0}, |
Laurent Pinchart | e1c1174 | 2015-12-14 22:39:30 +0200 | [diff] [blame] | 84 | #endif |
Rob Clark | f6b6036 | 2012-03-05 10:48:36 -0600 | [diff] [blame] | 85 | }; |
| 86 | |
| 87 | /* list of debugfs files that are specific to devices with dmm/tiler */ |
| 88 | static struct drm_info_list omap_dmm_debugfs_list[] = { |
Andy Gross | 6169a148 | 2011-12-15 21:05:17 -0600 | [diff] [blame] | 89 | {"tiler_map", tiler_map_show, 0}, |
| 90 | }; |
| 91 | |
| 92 | int omap_debugfs_init(struct drm_minor *minor) |
| 93 | { |
Rob Clark | f6b6036 | 2012-03-05 10:48:36 -0600 | [diff] [blame] | 94 | struct drm_device *dev = minor->dev; |
| 95 | int ret; |
| 96 | |
| 97 | ret = drm_debugfs_create_files(omap_debugfs_list, |
Andy Gross | 6169a148 | 2011-12-15 21:05:17 -0600 | [diff] [blame] | 98 | ARRAY_SIZE(omap_debugfs_list), |
| 99 | minor->debugfs_root, minor); |
Rob Clark | f6b6036 | 2012-03-05 10:48:36 -0600 | [diff] [blame] | 100 | |
| 101 | if (ret) { |
| 102 | dev_err(dev->dev, "could not install omap_debugfs_list\n"); |
| 103 | return ret; |
| 104 | } |
| 105 | |
Andy Gross | 132390c | 2012-03-05 10:48:37 -0600 | [diff] [blame] | 106 | if (dmm_is_available()) |
| 107 | ret = drm_debugfs_create_files(omap_dmm_debugfs_list, |
| 108 | ARRAY_SIZE(omap_dmm_debugfs_list), |
| 109 | minor->debugfs_root, minor); |
Rob Clark | f6b6036 | 2012-03-05 10:48:36 -0600 | [diff] [blame] | 110 | |
| 111 | if (ret) { |
| 112 | dev_err(dev->dev, "could not install omap_dmm_debugfs_list\n"); |
| 113 | return ret; |
| 114 | } |
| 115 | |
| 116 | return ret; |
Andy Gross | 6169a148 | 2011-12-15 21:05:17 -0600 | [diff] [blame] | 117 | } |
| 118 | |
Andy Gross | 6169a148 | 2011-12-15 21:05:17 -0600 | [diff] [blame] | 119 | #endif |