bcm27xx: update 6.1 patches to latest version
[openwrt/staging/svanheule.git] / target / linux / bcm27xx / patches-6.1 / 950-1070-drm-vc4-Add-hvs_dlist_allocs-debugfs-function.patch
1 From 665e9810340abc37769b317445907bac1843dd64 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Fri, 27 Oct 2023 16:46:04 +0100
4 Subject: [PATCH] drm/vc4: Add hvs_dlist_allocs debugfs function.
5
6 Users are reporting running out of DLIST memory. Add a
7 debugfs file to dump out all the allocations.
8
9 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
10 ---
11 drivers/gpu/drm/vc4/vc4_hvs.c | 35 +++++++++++++++++++++++++++++++++++
12 1 file changed, 35 insertions(+)
13
14 --- a/drivers/gpu/drm/vc4/vc4_hvs.c
15 +++ b/drivers/gpu/drm/vc4/vc4_hvs.c
16 @@ -347,6 +347,36 @@ static int vc5_hvs_debugfs_gamma(struct
17 return 0;
18 }
19
20 +static int vc4_hvs_debugfs_dlist_allocs(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 vc4_hvs *hvs = vc4->hvs;
26 + struct drm_printer p = drm_seq_file_printer(m);
27 + struct vc4_hvs_dlist_allocation *cur, *next;
28 + struct drm_mm_node *mm_node;
29 + unsigned long flags;
30 +
31 + spin_lock_irqsave(&hvs->mm_lock, flags);
32 +
33 + drm_printf(&p, "Allocated nodes:\n");
34 + list_for_each_entry(mm_node, drm_mm_nodes(&hvs->dlist_mm), node_list) {
35 + drm_printf(&p, "node [%08llx + %08llx]\n", mm_node->start, mm_node->size);
36 + }
37 +
38 + drm_printf(&p, "Stale nodes:\n");
39 + list_for_each_entry_safe(cur, next, &hvs->stale_dlist_entries, node) {
40 + drm_printf(&p, "node [%08llx + %08llx] channel %u frcnt %u\n",
41 + cur->mm_node.start, cur->mm_node.size, cur->channel,
42 + cur->target_frame_count);
43 + }
44 +
45 + spin_unlock_irqrestore(&hvs->mm_lock, flags);
46 +
47 + return 0;
48 +}
49 +
50 /* The filter kernel is composed of dwords each containing 3 9-bit
51 * signed integers packed next to each other.
52 */
53 @@ -1602,6 +1632,11 @@ int vc4_hvs_debugfs_init(struct drm_mino
54 if (ret)
55 return ret;
56
57 + ret = vc4_debugfs_add_file(minor, "hvs_dlist_allocs",
58 + vc4_hvs_debugfs_dlist_allocs, NULL);
59 + if (ret)
60 + return ret;
61 +
62 ret = vc4_debugfs_add_regset32(minor, "hvs_regs",
63 &hvs->regset);
64 if (ret)