File Index
Files and directories
Sign in
FILE

omap_debugfs.c

File preview with syntax highlighting.

linux-6.19.14/drivers/gpu/drm/omapdrm/omap_debugfs.c C
 1// SPDX-License-Identifier: GPL-2.0-only
 2/*
 3 * Copyright (C) 2011 Texas Instruments Incorporated - https://www.ti.com/
 4 * Author: Rob Clark <rob.clark@linaro.org>
 5 */
 6
 7#include <linux/seq_file.h>
 8
 9#include <drm/drm_crtc.h>
10#include <drm/drm_debugfs.h>
11#include <drm/drm_file.h>
12#include <drm/drm_fb_helper.h>
13#include <drm/drm_framebuffer.h>
14#include <drm/drm_print.h>
15
16#include "omap_drv.h"
17#include "omap_dmm_tiler.h"
18
19#ifdef CONFIG_DEBUG_FS
20
21static int gem_show(struct seq_file *m, void *arg)
22{
23	struct drm_info_node *node = (struct drm_info_node *) m->private;
24	struct drm_device *dev = node->minor->dev;
25	struct omap_drm_private *priv = dev->dev_private;
26
27	seq_printf(m, "All Objects:\n");
28	mutex_lock(&priv->list_lock);
29	omap_gem_describe_objects(&priv->obj_list, m);
30	mutex_unlock(&priv->list_lock);
31
32	return 0;
33}
34
35static int mm_show(struct seq_file *m, void *arg)
36{
37	struct drm_info_node *node = (struct drm_info_node *) m->private;
38	struct drm_device *dev = node->minor->dev;
39	struct drm_printer p = drm_seq_file_printer(m);
40
41	drm_mm_print(&dev->vma_offset_manager->vm_addr_space_mm, &p);
42
43	return 0;
44}
45
46#ifdef CONFIG_DRM_FBDEV_EMULATION
47static int fb_show(struct seq_file *m, void *arg)
48{
49	struct drm_info_node *node = (struct drm_info_node *) m->private;
50	struct drm_device *dev = node->minor->dev;
51	struct drm_fb_helper *helper = dev->fb_helper;
52	struct drm_framebuffer *fb;
53
54	seq_printf(m, "fbcon ");
55	omap_framebuffer_describe(helper->fb, m);
56
57	mutex_lock(&dev->mode_config.fb_lock);
58	list_for_each_entry(fb, &dev->mode_config.fb_list, head) {
59		if (fb == helper->fb)
60			continue;
61
62		seq_printf(m, "user ");
63		omap_framebuffer_describe(fb, m);
64	}
65	mutex_unlock(&dev->mode_config.fb_lock);
66
67	return 0;
68}
69#endif
70
71/* list of debufs files that are applicable to all devices */
72static struct drm_info_list omap_debugfs_list[] = {
73	{"gem", gem_show, 0},
74	{"mm", mm_show, 0},
75#ifdef CONFIG_DRM_FBDEV_EMULATION
76	{"fb", fb_show, 0},
77#endif
78};
79
80/* list of debugfs files that are specific to devices with dmm/tiler */
81static struct drm_info_list omap_dmm_debugfs_list[] = {
82	{"tiler_map", tiler_map_show, 0},
83};
84
85void omap_debugfs_init(struct drm_minor *minor)
86{
87	drm_debugfs_create_files(omap_debugfs_list,
88				 ARRAY_SIZE(omap_debugfs_list),
89				 minor->debugfs_root, minor);
90
91	if (dmm_is_available())
92		drm_debugfs_create_files(omap_dmm_debugfs_list,
93					 ARRAY_SIZE(omap_dmm_debugfs_list),
94					 minor->debugfs_root, minor);
95}
96
97#endif
~/ Read-only file preview.