omap_debugfs.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
  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. #include <linux/seq_file.h>
  18. #include <drm/drm_crtc.h>
  19. #include <drm/drm_fb_helper.h>
  20. #include "omap_drv.h"
  21. #include "omap_dmm_tiler.h"
  22. #ifdef CONFIG_DEBUG_FS
  23. static int gem_show(struct seq_file *m, void *arg)
  24. {
  25. struct drm_info_node *node = (struct drm_info_node *) m->private;
  26. struct drm_device *dev = node->minor->dev;
  27. struct omap_drm_private *priv = dev->dev_private;
  28. seq_printf(m, "All Objects:\n");
  29. mutex_lock(&priv->list_lock);
  30. omap_gem_describe_objects(&priv->obj_list, m);
  31. mutex_unlock(&priv->list_lock);
  32. return 0;
  33. }
  34. static int mm_show(struct seq_file *m, void *arg)
  35. {
  36. struct drm_info_node *node = (struct drm_info_node *) m->private;
  37. struct drm_device *dev = node->minor->dev;
  38. struct drm_printer p = drm_seq_file_printer(m);
  39. drm_mm_print(&dev->vma_offset_manager->vm_addr_space_mm, &p);
  40. return 0;
  41. }
  42. #ifdef CONFIG_DRM_FBDEV_EMULATION
  43. static int fb_show(struct seq_file *m, void *arg)
  44. {
  45. struct drm_info_node *node = (struct drm_info_node *) m->private;
  46. struct drm_device *dev = node->minor->dev;
  47. struct omap_drm_private *priv = dev->dev_private;
  48. struct drm_framebuffer *fb;
  49. seq_printf(m, "fbcon ");
  50. omap_framebuffer_describe(priv->fbdev->fb, m);
  51. mutex_lock(&dev->mode_config.fb_lock);
  52. list_for_each_entry(fb, &dev->mode_config.fb_list, head) {
  53. if (fb == priv->fbdev->fb)
  54. continue;
  55. seq_printf(m, "user ");
  56. omap_framebuffer_describe(fb, m);
  57. }
  58. mutex_unlock(&dev->mode_config.fb_lock);
  59. return 0;
  60. }
  61. #endif
  62. /* list of debufs files that are applicable to all devices */
  63. static struct drm_info_list omap_debugfs_list[] = {
  64. {"gem", gem_show, 0},
  65. {"mm", mm_show, 0},
  66. #ifdef CONFIG_DRM_FBDEV_EMULATION
  67. {"fb", fb_show, 0},
  68. #endif
  69. };
  70. /* list of debugfs files that are specific to devices with dmm/tiler */
  71. static struct drm_info_list omap_dmm_debugfs_list[] = {
  72. {"tiler_map", tiler_map_show, 0},
  73. };
  74. int omap_debugfs_init(struct drm_minor *minor)
  75. {
  76. struct drm_device *dev = minor->dev;
  77. int ret;
  78. ret = drm_debugfs_create_files(omap_debugfs_list,
  79. ARRAY_SIZE(omap_debugfs_list),
  80. minor->debugfs_root, minor);
  81. if (ret) {
  82. dev_err(dev->dev, "could not install omap_debugfs_list\n");
  83. return ret;
  84. }
  85. if (dmm_is_available())
  86. ret = drm_debugfs_create_files(omap_dmm_debugfs_list,
  87. ARRAY_SIZE(omap_dmm_debugfs_list),
  88. minor->debugfs_root, minor);
  89. if (ret) {
  90. dev_err(dev->dev, "could not install omap_dmm_debugfs_list\n");
  91. return ret;
  92. }
  93. return ret;
  94. }
  95. #endif