This source file includes following definitions.
- qxl_debugfs_irq_received
- qxl_debugfs_buffers_info
- qxl_debugfs_init
- qxl_debugfs_add_files
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 #include <drm/drm_debugfs.h>
32 #include <drm/drm_file.h>
33
34 #include "qxl_drv.h"
35 #include "qxl_object.h"
36
37 #if defined(CONFIG_DEBUG_FS)
38 static int
39 qxl_debugfs_irq_received(struct seq_file *m, void *data)
40 {
41 struct drm_info_node *node = (struct drm_info_node *) m->private;
42 struct qxl_device *qdev = node->minor->dev->dev_private;
43
44 seq_printf(m, "%d\n", atomic_read(&qdev->irq_received));
45 seq_printf(m, "%d\n", atomic_read(&qdev->irq_received_display));
46 seq_printf(m, "%d\n", atomic_read(&qdev->irq_received_cursor));
47 seq_printf(m, "%d\n", atomic_read(&qdev->irq_received_io_cmd));
48 seq_printf(m, "%d\n", qdev->irq_received_error);
49 return 0;
50 }
51
52 static int
53 qxl_debugfs_buffers_info(struct seq_file *m, void *data)
54 {
55 struct drm_info_node *node = (struct drm_info_node *) m->private;
56 struct qxl_device *qdev = node->minor->dev->dev_private;
57 struct qxl_bo *bo;
58
59 list_for_each_entry(bo, &qdev->gem.objects, list) {
60 struct dma_resv_list *fobj;
61 int rel;
62
63 rcu_read_lock();
64 fobj = rcu_dereference(bo->tbo.base.resv->fence);
65 rel = fobj ? fobj->shared_count : 0;
66 rcu_read_unlock();
67
68 seq_printf(m, "size %ld, pc %d, num releases %d\n",
69 (unsigned long)bo->tbo.base.size,
70 bo->pin_count, rel);
71 }
72 return 0;
73 }
74
75 static struct drm_info_list qxl_debugfs_list[] = {
76 { "irq_received", qxl_debugfs_irq_received, 0, NULL },
77 { "qxl_buffers", qxl_debugfs_buffers_info, 0, NULL },
78 };
79 #define QXL_DEBUGFS_ENTRIES ARRAY_SIZE(qxl_debugfs_list)
80 #endif
81
82 int
83 qxl_debugfs_init(struct drm_minor *minor)
84 {
85 #if defined(CONFIG_DEBUG_FS)
86 int r;
87 struct qxl_device *dev =
88 (struct qxl_device *) minor->dev->dev_private;
89
90 drm_debugfs_create_files(qxl_debugfs_list, QXL_DEBUGFS_ENTRIES,
91 minor->debugfs_root, minor);
92
93 r = qxl_ttm_debugfs_init(dev);
94 if (r) {
95 DRM_ERROR("Failed to init TTM debugfs\n");
96 return r;
97 }
98 #endif
99 return 0;
100 }
101
102 int qxl_debugfs_add_files(struct qxl_device *qdev,
103 struct drm_info_list *files,
104 unsigned int nfiles)
105 {
106 unsigned int i;
107
108 for (i = 0; i < qdev->debugfs_count; i++) {
109 if (qdev->debugfs[i].files == files) {
110
111 return 0;
112 }
113 }
114
115 i = qdev->debugfs_count + 1;
116 if (i > QXL_DEBUGFS_MAX_COMPONENTS) {
117 DRM_ERROR("Reached maximum number of debugfs components.\n");
118 DRM_ERROR("Report so we increase QXL_DEBUGFS_MAX_COMPONENTS.\n");
119 return -EINVAL;
120 }
121 qdev->debugfs[qdev->debugfs_count].files = files;
122 qdev->debugfs[qdev->debugfs_count].num_files = nfiles;
123 qdev->debugfs_count = i;
124 #if defined(CONFIG_DEBUG_FS)
125 drm_debugfs_create_files(files, nfiles,
126 qdev->ddev.primary->debugfs_root,
127 qdev->ddev.primary);
128 #endif
129 return 0;
130 }