Skip to content

Commit 3eee4cc

Browse files
committed
drm/v3d: CPU job submissions shouldn't affect V3D GPU clock
We can avoid calling the v3d_clock_up_put and v3d_clock_up_get when a job is submitted to a CPU queue. This way we avoid delaying timestamps CPU jobs by 4.5ms that is the time that it takes to increase the V3D frequency when the V3D subsystem changes its clock frequency. Fixes: fe6a858 ("drm/v3d: Correct clock settng calls to new APIs")
1 parent a20d400 commit 3eee4cc

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

drivers/gpu/drm/v3d/v3d_submit.c

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ v3d_lookup_bos(struct drm_device *dev,
125125
}
126126

127127
static void
128-
v3d_job_free(struct kref *ref)
128+
v3d_job_free_common(struct v3d_job *job,
129+
bool is_gpu_job)
129130
{
130-
struct v3d_job *job = container_of(ref, struct v3d_job, refcount);
131131
struct v3d_dev *v3d = job->v3d;
132132
int i;
133133

@@ -140,14 +140,29 @@ v3d_job_free(struct kref *ref)
140140
dma_fence_put(job->irq_fence);
141141
dma_fence_put(job->done_fence);
142142

143-
v3d_clock_up_put(v3d);
143+
if (is_gpu_job)
144+
v3d_clock_up_put(v3d);
144145

145146
if (job->perfmon)
146147
v3d_perfmon_put(job->perfmon);
147148

148149
kfree(job);
149150
}
150151

152+
static void
153+
v3d_job_free(struct kref *ref)
154+
{
155+
struct v3d_job *job = container_of(ref, struct v3d_job, refcount);
156+
v3d_job_free_common(job, true);
157+
}
158+
159+
static void
160+
v3d_cpu_job_free(struct kref *ref)
161+
{
162+
struct v3d_job *job = container_of(ref, struct v3d_job, refcount);
163+
v3d_job_free_common(job, false);
164+
}
165+
151166
static void
152167
v3d_render_job_free(struct kref *ref)
153168
{
@@ -242,8 +257,9 @@ v3d_job_init(struct v3d_dev *v3d, struct drm_file *file_priv,
242257
if (ret && ret != -ENOENT)
243258
goto fail_deps;
244259
}
260+
if (queue != V3D_CPU)
261+
v3d_clock_up_get(v3d);
245262

246-
v3d_clock_up_get(v3d);
247263
kref_init(&job->refcount);
248264

249265
return 0;
@@ -1350,7 +1366,7 @@ v3d_submit_cpu_ioctl(struct drm_device *dev, void *data,
13501366
trace_v3d_submit_cpu_ioctl(&v3d->drm, cpu_job->job_type);
13511367

13521368
ret = v3d_job_init(v3d, file_priv, &cpu_job->base,
1353-
v3d_job_free, 0, &se, V3D_CPU);
1369+
v3d_cpu_job_free, 0, &se, V3D_CPU);
13541370
if (ret) {
13551371
v3d_job_deallocate((void *)&cpu_job);
13561372
goto fail;

0 commit comments

Comments
 (0)