Skip to content

Commit 9601bf7

Browse files
txenoopopcornmix
authored andcommitted
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. We don't need to change the V3D core frequency to run a CPU job as it is executed on the CPU. This way we avoid delaying timestamps CPU jobs by 4.5ms that is the time that it takes the firmware to increase the V3D core frequency. Fixes: fe6a858 ("drm/v3d: Correct clock settng calls to new APIs") Signed-off-by: Jose Maria Casanova Crespo <[email protected]> Reviewed-by: Maíra Canal <[email protected]>
1 parent f1bdb6f commit 9601bf7

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

drivers/gpu/drm/v3d/v3d_submit.c

Lines changed: 23 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,31 @@ 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+
157+
v3d_job_free_common(job, true);
158+
}
159+
160+
static void
161+
v3d_cpu_job_free(struct kref *ref)
162+
{
163+
struct v3d_job *job = container_of(ref, struct v3d_job, refcount);
164+
165+
v3d_job_free_common(job, false);
166+
}
167+
151168
static void
152169
v3d_render_job_free(struct kref *ref)
153170
{
@@ -242,8 +259,9 @@ v3d_job_init(struct v3d_dev *v3d, struct drm_file *file_priv,
242259
if (ret && ret != -ENOENT)
243260
goto fail_deps;
244261
}
262+
if (queue != V3D_CPU)
263+
v3d_clock_up_get(v3d);
245264

246-
v3d_clock_up_get(v3d);
247265
kref_init(&job->refcount);
248266

249267
return 0;
@@ -1350,7 +1368,7 @@ v3d_submit_cpu_ioctl(struct drm_device *dev, void *data,
13501368
trace_v3d_submit_cpu_ioctl(&v3d->drm, cpu_job->job_type);
13511369

13521370
ret = v3d_job_init(v3d, file_priv, &cpu_job->base,
1353-
v3d_job_free, 0, &se, V3D_CPU);
1371+
v3d_cpu_job_free, 0, &se, V3D_CPU);
13541372
if (ret) {
13551373
v3d_job_deallocate((void *)&cpu_job);
13561374
goto fail;

0 commit comments

Comments
 (0)