aboutsummaryrefslogtreecommitdiffstats
path: root/meta-steppeeagle/recipes-kernel/linux/linux-yocto/0015-yocto-amd-drm-radeon-add-uvd-debugfs-support.patch
blob: fd312353a8c83b162adac201afc106a027478682 (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
From 627d32e67d83a65294cb9da1e7ef796009b0e5d8 Mon Sep 17 00:00:00 2001
From: Leo Liu <leo.liu@amd.com>
Date: Mon, 25 Nov 2013 17:25:41 -0500
Subject: [PATCH 15/44] drm/radeon: add uvd debugfs support

Signed-off-by: Leo Liu <leo.liu@amd.com>
---
 drivers/gpu/drm/radeon/radeon.h     |    1 +
 drivers/gpu/drm/radeon/radeon_uvd.c |   37 +++++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index a21b1d4..b212569 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -1549,6 +1549,7 @@ struct radeon_uvd {
 	struct drm_file		*filp[RADEON_MAX_UVD_HANDLES];
 	unsigned		img_size[RADEON_MAX_UVD_HANDLES];
 	struct delayed_work	idle_work;
+	bool			status;
 };
 
 int radeon_uvd_init(struct radeon_device *rdev);
diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c
index 1d029cc..2b502b4 100644
--- a/drivers/gpu/drm/radeon/radeon_uvd.c
+++ b/drivers/gpu/drm/radeon/radeon_uvd.c
@@ -53,6 +53,7 @@ MODULE_FIRMWARE(FIRMWARE_TAHITI);
 MODULE_FIRMWARE(FIRMWARE_BONAIRE);
 
 static void radeon_uvd_idle_work_handler(struct work_struct *work);
+static int radeon_debugfs_uvd_init(struct radeon_device *rdev);
 
 int radeon_uvd_init(struct radeon_device *rdev)
 {
@@ -142,6 +143,10 @@ int radeon_uvd_init(struct radeon_device *rdev)
 		return r;
 	}
 
+	r = radeon_debugfs_uvd_init(rdev);
+	if (r)
+		dev_err(rdev->dev, "(%d) Register debugfs file for uvd failed\n", r);
+
 	radeon_bo_unreserve(rdev->uvd.vcpu_bo);
 
 	for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) {
@@ -785,6 +790,7 @@ static void radeon_uvd_idle_work_handler(struct work_struct *work)
 		schedule_delayed_work(&rdev->uvd.idle_work,
 				      msecs_to_jiffies(UVD_IDLE_TIMEOUT_MS));
 	}
+	rdev->uvd.status = false;
 }
 
 void radeon_uvd_note_usage(struct radeon_device *rdev)
@@ -812,6 +818,7 @@ void radeon_uvd_note_usage(struct radeon_device *rdev)
 		} else {
 			radeon_set_uvd_clocks(rdev, 53300, 40000);
 		}
+		rdev->uvd.status = true;
 	}
 }
 
@@ -951,3 +958,33 @@ int radeon_uvd_send_upll_ctlreq(struct radeon_device *rdev,
 
 	return 0;
 }
+
+/*
+ * Debugfs info
+ */
+#if defined(CONFIG_DEBUG_FS)
+
+static int radeon_debugfs_uvd_info(struct seq_file *m, void *data)
+{
+	struct drm_info_node *node = (struct drm_info_node *) m->private;
+	struct drm_device *dev = node->minor->dev;
+	struct radeon_device *rdev = dev->dev_private;
+
+	seq_printf(m, "UVD Status: %s\n", ((rdev->uvd.status) ? "Busy" : "Idle"));
+
+	return 0;
+}
+
+static struct drm_info_list radeon_uvd_info_list[] = {
+	{"radeon_uvd_info", radeon_debugfs_uvd_info, 0, NULL},
+};
+#endif
+
+static int radeon_debugfs_uvd_init(struct radeon_device *rdev)
+{
+#if defined(CONFIG_DEBUG_FS)
+	return radeon_debugfs_add_files(rdev, radeon_uvd_info_list, ARRAY_SIZE(radeon_uvd_info_list));
+#else
+	return 0;
+#endif
+}
-- 
1.7.9.5