c21fcc8ace9c9000f4feaa925e7690c2756ca121
[openwrt/staging/neocturne.git] /
1 From d2391d8e17532da2e4edf69672504cad2ab4bca1 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Tue, 6 Oct 2020 18:44:42 +0100
4 Subject: [PATCH] drm/vc4: Add debugfs node that dumps the current
5 display lists
6
7 This allows easy analysis of display lists when debugging.
8
9 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
10 ---
11 drivers/gpu/drm/vc4/vc4_hvs.c | 41 +++++++++++++++++++++++++++++++++++
12 1 file changed, 41 insertions(+)
13
14 --- a/drivers/gpu/drm/vc4/vc4_hvs.c
15 +++ b/drivers/gpu/drm/vc4/vc4_hvs.c
16 @@ -95,6 +95,45 @@ static int vc4_hvs_debugfs_underrun(stru
17 return 0;
18 }
19
20 +static int vc4_hvs_debugfs_dlist(struct seq_file *m, void *data)
21 +{
22 + struct drm_info_node *node = m->private;
23 + struct drm_device *dev = node->minor->dev;
24 + struct vc4_dev *vc4 = to_vc4_dev(dev);
25 + struct drm_printer p = drm_seq_file_printer(m);
26 + unsigned int next_entry_start = 0;
27 + unsigned int i, j;
28 + u32 dlist_word, dispstat;
29 +
30 + for (i = 0; i < SCALER_CHANNELS_COUNT; i++) {
31 + dispstat = VC4_GET_FIELD(HVS_READ(SCALER_DISPSTATX(i)),
32 + SCALER_DISPSTATX_MODE);
33 + if (dispstat == SCALER_DISPSTATX_MODE_DISABLED ||
34 + dispstat == SCALER_DISPSTATX_MODE_EOF) {
35 + drm_printf(&p, "HVS chan %u disabled\n", i);
36 + continue;
37 + }
38 +
39 + drm_printf(&p, "HVS chan %u:\n", i);
40 +
41 + for (j = HVS_READ(SCALER_DISPLISTX(i)); j < 256; j++) {
42 + dlist_word = readl((u32 __iomem *)vc4->hvs->dlist + j);
43 + drm_printf(&p, "dlist: %02d: 0x%08x\n", j,
44 + dlist_word);
45 + if (!next_entry_start ||
46 + next_entry_start == j) {
47 + if (dlist_word & SCALER_CTL0_END)
48 + break;
49 + next_entry_start = j +
50 + VC4_GET_FIELD(dlist_word,
51 + SCALER_CTL0_SIZE);
52 + }
53 + }
54 + }
55 +
56 + return 0;
57 +}
58 +
59 /* The filter kernel is composed of dwords each containing 3 9-bit
60 * signed integers packed next to each other.
61 */
62 @@ -689,6 +728,8 @@ static int vc4_hvs_bind(struct device *d
63 vc4_debugfs_add_regset32(drm, "hvs_regs", &hvs->regset);
64 vc4_debugfs_add_file(drm, "hvs_underrun", vc4_hvs_debugfs_underrun,
65 NULL);
66 + vc4_debugfs_add_file(drm, "hvs_dlists", vc4_hvs_debugfs_dlist,
67 + NULL);
68
69 return 0;
70 }