mediatek: add v4.19 support
[openwrt/staging/wigyori.git] / target / linux / brcm2708 / patches-4.19 / 950-0589-drm-v3d-HACK-gut-runtime-pm-for-now.patch
1 From f5ba2c027e3f21bafcbff13ec513d6a10c8dc585 Mon Sep 17 00:00:00 2001
2 From: Eric Anholt <eric@anholt.net>
3 Date: Mon, 14 Jan 2019 15:13:17 -0800
4 Subject: [PATCH 589/703] drm/v3d: HACK: gut runtime pm for now.
5
6 Something is still unstable -- on starting a new glxgears from an idle
7 X11, I get an MMU violation in high addresses. The CTS also failed
8 quite quickly. With this, CTS progresses for an hour before OOMing
9 (allocating some big buffers when my board only has 600MB available to
10 Linux)
11
12 Signed-off-by: Eric Anholt <eric@anholt.net>
13 ---
14 drivers/gpu/drm/v3d/v3d_debugfs.c | 16 +---------------
15 drivers/gpu/drm/v3d/v3d_drv.c | 7 -------
16 drivers/gpu/drm/v3d/v3d_gem.c | 20 --------------------
17 3 files changed, 1 insertion(+), 42 deletions(-)
18
19 --- a/drivers/gpu/drm/v3d/v3d_debugfs.c
20 +++ b/drivers/gpu/drm/v3d/v3d_debugfs.c
21 @@ -4,7 +4,6 @@
22 #include <linux/circ_buf.h>
23 #include <linux/ctype.h>
24 #include <linux/debugfs.h>
25 -#include <linux/pm_runtime.h>
26 #include <linux/seq_file.h>
27 #include <drm/drmP.h>
28
29 @@ -100,11 +99,8 @@ static int v3d_v3d_debugfs_ident(struct
30 struct drm_device *dev = node->minor->dev;
31 struct v3d_dev *v3d = to_v3d_dev(dev);
32 u32 ident0, ident1, ident2, ident3, cores;
33 - int ret, core;
34 + int core;
35
36 - ret = pm_runtime_get_sync(v3d->dev);
37 - if (ret < 0)
38 - return ret;
39
40 ident0 = V3D_READ(V3D_HUB_IDENT0);
41 ident1 = V3D_READ(V3D_HUB_IDENT1);
42 @@ -157,9 +153,6 @@ static int v3d_v3d_debugfs_ident(struct
43 (misccfg & V3D_MISCCFG_OVRTMUOUT) != 0);
44 }
45
46 - pm_runtime_mark_last_busy(v3d->dev);
47 - pm_runtime_put_autosuspend(v3d->dev);
48 -
49 return 0;
50 }
51
52 @@ -187,11 +180,6 @@ static int v3d_measure_clock(struct seq_
53 uint32_t cycles;
54 int core = 0;
55 int measure_ms = 1000;
56 - int ret;
57 -
58 - ret = pm_runtime_get_sync(v3d->dev);
59 - if (ret < 0)
60 - return ret;
61
62 if (v3d->ver >= 40) {
63 V3D_CORE_WRITE(core, V3D_V4_PCTR_0_SRC_0_3,
64 @@ -215,8 +203,6 @@ static int v3d_measure_clock(struct seq_
65 cycles / (measure_ms * 1000),
66 (cycles / (measure_ms * 100)) % 10);
67
68 - pm_runtime_mark_last_busy(v3d->dev);
69 - pm_runtime_put_autosuspend(v3d->dev);
70
71 return 0;
72 }
73 --- a/drivers/gpu/drm/v3d/v3d_drv.c
74 +++ b/drivers/gpu/drm/v3d/v3d_drv.c
75 @@ -75,7 +75,6 @@ static int v3d_get_param_ioctl(struct dr
76 {
77 struct v3d_dev *v3d = to_v3d_dev(dev);
78 struct drm_v3d_get_param *args = data;
79 - int ret;
80 static const u32 reg_map[] = {
81 [DRM_V3D_PARAM_V3D_UIFCFG] = V3D_HUB_UIFCFG,
82 [DRM_V3D_PARAM_V3D_HUB_IDENT1] = V3D_HUB_IDENT1,
83 @@ -101,15 +100,12 @@ static int v3d_get_param_ioctl(struct dr
84 if (args->value != 0)
85 return -EINVAL;
86
87 - ret = pm_runtime_get_sync(v3d->dev);
88 if (args->param >= DRM_V3D_PARAM_V3D_CORE0_IDENT0 &&
89 args->param <= DRM_V3D_PARAM_V3D_CORE0_IDENT2) {
90 args->value = V3D_CORE_READ(0, offset);
91 } else {
92 args->value = V3D_READ(offset);
93 }
94 - pm_runtime_mark_last_busy(v3d->dev);
95 - pm_runtime_put_autosuspend(v3d->dev);
96 return 0;
97 }
98
99 @@ -311,9 +307,6 @@ static int v3d_platform_drm_probe(struct
100 goto dev_free;
101 }
102
103 - pm_runtime_use_autosuspend(dev);
104 - pm_runtime_set_autosuspend_delay(dev, 50);
105 - pm_runtime_enable(dev);
106
107 ret = drm_dev_init(&v3d->drm, &v3d_drm_driver, dev);
108 if (ret)
109 --- a/drivers/gpu/drm/v3d/v3d_gem.c
110 +++ b/drivers/gpu/drm/v3d/v3d_gem.c
111 @@ -375,7 +375,6 @@ v3d_exec_cleanup(struct kref *ref)
112 {
113 struct v3d_exec_info *exec = container_of(ref, struct v3d_exec_info,
114 refcount);
115 - struct v3d_dev *v3d = exec->v3d;
116 unsigned int i;
117 struct v3d_bo *bo, *save;
118
119 @@ -396,9 +395,6 @@ v3d_exec_cleanup(struct kref *ref)
120 drm_gem_object_put_unlocked(&bo->base);
121 }
122
123 - pm_runtime_mark_last_busy(v3d->dev);
124 - pm_runtime_put_autosuspend(v3d->dev);
125 -
126 kfree(exec);
127 }
128
129 @@ -412,7 +408,6 @@ v3d_tfu_job_cleanup(struct kref *ref)
130 {
131 struct v3d_tfu_job *job = container_of(ref, struct v3d_tfu_job,
132 refcount);
133 - struct v3d_dev *v3d = job->v3d;
134 unsigned int i;
135
136 dma_fence_put(job->in_fence);
137 @@ -423,9 +418,6 @@ v3d_tfu_job_cleanup(struct kref *ref)
138 drm_gem_object_put_unlocked(&job->bo[i]->base);
139 }
140
141 - pm_runtime_mark_last_busy(v3d->dev);
142 - pm_runtime_put_autosuspend(v3d->dev);
143 -
144 kfree(job);
145 }
146
147 @@ -519,12 +511,6 @@ v3d_submit_cl_ioctl(struct drm_device *d
148 if (!exec)
149 return -ENOMEM;
150
151 - ret = pm_runtime_get_sync(v3d->dev);
152 - if (ret < 0) {
153 - kfree(exec);
154 - return ret;
155 - }
156 -
157 kref_init(&exec->refcount);
158
159 ret = drm_syncobj_find_fence(file_priv, args->in_sync_bcl,
160 @@ -643,12 +629,6 @@ v3d_submit_tfu_ioctl(struct drm_device *
161 if (!job)
162 return -ENOMEM;
163
164 - ret = pm_runtime_get_sync(v3d->dev);
165 - if (ret < 0) {
166 - kfree(job);
167 - return ret;
168 - }
169 -
170 kref_init(&job->refcount);
171
172 ret = drm_syncobj_find_fence(file_priv, args->in_sync,