diff options
author | Vincent Abriou <vincent.abriou@st.com> | 2016-02-04 10:35:45 -0500 |
---|---|---|
committer | Vincent Abriou <vincent.abriou@st.com> | 2016-02-26 04:06:21 -0500 |
commit | f46f3bebee8a04635119731b76c33de81fe5642c (patch) | |
tree | ecb55d286ab52a4aed82aab07a10e016fe64ff34 | |
parent | 6c84578c2c5cd5dfa2a25b52bf731dd2da5e700e (diff) |
drm/sti: add debugfs entries for CURSOR plane
Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
Reviewed-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
-rw-r--r-- | drivers/gpu/drm/sti/sti_cursor.c | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/sti_cursor.c index a4c67abc0f98..9eac1b969720 100644 --- a/drivers/gpu/drm/sti/sti_cursor.c +++ b/drivers/gpu/drm/sti/sti_cursor.c | |||
@@ -72,6 +72,82 @@ static const uint32_t cursor_supported_formats[] = { | |||
72 | 72 | ||
73 | #define to_sti_cursor(x) container_of(x, struct sti_cursor, plane) | 73 | #define to_sti_cursor(x) container_of(x, struct sti_cursor, plane) |
74 | 74 | ||
75 | #define DBGFS_DUMP(reg) seq_printf(s, "\n %-25s 0x%08X", #reg, \ | ||
76 | readl(cursor->regs + reg)) | ||
77 | |||
78 | static void cursor_dbg_vpo(struct seq_file *s, u32 val) | ||
79 | { | ||
80 | seq_printf(s, "\txdo:%4d\tydo:%4d", val & 0x0FFF, (val >> 16) & 0x0FFF); | ||
81 | } | ||
82 | |||
83 | static void cursor_dbg_size(struct seq_file *s, u32 val) | ||
84 | { | ||
85 | seq_printf(s, "\t%d x %d", val & 0x07FF, (val >> 16) & 0x07FF); | ||
86 | } | ||
87 | |||
88 | static void cursor_dbg_pml(struct seq_file *s, | ||
89 | struct sti_cursor *cursor, u32 val) | ||
90 | { | ||
91 | if (cursor->pixmap.paddr == val) | ||
92 | seq_printf(s, "\tVirt @: %p", cursor->pixmap.base); | ||
93 | } | ||
94 | |||
95 | static void cursor_dbg_cml(struct seq_file *s, | ||
96 | struct sti_cursor *cursor, u32 val) | ||
97 | { | ||
98 | if (cursor->clut_paddr == val) | ||
99 | seq_printf(s, "\tVirt @: %p", cursor->clut); | ||
100 | } | ||
101 | |||
102 | static int cursor_dbg_show(struct seq_file *s, void *data) | ||
103 | { | ||
104 | struct drm_info_node *node = s->private; | ||
105 | struct sti_cursor *cursor = (struct sti_cursor *)node->info_ent->data; | ||
106 | struct drm_device *dev = node->minor->dev; | ||
107 | int ret; | ||
108 | |||
109 | ret = mutex_lock_interruptible(&dev->struct_mutex); | ||
110 | if (ret) | ||
111 | return ret; | ||
112 | |||
113 | seq_printf(s, "%s: (vaddr = 0x%p)", | ||
114 | sti_plane_to_str(&cursor->plane), cursor->regs); | ||
115 | |||
116 | DBGFS_DUMP(CUR_CTL); | ||
117 | DBGFS_DUMP(CUR_VPO); | ||
118 | cursor_dbg_vpo(s, readl(cursor->regs + CUR_VPO)); | ||
119 | DBGFS_DUMP(CUR_PML); | ||
120 | cursor_dbg_pml(s, cursor, readl(cursor->regs + CUR_PML)); | ||
121 | DBGFS_DUMP(CUR_PMP); | ||
122 | DBGFS_DUMP(CUR_SIZE); | ||
123 | cursor_dbg_size(s, readl(cursor->regs + CUR_SIZE)); | ||
124 | DBGFS_DUMP(CUR_CML); | ||
125 | cursor_dbg_cml(s, cursor, readl(cursor->regs + CUR_CML)); | ||
126 | DBGFS_DUMP(CUR_AWS); | ||
127 | DBGFS_DUMP(CUR_AWE); | ||
128 | seq_puts(s, "\n"); | ||
129 | |||
130 | mutex_unlock(&dev->struct_mutex); | ||
131 | return 0; | ||
132 | } | ||
133 | |||
134 | static struct drm_info_list cursor_debugfs_files[] = { | ||
135 | { "cursor", cursor_dbg_show, 0, NULL }, | ||
136 | }; | ||
137 | |||
138 | static int cursor_debugfs_init(struct sti_cursor *cursor, | ||
139 | struct drm_minor *minor) | ||
140 | { | ||
141 | unsigned int i; | ||
142 | |||
143 | for (i = 0; i < ARRAY_SIZE(cursor_debugfs_files); i++) | ||
144 | cursor_debugfs_files[i].data = cursor; | ||
145 | |||
146 | return drm_debugfs_create_files(cursor_debugfs_files, | ||
147 | ARRAY_SIZE(cursor_debugfs_files), | ||
148 | minor->debugfs_root, minor); | ||
149 | } | ||
150 | |||
75 | static void sti_cursor_argb8888_to_clut8(struct sti_cursor *cursor, u32 *src) | 151 | static void sti_cursor_argb8888_to_clut8(struct sti_cursor *cursor, u32 *src) |
76 | { | 152 | { |
77 | u8 *dst = cursor->pixmap.base; | 153 | u8 *dst = cursor->pixmap.base; |
@@ -306,6 +382,9 @@ struct drm_plane *sti_cursor_create(struct drm_device *drm_dev, | |||
306 | 382 | ||
307 | sti_plane_init_property(&cursor->plane, DRM_PLANE_TYPE_CURSOR); | 383 | sti_plane_init_property(&cursor->plane, DRM_PLANE_TYPE_CURSOR); |
308 | 384 | ||
385 | if (cursor_debugfs_init(cursor, drm_dev->primary)) | ||
386 | DRM_ERROR("CURSOR debugfs setup failed\n"); | ||
387 | |||
309 | return &cursor->plane.drm_plane; | 388 | return &cursor->plane.drm_plane; |
310 | 389 | ||
311 | err_plane: | 390 | err_plane: |